verdaccio 6.10.5 → 6.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/build/api/endpoint/api/whoami.js +4 -1
- package/build/api/endpoint/api/whoami.js.map +1 -1
- package/build/api/endpoint/api/whoami.mjs +4 -1
- package/build/api/endpoint/api/whoami.mjs.map +1 -1
- package/build/api/index.js +1 -1
- package/build/api/index.mjs +1 -1
- package/build/api/web/api/user.js +5 -3
- package/build/api/web/api/user.js.map +1 -1
- package/build/api/web/api/user.mjs +5 -3
- package/build/api/web/api/user.mjs.map +1 -1
- package/build/lib/cli/cli.js +1 -1
- package/build/lib/cli/cli.mjs +1 -1
- package/build/lib/cli/commands/init.js +1 -1
- package/build/lib/cli/commands/init.mjs +1 -1
- package/build/lib/cli/commands/version.js +1 -1
- package/build/lib/cli/commands/version.mjs +1 -1
- package/package.json +22 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.10.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7bd480a: The Docker image no longer trusts certificates issued through the compromised eMudhra (emSign) intermediate CAs.
|
|
8
|
+
|
|
9
|
+
In October 2026, eMudhra disclosed that the private keys of several of its intermediate certificate authorities had been compromised. Anyone holding those keys can issue a TLS certificate that a client trusting the eMudhra chain accepts as valid, for any host. Verdaccio connects to its uplinks (such as registry.npmjs.org) over HTTPS, so an attacker able to intercept that traffic could impersonate an uplink and serve tampered metadata or tarballs, which Verdaccio would then cache.
|
|
10
|
+
|
|
11
|
+
The image is now built on `node:24.22.1-alpine` instead of `node:24.15.0-alpine`. Node.js 24.22.1 updates its bundled root certificates to NSS 3.131.1, which removes `emSign ECC Root CA - G3`, and rejects chains that contain the compromised public keys. Node.js uses that bundled store for outgoing HTTPS by default. The image also upgrades Alpine's `ca-certificates` package at build time. That package matters only if you make Node.js read the system store, for example with `NODE_EXTRA_CA_CERTS` or `--use-system-ca`.
|
|
12
|
+
|
|
13
|
+
Every earlier `verdaccio/verdaccio` 6.x image is affected. To get the fix, pull the new image. If you install Verdaccio from npm instead of Docker, upgrade Node.js to 22.23.4, 24.22.1, 26.12.1 or later.
|
|
14
|
+
|
|
15
|
+
## 6.10.6
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 56b6a85: Disable dependency lifecycle scripts and require third-party dependencies to be at least three days old when installing Verdaccio in the final Docker image stage.
|
|
20
|
+
|
|
21
|
+
The production installation now uses npm's `--ignore-scripts` and `--min-release-age=3` options. Verdaccio and packages matching `@verdaccio/*` or `verdaccio-*` are excluded from the age restriction so new Verdaccio releases can be built immediately. The final stage updates npm to support these exclusions and disables installation audit and funding output. Image builds still fail if another required dependency has no eligible version. No configuration changes are required for operators.
|
|
22
|
+
- db47d78: Update verdaccio dependencies to the `latest` npm dist-tag (`@verdaccio/ui-theme` tracks `next-9`):
|
|
23
|
+
|
|
24
|
+
- `@verdaccio/ui-theme`: `9.0.0-next-9.34` → `9.0.0-next-9.36`
|
|
25
|
+
- fdbfef9: Improve request validation when changing passwords and signing in through the web API.
|
|
26
|
+
|
|
27
|
+
Password changes validate the supplied credential fields before invoking the authentication plugin. Existing passwords remain eligible for replacement even when they do not meet the current policy. The existing validation for new passwords and authentication plugin error handling remain unchanged. No configuration changes are required.
|
|
28
|
+
|
|
29
|
+
Web sign-in requests now validate the supplied credential fields the same way as password changes. Requests that omit the username or password, send either with a type other than a string, or send a `null` body are rejected with HTTP 400 and the message `username and password is required`; a `null` body previously failed with an internal server error (HTTP 500), and the other cases reached the authentication plugin. Empty strings are still passed to the authentication plugin, which rejects them as before. The web UI always sends both fields, so signing in from it is unaffected.
|
|
30
|
+
|
|
31
|
+
This release also updates the internal `@verdaccio/*` modules and the bundled `verdaccio-htpasswd` and `verdaccio-audit` plugins to their latest 6.x-compatible versions. The shared password validator now accepts input of any type and rejects anything that is not a string, and the webhook notification templates use Handlebars 4.7.10, which includes a security fix. `proxy-addr`, which Express uses to resolve client addresses when `server.trustProxy` is configured, is updated to 2.0.8, which includes a security fix for trusted-subnet matching of IPv4-mapped IPv6 addresses.
|
|
32
|
+
- abced78: `npm whoami` and any other request to `/-/whoami` now answer `401 Unauthorized` when the request carries no credentials or a token Verdaccio does not recognise.
|
|
33
|
+
|
|
34
|
+
Until now the endpoint answered `200` with an empty body `{}` for anonymous requests, so clients that check the status code, rather than the `username` field, treated an expired or wrong token as a valid login. The npm public registry and Verdaccio 7 answer `401` in that case, and this release aligns 6.x with them. Requests with a valid token are unchanged and still return `{ "username": "<name>" }`. No configuration change is required.
|
|
35
|
+
|
|
36
|
+
This release also updates the internal `@verdaccio/*` modules to their latest 8.x patches. `@verdaccio/core` 8.3.3 corrects the input type of the shared password validator, without changing which passwords are accepted. `@verdaccio/hooks` 8.1.7 brings `handlebars` 4.7.10, which fixes several template injection advisories in the library that renders notification templates.
|
|
37
|
+
|
|
38
|
+
`proxy-addr`, used by Express to decide which proxies are trusted when `X-Forwarded-For` is read, is pinned to 2.0.8 to fix an IP spoofing issue with IPv4-mapped IPv6 trusted subnets (GHSA-jqcg-44mw-7w3h).
|
|
39
|
+
|
|
3
40
|
## 6.10.5
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
|
@@ -3,10 +3,13 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
let _verdaccio_middleware = require("@verdaccio/middleware");
|
|
6
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
6
7
|
//#region src/api/endpoint/api/whoami.ts
|
|
7
8
|
function whoami_default(route) {
|
|
8
9
|
route.get(_verdaccio_middleware.USER_API_ENDPOINTS.whoami, (req, res, next) => {
|
|
9
|
-
|
|
10
|
+
const username = req.remote_user?.name;
|
|
11
|
+
if (!username) return next(_verdaccio_core.errorUtils.getUnauthorized("Unauthorized"));
|
|
12
|
+
next({ username });
|
|
10
13
|
});
|
|
11
14
|
}
|
|
12
15
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.js","names":[],"sources":["../../../../src/api/endpoint/api/whoami.ts"],"sourcesContent":["import type { Response, Router } from 'express';\n\nimport { USER_API_ENDPOINTS } from '@verdaccio/middleware';\n\nimport type { $NextFunctionVer, $RequestExtend } from '../../../types';\n\nexport default function (route: Router): void {\n route.get(\n USER_API_ENDPOINTS.whoami,\n (req: $RequestExtend, res: Response, next: $NextFunctionVer): any => {\n
|
|
1
|
+
{"version":3,"file":"whoami.js","names":[],"sources":["../../../../src/api/endpoint/api/whoami.ts"],"sourcesContent":["import type { Response, Router } from 'express';\n\nimport { errorUtils } from '@verdaccio/core';\nimport { USER_API_ENDPOINTS } from '@verdaccio/middleware';\n\nimport type { $NextFunctionVer, $RequestExtend } from '../../../types';\n\nexport default function (route: Router): void {\n route.get(\n USER_API_ENDPOINTS.whoami,\n (req: $RequestExtend, res: Response, next: $NextFunctionVer): any => {\n const username = req.remote_user?.name;\n if (!username) {\n return next(errorUtils.getUnauthorized('Unauthorized'));\n }\n\n next({ username });\n }\n );\n}\n"],"mappings":";;;;;;;AAOA,SAAA,eAAyB,OAAqB;CAC5C,MAAM,IACJ,sBAAA,mBAAmB,SAClB,KAAqB,KAAe,SAAgC;EACnE,MAAM,WAAW,IAAI,aAAa;EAClC,IAAI,CAAC,UACH,OAAO,KAAK,gBAAA,WAAW,gBAAgB,cAAc,CAAC;EAGxD,KAAK,EAAE,SAAS,CAAC;CACnB,CACF;AACF"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { USER_API_ENDPOINTS } from "@verdaccio/middleware";
|
|
2
|
+
import { errorUtils } from "@verdaccio/core";
|
|
2
3
|
//#region src/api/endpoint/api/whoami.ts
|
|
3
4
|
function whoami_default(route) {
|
|
4
5
|
route.get(USER_API_ENDPOINTS.whoami, (req, res, next) => {
|
|
5
|
-
|
|
6
|
+
const username = req.remote_user?.name;
|
|
7
|
+
if (!username) return next(errorUtils.getUnauthorized("Unauthorized"));
|
|
8
|
+
next({ username });
|
|
6
9
|
});
|
|
7
10
|
}
|
|
8
11
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.mjs","names":[],"sources":["../../../../src/api/endpoint/api/whoami.ts"],"sourcesContent":["import type { Response, Router } from 'express';\n\nimport { USER_API_ENDPOINTS } from '@verdaccio/middleware';\n\nimport type { $NextFunctionVer, $RequestExtend } from '../../../types';\n\nexport default function (route: Router): void {\n route.get(\n USER_API_ENDPOINTS.whoami,\n (req: $RequestExtend, res: Response, next: $NextFunctionVer): any => {\n
|
|
1
|
+
{"version":3,"file":"whoami.mjs","names":[],"sources":["../../../../src/api/endpoint/api/whoami.ts"],"sourcesContent":["import type { Response, Router } from 'express';\n\nimport { errorUtils } from '@verdaccio/core';\nimport { USER_API_ENDPOINTS } from '@verdaccio/middleware';\n\nimport type { $NextFunctionVer, $RequestExtend } from '../../../types';\n\nexport default function (route: Router): void {\n route.get(\n USER_API_ENDPOINTS.whoami,\n (req: $RequestExtend, res: Response, next: $NextFunctionVer): any => {\n const username = req.remote_user?.name;\n if (!username) {\n return next(errorUtils.getUnauthorized('Unauthorized'));\n }\n\n next({ username });\n }\n );\n}\n"],"mappings":";;;AAOA,SAAA,eAAyB,OAAqB;CAC5C,MAAM,IACJ,mBAAmB,SAClB,KAAqB,KAAe,SAAgC;EACnE,MAAM,WAAW,IAAI,aAAa;EAClC,IAAI,CAAC,UACH,OAAO,KAAK,WAAW,gBAAgB,cAAc,CAAC;EAGxD,KAAK,EAAE,SAAS,CAAC;CACnB,CACF;AACF"}
|
package/build/api/index.js
CHANGED
|
@@ -27,7 +27,7 @@ let cors = require("cors");
|
|
|
27
27
|
cors = require_runtime.__toESM(cors);
|
|
28
28
|
let _verdaccio_loaders = require("@verdaccio/loaders");
|
|
29
29
|
//#region src/api/index.ts
|
|
30
|
-
var version = "6.10.
|
|
30
|
+
var version = "6.10.7";
|
|
31
31
|
var defineAPI = async function(config, storage) {
|
|
32
32
|
const auth = new _verdaccio_auth.Auth(config, require_lib_logger_index.logger, { legacyMergeConfigs: true });
|
|
33
33
|
await auth.init();
|
package/build/api/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import compression from "compression";
|
|
|
18
18
|
import cors from "cors";
|
|
19
19
|
import { asyncLoadPlugin } from "@verdaccio/loaders";
|
|
20
20
|
//#region src/api/index.ts
|
|
21
|
-
var version = "6.10.
|
|
21
|
+
var version = "6.10.7";
|
|
22
22
|
var defineAPI = async function(config, storage) {
|
|
23
23
|
const auth = new Auth(config, logger, { legacyMergeConfigs: true });
|
|
24
24
|
await auth.init();
|
|
@@ -16,7 +16,9 @@ let express = require("express");
|
|
|
16
16
|
function addUserAuthApi(auth, config) {
|
|
17
17
|
const route = (0, express.Router)();
|
|
18
18
|
route.post(require_api_web_api_utils.wrapSecPath(_verdaccio_middleware.WebUrls.user_login), (0, _verdaccio_middleware.rateLimit)(config?.userRateLimit), function(req, res, next) {
|
|
19
|
-
const
|
|
19
|
+
const username = req.body?.username;
|
|
20
|
+
const password = req.body?.password;
|
|
21
|
+
if (typeof username !== "string" || _verdaccio_core.validationUtils.validatePassword(password, /^/) === false) return next(require_lib_utils.ErrorCode.getCode(_verdaccio_core.HTTP_STATUS.BAD_REQUEST, _verdaccio_core.API_ERROR.USERNAME_PASSWORD_REQUIRED));
|
|
20
22
|
auth.authenticate(username, password, async (err, user) => {
|
|
21
23
|
if (err) {
|
|
22
24
|
const errorCode = err.message ? _verdaccio_core.HTTP_STATUS.UNAUTHORIZED : _verdaccio_core.HTTP_STATUS.INTERNAL_ERROR;
|
|
@@ -38,9 +40,9 @@ function addUserAuthApi(auth, config) {
|
|
|
38
40
|
res.status(_verdaccio_core.HTTP_STATUS.UNAUTHORIZED);
|
|
39
41
|
return next({ message: _verdaccio_core.API_ERROR.MUST_BE_LOGGED });
|
|
40
42
|
}
|
|
41
|
-
const
|
|
43
|
+
const password = req.body?.password;
|
|
42
44
|
const { name } = req.remote_user;
|
|
43
|
-
if (_verdaccio_core.validationUtils.validatePassword(password.new) === false) return next(require_lib_utils.ErrorCode.getCode(_verdaccio_core.HTTP_STATUS.BAD_REQUEST, _verdaccio_core.APP_ERROR.PASSWORD_VALIDATION));
|
|
45
|
+
if (_verdaccio_core.validationUtils.validatePassword(password?.old, /^/) === false || _verdaccio_core.validationUtils.validatePassword(password?.new) === false) return next(require_lib_utils.ErrorCode.getCode(_verdaccio_core.HTTP_STATUS.BAD_REQUEST, _verdaccio_core.APP_ERROR.PASSWORD_VALIDATION));
|
|
44
46
|
auth.changePassword(name, password.old, password.new, (err, isUpdated) => {
|
|
45
47
|
if (lodash.default.isNil(err) && isUpdated) next({ ok: true });
|
|
46
48
|
else if (!lodash.default.isNil(err)) return next(require_lib_utils.ErrorCode.getCode(lodash.default.isNil(err.status) ? _verdaccio_core.HTTP_STATUS.CONFLICT : err.status, err.message));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","names":[],"sources":["../../../../src/api/web/api/user.ts"],"sourcesContent":["import type { Request, Response } from 'express';\nimport { Router } from 'express';\nimport _ from 'lodash';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { validationUtils } from '@verdaccio/core';\nimport { WebUrls, rateLimit } from '@verdaccio/middleware';\nimport type { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { getSecurity } from '../../../lib/auth-utils';\nimport { API_ERROR, APP_ERROR, HEADERS, HTTP_STATUS, TOKEN_BEARER } from '../../../lib/constants';\nimport { ErrorCode } from '../../../lib/utils';\nimport type { $NextFunctionVer } from '../../../types';\nimport { wrapSecPath } from './utils';\n\nfunction addUserAuthApi(auth: Auth, config: Config): Router {\n const route = Router();\n route.post(\n wrapSecPath(WebUrls.user_login),\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n const
|
|
1
|
+
{"version":3,"file":"user.js","names":[],"sources":["../../../../src/api/web/api/user.ts"],"sourcesContent":["import type { Request, Response } from 'express';\nimport { Router } from 'express';\nimport _ from 'lodash';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { validationUtils } from '@verdaccio/core';\nimport { WebUrls, rateLimit } from '@verdaccio/middleware';\nimport type { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { getSecurity } from '../../../lib/auth-utils';\nimport { API_ERROR, APP_ERROR, HEADERS, HTTP_STATUS, TOKEN_BEARER } from '../../../lib/constants';\nimport { ErrorCode } from '../../../lib/utils';\nimport type { $NextFunctionVer } from '../../../types';\nimport { wrapSecPath } from './utils';\n\nfunction addUserAuthApi(auth: Auth, config: Config): Router {\n const route = Router();\n route.post(\n wrapSecPath(WebUrls.user_login),\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n const username = req.body?.username;\n const password = req.body?.password;\n\n if (\n typeof username !== 'string' ||\n validationUtils.validatePassword(password, /^/) === false\n ) {\n return next(\n ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, API_ERROR.USERNAME_PASSWORD_REQUIRED)\n );\n }\n\n auth.authenticate(username, password, async (err, user?: RemoteUser): Promise<void> => {\n if (err) {\n const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;\n if (errorCode === HTTP_STATUS.UNAUTHORIZED) {\n res.set(HEADERS.WWW_AUTH, TOKEN_BEARER);\n }\n return next(ErrorCode.getCode(errorCode, err.message));\n } else {\n req.remote_user = user as RemoteUser;\n const jWTSignOptions: JWTSignOptions = getSecurity(config).web.sign;\n res.set(HEADERS.CACHE_CONTROL, 'no-cache, no-store');\n return next({\n token: await auth.jwtEncrypt(user as RemoteUser, jWTSignOptions),\n username: req.remote_user.name,\n });\n }\n });\n }\n );\n\n if (config?.flags?.changePassword === true) {\n route.put(\n wrapSecPath(WebUrls.reset_password),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n if (_.isNil(req.remote_user.name)) {\n res.status(HTTP_STATUS.UNAUTHORIZED);\n return next({\n // FUTURE: update to a more meaningful message\n message: API_ERROR.MUST_BE_LOGGED,\n });\n }\n\n const password = req.body?.password;\n const { name } = req.remote_user;\n\n // Existing passwords may predate the current password policy.\n if (\n validationUtils.validatePassword(password?.old, /^/) === false ||\n validationUtils.validatePassword(password?.new) === false\n ) {\n return next(ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));\n }\n\n auth.changePassword(name as string, password.old, password.new, (err, isUpdated): void => {\n if (_.isNil(err) && isUpdated) {\n next({\n ok: true,\n });\n } else if (!_.isNil(err)) {\n return next(\n ErrorCode.getCode(\n _.isNil(err.status) ? HTTP_STATUS.CONFLICT : err.status,\n err.message\n )\n );\n } else {\n return next(ErrorCode.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));\n }\n });\n }\n );\n }\n\n return route;\n}\n\nexport default addUserAuthApi;\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,eAAe,MAAY,QAAwB;CAC1D,MAAM,SAAA,GAAA,QAAA,OAAA,CAAe;CACrB,MAAM,KACJ,0BAAA,YAAY,sBAAA,QAAQ,UAAU,IAAA,GAAA,sBAAA,UAAA,CACpB,QAAQ,aAAa,GAC/B,SAAU,KAAc,KAAe,MAA8B;EACnE,MAAM,WAAW,IAAI,MAAM;EAC3B,MAAM,WAAW,IAAI,MAAM;EAE3B,IACE,OAAO,aAAa,YACpB,gBAAA,gBAAgB,iBAAiB,UAAU,GAAG,MAAM,OAEpD,OAAO,KACL,kBAAA,UAAU,QAAQ,gBAAA,YAAY,aAAa,gBAAA,UAAU,0BAA0B,CACjF;EAGF,KAAK,aAAa,UAAU,UAAU,OAAO,KAAK,SAAqC;GACrF,IAAI,KAAK;IACP,MAAM,YAAY,IAAI,UAAU,gBAAA,YAAY,eAAe,gBAAA,YAAY;IACvE,IAAI,cAAc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AAA,UAAU,iBAAiB,gBAAA,UAAU,qBAAqB,CAAC;EAE3E,CAAC;CACH,CACF;CAGF,OAAO;AACT"}
|
|
@@ -10,7 +10,9 @@ import { Router } from "express";
|
|
|
10
10
|
function addUserAuthApi(auth, config) {
|
|
11
11
|
const route = Router();
|
|
12
12
|
route.post(wrapSecPath(WebUrls.user_login), rateLimit(config?.userRateLimit), function(req, res, next) {
|
|
13
|
-
const
|
|
13
|
+
const username = req.body?.username;
|
|
14
|
+
const password = req.body?.password;
|
|
15
|
+
if (typeof username !== "string" || validationUtils.validatePassword(password, /^/) === false) return next(ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, API_ERROR.USERNAME_PASSWORD_REQUIRED));
|
|
14
16
|
auth.authenticate(username, password, async (err, user) => {
|
|
15
17
|
if (err) {
|
|
16
18
|
const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;
|
|
@@ -32,9 +34,9 @@ function addUserAuthApi(auth, config) {
|
|
|
32
34
|
res.status(HTTP_STATUS.UNAUTHORIZED);
|
|
33
35
|
return next({ message: API_ERROR.MUST_BE_LOGGED });
|
|
34
36
|
}
|
|
35
|
-
const
|
|
37
|
+
const password = req.body?.password;
|
|
36
38
|
const { name } = req.remote_user;
|
|
37
|
-
if (validationUtils.validatePassword(password.new) === false) return next(ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));
|
|
39
|
+
if (validationUtils.validatePassword(password?.old, /^/) === false || validationUtils.validatePassword(password?.new) === false) return next(ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));
|
|
38
40
|
auth.changePassword(name, password.old, password.new, (err, isUpdated) => {
|
|
39
41
|
if (_.isNil(err) && isUpdated) next({ ok: true });
|
|
40
42
|
else if (!_.isNil(err)) return next(ErrorCode.getCode(_.isNil(err.status) ? HTTP_STATUS.CONFLICT : err.status, err.message));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.mjs","names":[],"sources":["../../../../src/api/web/api/user.ts"],"sourcesContent":["import type { Request, Response } from 'express';\nimport { Router } from 'express';\nimport _ from 'lodash';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { validationUtils } from '@verdaccio/core';\nimport { WebUrls, rateLimit } from '@verdaccio/middleware';\nimport type { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { getSecurity } from '../../../lib/auth-utils';\nimport { API_ERROR, APP_ERROR, HEADERS, HTTP_STATUS, TOKEN_BEARER } from '../../../lib/constants';\nimport { ErrorCode } from '../../../lib/utils';\nimport type { $NextFunctionVer } from '../../../types';\nimport { wrapSecPath } from './utils';\n\nfunction addUserAuthApi(auth: Auth, config: Config): Router {\n const route = Router();\n route.post(\n wrapSecPath(WebUrls.user_login),\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n const
|
|
1
|
+
{"version":3,"file":"user.mjs","names":[],"sources":["../../../../src/api/web/api/user.ts"],"sourcesContent":["import type { Request, Response } from 'express';\nimport { Router } from 'express';\nimport _ from 'lodash';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { validationUtils } from '@verdaccio/core';\nimport { WebUrls, rateLimit } from '@verdaccio/middleware';\nimport type { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { getSecurity } from '../../../lib/auth-utils';\nimport { API_ERROR, APP_ERROR, HEADERS, HTTP_STATUS, TOKEN_BEARER } from '../../../lib/constants';\nimport { ErrorCode } from '../../../lib/utils';\nimport type { $NextFunctionVer } from '../../../types';\nimport { wrapSecPath } from './utils';\n\nfunction addUserAuthApi(auth: Auth, config: Config): Router {\n const route = Router();\n route.post(\n wrapSecPath(WebUrls.user_login),\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n const username = req.body?.username;\n const password = req.body?.password;\n\n if (\n typeof username !== 'string' ||\n validationUtils.validatePassword(password, /^/) === false\n ) {\n return next(\n ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, API_ERROR.USERNAME_PASSWORD_REQUIRED)\n );\n }\n\n auth.authenticate(username, password, async (err, user?: RemoteUser): Promise<void> => {\n if (err) {\n const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;\n if (errorCode === HTTP_STATUS.UNAUTHORIZED) {\n res.set(HEADERS.WWW_AUTH, TOKEN_BEARER);\n }\n return next(ErrorCode.getCode(errorCode, err.message));\n } else {\n req.remote_user = user as RemoteUser;\n const jWTSignOptions: JWTSignOptions = getSecurity(config).web.sign;\n res.set(HEADERS.CACHE_CONTROL, 'no-cache, no-store');\n return next({\n token: await auth.jwtEncrypt(user as RemoteUser, jWTSignOptions),\n username: req.remote_user.name,\n });\n }\n });\n }\n );\n\n if (config?.flags?.changePassword === true) {\n route.put(\n wrapSecPath(WebUrls.reset_password),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n if (_.isNil(req.remote_user.name)) {\n res.status(HTTP_STATUS.UNAUTHORIZED);\n return next({\n // FUTURE: update to a more meaningful message\n message: API_ERROR.MUST_BE_LOGGED,\n });\n }\n\n const password = req.body?.password;\n const { name } = req.remote_user;\n\n // Existing passwords may predate the current password policy.\n if (\n validationUtils.validatePassword(password?.old, /^/) === false ||\n validationUtils.validatePassword(password?.new) === false\n ) {\n return next(ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));\n }\n\n auth.changePassword(name as string, password.old, password.new, (err, isUpdated): void => {\n if (_.isNil(err) && isUpdated) {\n next({\n ok: true,\n });\n } else if (!_.isNil(err)) {\n return next(\n ErrorCode.getCode(\n _.isNil(err.status) ? HTTP_STATUS.CONFLICT : err.status,\n err.message\n )\n );\n } else {\n return next(ErrorCode.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));\n }\n });\n }\n );\n }\n\n return route;\n}\n\nexport default addUserAuthApi;\n"],"mappings":";;;;;;;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AAU,QAAQ,YAAY,aAAa,UAAU,mBAAmB,CAAC;EAGvF,KAAK,eAAe,MAAgB,SAAS,KAAK,SAAS,MAAM,KAAK,cAAoB;GACxF,IAAI,EAAE,MAAM,GAAG,KAAK,WAClB,KAAK,EACH,IAAI,KACN,CAAC;QACI,IAAI,CAAC,EAAE,MAAM,GAAG,GACrB,OAAO,KACL,UAAU,QACR,EAAE,MAAM,IAAI,MAAM,IAAI,YAAY,WAAW,IAAI,QACjD,IAAI,OACN,CACF;QAEA,OAAO,KAAK,UAAU,iBAAiB,UAAU,qBAAqB,CAAC;EAE3E,CAAC;CACH,CACF;CAGF,OAAO;AACT"}
|
package/build/lib/cli/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ const require_lib_cli_commands_init = require("./commands/init.js");
|
|
|
5
5
|
const require_lib_cli_commands_version = require("./commands/version.js");
|
|
6
6
|
let clipanion = require("clipanion");
|
|
7
7
|
//#region src/lib/cli/cli.ts
|
|
8
|
-
var pkgVersion = "6.10.
|
|
8
|
+
var pkgVersion = "6.10.7";
|
|
9
9
|
if (process.getuid && process.getuid() === 0) process.emitWarning(`Verdaccio doesn't need superuser privileges. don't run it under root`);
|
|
10
10
|
if (!require_lib_cli_utils.isVersionValid(process.version)) throw new Error(`Verdaccio requires at least Node.js v22 or higher and you have installed ${process.version},
|
|
11
11
|
please upgrade your Node.js distribution`);
|
package/build/lib/cli/cli.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { InitCommand } from "./commands/init.mjs";
|
|
|
4
4
|
import { VersionCommand } from "./commands/version.mjs";
|
|
5
5
|
import { Cli } from "clipanion";
|
|
6
6
|
//#region src/lib/cli/cli.ts
|
|
7
|
-
var pkgVersion = "6.10.
|
|
7
|
+
var pkgVersion = "6.10.7";
|
|
8
8
|
if (process.getuid && process.getuid() === 0) process.emitWarning(`Verdaccio doesn't need superuser privileges. don't run it under root`);
|
|
9
9
|
if (!isVersionValid(process.version)) throw new Error(`Verdaccio requires at least Node.js v22 or higher and you have installed ${process.version},
|
|
10
10
|
please upgrade your Node.js distribution`);
|
|
@@ -10,7 +10,7 @@ let path = require("path");
|
|
|
10
10
|
path = require_runtime.__toESM(path);
|
|
11
11
|
let clipanion = require("clipanion");
|
|
12
12
|
//#region src/lib/cli/commands/init.ts
|
|
13
|
-
var pkgVersion = "6.10.
|
|
13
|
+
var pkgVersion = "6.10.7";
|
|
14
14
|
var pkgName = "verdaccio";
|
|
15
15
|
var DEFAULT_PROCESS_NAME = "verdaccio";
|
|
16
16
|
var InitCommand = class extends clipanion.Command {
|
|
@@ -7,7 +7,7 @@ import { findConfigFile, getListenAddress } from "@verdaccio/config";
|
|
|
7
7
|
import Path from "path";
|
|
8
8
|
import { Command, Option } from "clipanion";
|
|
9
9
|
//#region src/lib/cli/commands/init.ts
|
|
10
|
-
var pkgVersion = "6.10.
|
|
10
|
+
var pkgVersion = "6.10.7";
|
|
11
11
|
var pkgName = "verdaccio";
|
|
12
12
|
var DEFAULT_PROCESS_NAME = "verdaccio";
|
|
13
13
|
var InitCommand = class extends Command {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let clipanion = require("clipanion");
|
|
3
3
|
//#region src/lib/cli/commands/version.ts
|
|
4
|
-
var pkgVersion = "6.10.
|
|
4
|
+
var pkgVersion = "6.10.7";
|
|
5
5
|
var VersionCommand = class extends clipanion.Command {
|
|
6
6
|
static paths = [[`--version`], [`-v`]];
|
|
7
7
|
async execute() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verdaccio",
|
|
3
|
-
"version": "6.10.
|
|
3
|
+
"version": "6.10.7",
|
|
4
4
|
"description": "A lightweight private npm proxy registry",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"enterprise",
|
|
@@ -78,25 +78,25 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@cypress/request": "4.0.1",
|
|
81
|
-
"@verdaccio/auth": "8.1.
|
|
82
|
-
"@verdaccio/config": "8.3.
|
|
83
|
-
"@verdaccio/core": "8.3.
|
|
84
|
-
"@verdaccio/hooks": "8.1.
|
|
85
|
-
"@verdaccio/loaders": "8.1.
|
|
86
|
-
"@verdaccio/local-storage-legacy": "11.4.
|
|
87
|
-
"@verdaccio/logger": "8.1.
|
|
88
|
-
"@verdaccio/middleware": "8.1.
|
|
89
|
-
"@verdaccio/package-filter": "13.2.
|
|
81
|
+
"@verdaccio/auth": "8.1.6",
|
|
82
|
+
"@verdaccio/config": "8.3.3",
|
|
83
|
+
"@verdaccio/core": "8.3.3",
|
|
84
|
+
"@verdaccio/hooks": "8.1.7",
|
|
85
|
+
"@verdaccio/loaders": "8.1.6",
|
|
86
|
+
"@verdaccio/local-storage-legacy": "11.4.6",
|
|
87
|
+
"@verdaccio/logger": "8.1.6",
|
|
88
|
+
"@verdaccio/middleware": "8.1.7",
|
|
89
|
+
"@verdaccio/package-filter": "13.2.4",
|
|
90
90
|
"@verdaccio/search-indexer": "8.1.0",
|
|
91
|
-
"@verdaccio/signature": "8.1.
|
|
91
|
+
"@verdaccio/signature": "8.1.6",
|
|
92
92
|
"@verdaccio/streams": "10.3.0",
|
|
93
|
-
"@verdaccio/tarball": "13.1.
|
|
94
|
-
"@verdaccio/ui-theme": "9.0.0-next-9.
|
|
95
|
-
"@verdaccio/url": "13.1.
|
|
93
|
+
"@verdaccio/tarball": "13.1.6",
|
|
94
|
+
"@verdaccio/ui-theme": "9.0.0-next-9.36",
|
|
95
|
+
"@verdaccio/url": "13.1.6",
|
|
96
96
|
"JSONStream": "1.3.5",
|
|
97
97
|
"async": "3.2.6",
|
|
98
98
|
"clipanion": "4.0.0-rc.4",
|
|
99
|
-
"compression": "1.8.
|
|
99
|
+
"compression": "1.8.2",
|
|
100
100
|
"cors": "2.8.6",
|
|
101
101
|
"debug": "4.4.3",
|
|
102
102
|
"envinfo": "7.21.0",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"lru-cache": "7.18.3",
|
|
106
106
|
"mime": "3.0.0",
|
|
107
107
|
"semver": "7.8.5",
|
|
108
|
-
"verdaccio-audit": "13.1.
|
|
109
|
-
"verdaccio-htpasswd": "13.1.
|
|
108
|
+
"verdaccio-audit": "13.1.7",
|
|
109
|
+
"verdaccio-htpasswd": "13.1.6"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@changesets/changelog-github": "0.7.0",
|
|
@@ -125,9 +125,9 @@
|
|
|
125
125
|
"@types/semver": "7.7.1",
|
|
126
126
|
"@types/supertest": "6.0.3",
|
|
127
127
|
"@verdaccio-scope/verdaccio-auth-foo": "0.0.2",
|
|
128
|
-
"@verdaccio/e2e-cli": "
|
|
128
|
+
"@verdaccio/e2e-cli": "4.0.0",
|
|
129
129
|
"@verdaccio/e2e-ui": "2.7.0",
|
|
130
|
-
"@verdaccio/test-helper": "4.1.
|
|
130
|
+
"@verdaccio/test-helper": "4.1.7",
|
|
131
131
|
"@verdaccio/types": "13.0.6",
|
|
132
132
|
"@vitest/coverage-v8": "4.1.11",
|
|
133
133
|
"cross-env": "10.1.0",
|
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
"ts-node": "10.9.2",
|
|
145
145
|
"tsx": "4.23.0",
|
|
146
146
|
"typescript": "5.9.3",
|
|
147
|
-
"verdaccio-auth-memory": "13.1.
|
|
148
|
-
"verdaccio-memory": "10.5.
|
|
147
|
+
"verdaccio-auth-memory": "13.1.6",
|
|
148
|
+
"verdaccio-memory": "10.5.6",
|
|
149
149
|
"vite": "8.1.4",
|
|
150
150
|
"vitest": "4.1.11"
|
|
151
151
|
},
|
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
"ajv/fast-uri": "3.1.6",
|
|
157
157
|
"body-parser/qs": "6.16.0",
|
|
158
158
|
"express/path-to-regexp": "0.1.13",
|
|
159
|
+
"express/proxy-addr": "2.0.8",
|
|
159
160
|
"lowdb/lodash": "4.18.1"
|
|
160
161
|
},
|
|
161
162
|
"preferGlobal": true,
|