@verdaccio/config 9.0.0-next-9.5 → 9.0.0-next-9.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/README.md CHANGED
@@ -98,16 +98,16 @@ If you want to report a security vulnerability, please follow the steps which we
98
98
 
99
99
  Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/verdaccio/contribute)]
100
100
 
101
- [![sponsor](https://opencollective.com/verdaccio/sponsor/0/avatar.svg)](https://opencollective.com/verdaccio/sponsor/0/website)
102
- [![sponsor](https://opencollective.com/verdaccio/sponsor/1/avatar.svg)](https://opencollective.com/verdaccio/sponsor/1/website)
103
- [![sponsor](https://opencollective.com/verdaccio/sponsor/2/avatar.svg)](https://opencollective.com/verdaccio/sponsor/2/website)
104
- [![sponsor](https://opencollective.com/verdaccio/sponsor/3/avatar.svg)](https://opencollective.com/verdaccio/sponsor/3/website)
105
- [![sponsor](https://opencollective.com/verdaccio/sponsor/4/avatar.svg)](https://opencollective.com/verdaccio/sponsor/4/website)
106
- [![sponsor](https://opencollective.com/verdaccio/sponsor/5/avatar.svg)](https://opencollective.com/verdaccio/sponsor/5/website)
107
- [![sponsor](https://opencollective.com/verdaccio/sponsor/6/avatar.svg)](https://opencollective.com/verdaccio/sponsor/6/website)
108
- [![sponsor](https://opencollective.com/verdaccio/sponsor/7/avatar.svg)](https://opencollective.com/verdaccio/sponsor/7/website)
109
- [![sponsor](https://opencollective.com/verdaccio/sponsor/8/avatar.svg)](https://opencollective.com/verdaccio/sponsor/8/website)
110
- [![sponsor](https://opencollective.com/verdaccio/sponsor/9/avatar.svg)](https://opencollective.com/verdaccio/sponsor/9/website)
101
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/0/avatar.png)](https://opencollective.com/verdaccio/sponsor/0/website)
102
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/1/avatar.png)](https://opencollective.com/verdaccio/sponsor/1/website)
103
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/2/avatar.png)](https://opencollective.com/verdaccio/sponsor/2/website)
104
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/3/avatar.png)](https://opencollective.com/verdaccio/sponsor/3/website)
105
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/4/avatar.png)](https://opencollective.com/verdaccio/sponsor/4/website)
106
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/5/avatar.png)](https://opencollective.com/verdaccio/sponsor/5/website)
107
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/6/avatar.png)](https://opencollective.com/verdaccio/sponsor/6/website)
108
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/7/avatar.png)](https://opencollective.com/verdaccio/sponsor/7/website)
109
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/8/avatar.png)](https://opencollective.com/verdaccio/sponsor/8/website)
110
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/9/avatar.png)](https://opencollective.com/verdaccio/sponsor/9/website)
111
111
 
112
112
  ## Open Collective Backers
113
113
 
@@ -218,6 +218,26 @@ middlewares:
218
218
  enabled: true
219
219
  # timeout: 10000
220
220
 
221
+ # Settings for filter plugins
222
+ # https://verdaccio.org/docs/configuration#filters
223
+ filters:
224
+ '@verdaccio/package-filter':
225
+ # Block versions younger than N days
226
+ # minAgeDays: 30
227
+ # Block versions published after a specific date
228
+ # dateThreshold: '2024-01-01'
229
+ # Block specific packages, scopes, or version ranges
230
+ # block:
231
+ # - scope: '@evilscope'
232
+ # - package: 'malicious-pkg'
233
+ # - package: 'some-pkg'
234
+ # versions: '>=2.0.0'
235
+ # Allow exceptions to block rules
236
+ # allow:
237
+ # - scope: '@trusted'
238
+ # - package: 'some-pkg'
239
+ # versions: '2.1.0'
240
+
221
241
  # Log settings
222
242
  # https://verdaccio.org/docs/logger
223
243
  # Redaction: https://getpino.io/#/docs/redaction
@@ -214,6 +214,26 @@ middlewares:
214
214
  enabled: true
215
215
  # timeout: 10000
216
216
 
217
+ # Settings for filter plugins
218
+ # https://verdaccio.org/docs/configuration#filters
219
+ filters:
220
+ '@verdaccio/package-filter':
221
+ # Block versions younger than N days
222
+ # minAgeDays: 30
223
+ # Block versions published after a specific date
224
+ # dateThreshold: '2024-01-01'
225
+ # Block specific packages, scopes, or version ranges
226
+ # block:
227
+ # - scope: '@evilscope'
228
+ # - package: 'malicious-pkg'
229
+ # - package: 'some-pkg'
230
+ # versions: '>=2.0.0'
231
+ # Allow exceptions to block rules
232
+ # allow:
233
+ # - scope: '@trusted'
234
+ # - package: 'some-pkg'
235
+ # versions: '2.1.0'
236
+
217
237
  # Log settings
218
238
  # https://verdaccio.org/docs/logger
219
239
  # Redaction: https://getpino.io/#/docs/redaction
package/build/config.d.ts CHANGED
@@ -4,7 +4,6 @@ export declare const defaultUserRateLimiting: {
4
4
  windowMs: number;
5
5
  max: number;
6
6
  };
7
- export declare function isNodeVersionGreaterThan21(): boolean;
8
7
  /**
9
8
  * Coordinates the application configuration
10
9
  */
@@ -25,16 +24,12 @@ declare class Config implements AppConfig {
25
24
  plugins: string | void | null;
26
25
  security: Security;
27
26
  server: ServerSettingsConf;
28
- private configOverrideOptions;
29
27
  secret: string;
30
28
  flags: FlagsConfig;
31
29
  userRateLimit: RateLimit;
32
30
  constructor(config: ConfigYaml & {
33
31
  config_path: string;
34
- }, configOverrideOptions?: {
35
- forceMigrateToSecureLegacySignature: boolean;
36
32
  });
37
- getMigrateToSecureLegacySignature(): boolean;
38
33
  getConfigPath(): string;
39
34
  /**
40
35
  * Check for package spec
@@ -44,14 +39,9 @@ declare class Config implements AppConfig {
44
39
  */
45
40
  getMatchedPackagesSpec(pkgName: string): PackageAccess | void;
46
41
  /**
47
- * Verify if the secret complies with the required structure
48
- * - If the secret is not provided, it will generate a new one
49
- * - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)
50
- * - If the secret is provided:
51
- * - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup
52
- * - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning
53
- * - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be
54
- * generated with the new signature model
42
+ * Verify if the secret complies with the required structure.
43
+ * The secret must be exactly 32 characters long for aes-256-ctr encryption.
44
+ * If no secret is provided, a new one will be generated.
55
45
  * @secret external secret key
56
46
  */
57
47
  checkSecretKey(secret?: string): string;
package/build/config.js CHANGED
@@ -13,7 +13,6 @@ let node_assert = require("node:assert");
13
13
  node_assert = require_runtime.__toESM(node_assert);
14
14
  let _verdaccio_core = require("@verdaccio/core");
15
15
  //#region src/config.ts
16
- var { Codes } = _verdaccio_core.warningUtils;
17
16
  var strategicConfigProps = ["uplinks", "packages"];
18
17
  var allowedEnvConfig = [
19
18
  "http_proxy",
@@ -26,10 +25,6 @@ var defaultUserRateLimiting = {
26
25
  windowMs: 900 * 1e3,
27
26
  max: 1e3
28
27
  };
29
- function isNodeVersionGreaterThan21() {
30
- const [major, minor] = process.versions.node.split(".").map(Number);
31
- return major > 21 || major === 21 && minor >= 0;
32
- }
33
28
  var TOKEN_VALID_LENGTH = 32;
34
29
  /**
35
30
  * Coordinates the application configuration
@@ -51,23 +46,21 @@ var Config = class {
51
46
  plugins;
52
47
  security;
53
48
  server;
54
- configOverrideOptions;
55
49
  secret;
56
50
  flags;
57
51
  userRateLimit;
58
- constructor(config, configOverrideOptions = { forceMigrateToSecureLegacySignature: true }) {
52
+ constructor(config) {
59
53
  const self = this;
60
54
  this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;
61
55
  if (!config.configPath) {
62
56
  config.configPath = config.config_path ?? config.self_path;
63
57
  if (!config.configPath) throw new Error("configPath property is required");
64
58
  }
65
- this.configOverrideOptions = configOverrideOptions;
66
59
  this.configPath = config.configPath;
67
60
  this.self_path = this.configPath;
68
61
  debug$1("config path: %s", this.configPath);
69
62
  this.plugins = config.plugins;
70
- this.security = lodash.default.merge(lodash.default.merge(require_security.defaultSecurity, { api: { migrateToSecureLegacySignature: this.configOverrideOptions.forceMigrateToSecureLegacySignature } }), config.security);
63
+ this.security = lodash.default.merge(require_security.defaultSecurity, config.security);
71
64
  this.server = {
72
65
  ...require_serverSettings.default,
73
66
  ...config.server
@@ -100,9 +93,6 @@ var Config = class {
100
93
  });
101
94
  if (!this.server_id) this.server_id = _verdaccio_core.cryptoUtils.generateRandomHexString(6);
102
95
  }
103
- getMigrateToSecureLegacySignature() {
104
- return this.security.api.migrateToSecureLegacySignature;
105
- }
106
96
  getConfigPath() {
107
97
  return this.configPath;
108
98
  }
@@ -116,49 +106,17 @@ var Config = class {
116
106
  return _verdaccio_core.authUtils.getMatchedPackagesSpec(pkgName, this.packages);
117
107
  }
118
108
  /**
119
- * Verify if the secret complies with the required structure
120
- * - If the secret is not provided, it will generate a new one
121
- * - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)
122
- * - If the secret is provided:
123
- * - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup
124
- * - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning
125
- * - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be
126
- * generated with the new signature model
109
+ * Verify if the secret complies with the required structure.
110
+ * The secret must be exactly 32 characters long for aes-256-ctr encryption.
111
+ * If no secret is provided, a new one will be generated.
127
112
  * @secret external secret key
128
113
  */
129
114
  checkSecretKey(secret) {
130
115
  debug$1("checking secret key init");
131
116
  if (typeof secret === "string" && lodash.default.isEmpty(secret) === false) {
132
117
  debug$1("checking secret key length %s", secret.length);
133
- if (secret.length > TOKEN_VALID_LENGTH) if (isNodeVersionGreaterThan21()) {
134
- debug$1("is node version greater than 21");
135
- if (this.getMigrateToSecureLegacySignature() === true) {
136
- this.secret = require_token.generateRandomSecretKey();
137
- debug$1("rewriting secret key with length %s", this.secret.length);
138
- return this.secret;
139
- }
140
- debug$1("secret does not comply with the required length, current length %d, application will fail on startup", secret.length);
141
- throw new Error(`Invalid storage secret key length, must be 32 characters long but is ${secret.length}.
142
- The secret length in Node.js 22 or higher must be 32 characters long. Please consider generate a new one.
143
- Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`);
144
- } else {
145
- debug$1("is node version lower than 22");
146
- if (this.getMigrateToSecureLegacySignature() === true) {
147
- this.secret = require_token.generateRandomSecretKey();
148
- debug$1("rewriting secret key with length %s", this.secret.length);
149
- return this.secret;
150
- }
151
- debug$1("triggering deprecation warning for secret key length %s", secret.length);
152
- _verdaccio_core.warningUtils.emit(Codes.VERWAR007);
153
- this.secret = secret;
154
- return this.secret;
155
- }
156
- else if (secret.length === TOKEN_VALID_LENGTH) {
157
- debug$1("detected valid secret key length %s", secret.length);
158
- this.secret = secret;
159
- return this.secret;
160
- }
161
- debug$1("reusing previous key with length %s", secret.length);
118
+ if (secret.length !== TOKEN_VALID_LENGTH) throw new Error(`Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`);
119
+ debug$1("detected valid secret key length %s", secret.length);
162
120
  this.secret = secret;
163
121
  return this.secret;
164
122
  } else {
@@ -173,6 +131,5 @@ var Config = class {
173
131
  exports.Config = Config;
174
132
  exports.WEB_TITLE = WEB_TITLE;
175
133
  exports.defaultUserRateLimiting = defaultUserRateLimiting;
176
- exports.isNodeVersionGreaterThan21 = isNodeVersionGreaterThan21;
177
134
 
178
135
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils, warningUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst { Codes } = warningUtils;\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nexport function isNodeVersionGreaterThan21() {\n const [major, minor] = process.versions.node.split('.').map(Number);\n return major > 21 || (major === 21 && minor >= 0);\n}\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n /**\n * @deprecated use configPath or config.getConfigPath();\n */\n public self_path: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n private configOverrideOptions: { forceMigrateToSecureLegacySignature: boolean };\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(\n config: ConfigYaml & { config_path: string },\n // forceEnhancedLegacySignature is a property that\n // allows switch a new legacy aes signature token signature\n // for older versions do not want to have this new signature model\n // this property must be false\n configOverrideOptions = { forceMigrateToSecureLegacySignature: true }\n ) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n // backport self_path for previous to version 6\n // @ts-expect-error\n config.configPath = config.config_path ?? config.self_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configOverrideOptions = configOverrideOptions;\n this.configPath = config.configPath;\n this.self_path = this.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = _.merge(\n // override the default security configuration via constructor\n _.merge(defaultSecurity, {\n api: {\n migrateToSecureLegacySignature:\n this.configOverrideOptions.forceMigrateToSecureLegacySignature,\n },\n }),\n config.security\n );\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n searchRemote: config.flags?.searchRemote ?? true,\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getMigrateToSecureLegacySignature() {\n return this.security.api.migrateToSecureLegacySignature;\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure\n * - If the secret is not provided, it will generate a new one\n * - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)\n * - If the secret is provided:\n * - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup\n * - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning\n * - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be\n * generated with the new signature model\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && _.isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length > TOKEN_VALID_LENGTH) {\n if (isNodeVersionGreaterThan21()) {\n debug('is node version greater than 21');\n if (this.getMigrateToSecureLegacySignature() === true) {\n this.secret = generateRandomSecretKey();\n debug('rewriting secret key with length %s', this.secret.length);\n return this.secret;\n }\n // oops, user needs to generate a new secret key\n debug(\n 'secret does not comply with the required length, current length %d, application will fail on startup',\n secret.length\n );\n throw new Error(\n `Invalid storage secret key length, must be 32 characters long but is ${secret.length}. \n The secret length in Node.js 22 or higher must be 32 characters long. Please consider generate a new one. \n Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n } else {\n debug('is node version lower than 22');\n if (this.getMigrateToSecureLegacySignature() === true) {\n this.secret = generateRandomSecretKey();\n debug('rewriting secret key with length %s', this.secret.length);\n return this.secret;\n }\n debug('triggering deprecation warning for secret key length %s', secret.length);\n // still using Node.js versions previous to 22, but we need to emit a deprecation warning\n // deprecation warning, secret key is too long and must be 32\n // this will be removed in the next major release and will produce an error\n warningUtils.emit(Codes.VERWAR007);\n this.secret = secret;\n return this.secret;\n }\n } else if (secret.length === TOKEN_VALID_LENGTH) {\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n }\n debug('reusing previous key with length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n // generate a new a secret key\n // FUTURE: this might be an external secret key, perhaps within config file?\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAM,EAAE,UAAU,gBAAA;AAElB,IAAM,uBAAuB,CAAC,WAAW,WAAW;AACpD,IAAM,mBAAmB;CAAC;CAAc;CAAe;CAAW;AAClE,IAAM,WAAA,GAAA,MAAA,SAAmB,mBAAmB;AAE5C,IAAa,YAAY;AAGzB,IAAa,0BAA0B;CACrC,UAAU,MAAU;CACpB,KAAK;CACN;AAED,SAAgB,6BAA6B;CAC3C,MAAM,CAAC,OAAO,SAAS,QAAQ,SAAS,KAAK,MAAM,IAAI,CAAC,IAAI,OAAO;AACnE,QAAO,QAAQ,MAAO,UAAU,MAAM,SAAS;;AAGjD,IAAM,qBAAqB;;;;AAK3B,IAAM,SAAN,MAAkC;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;CAIA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA,YACE,QAKA,wBAAwB,EAAE,qCAAqC,MAAM,EACrE;EACA,MAAM,OAAO;AACb,OAAK,UAAU,QAAQ,IAAI,0BAA0B,OAAO;AAC5D,MAAI,CAAC,OAAO,YAAY;AAGtB,UAAO,aAAa,OAAO,eAAe,OAAO;AACjD,OAAI,CAAC,OAAO,WACV,OAAM,IAAI,MAAM,kCAAkC;;AAGtD,OAAK,wBAAwB;AAC7B,OAAK,aAAa,OAAO;AACzB,OAAK,YAAY,KAAK;AACtB,UAAM,mBAAmB,KAAK,WAAW;AACzC,OAAK,UAAU,OAAO;AACtB,OAAK,WAAW,OAAA,QAAE,MAEhB,OAAA,QAAE,MAAM,iBAAA,iBAAiB,EACvB,KAAK,EACH,gCACE,KAAK,sBAAsB,qCAC9B,EACF,CAAC,EACF,OAAO,SACR;AACD,OAAK,SAAS;GAAE,GAAG,uBAAA;GAAuB,GAAG,OAAO;GAAQ;AAC5D,OAAK,QAAQ;GACX,cAAc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AK,OAAO;AAC7D,WAAM,iCAAiC,OAAO,OAAO;AACrD,OAAI,OAAO,SAAS,mBAClB,KAAI,4BAA4B,EAAE;AAChC,YAAM,kCAAkC;AACxC,QAAI,KAAK,mCAAmC,KAAK,MAAM;AACrD,UAAK,SAAS,cAAA,yBAAyB;AACvC,aAAM,uCAAuC,KAAK,OAAO,OAAO;AAChE,YAAO,KAAK;;AAGd,YACE,yGACA,OAAO,OACR;AACD,UAAM,IAAI,MACR,wEAAwE,OAAO,OAAO;;mFAGvF;UACI;AACL,YAAM,gCAAgC;AACtC,QAAI,KAAK,mCAAmC,KAAK,MAAM;AACrD,UAAK,SAAS,cAAA,yBAAyB;AACvC,aAAM,uCAAuC,KAAK,OAAO,OAAO;AAChE,YAAO,KAAK;;AAEd,YAAM,2DAA2D,OAAO,OAAO;AAI/E,oBAAA,aAAa,KAAK,MAAM,UAAU;AAClC,SAAK,SAAS;AACd,WAAO,KAAK;;YAEL,OAAO,WAAW,oBAAoB;AAC/C,YAAM,uCAAuC,OAAO,OAAO;AAC3D,SAAK,SAAS;AACd,WAAO,KAAK;;AAEd,WAAM,uCAAuC,OAAO,OAAO;AAC3D,QAAK,SAAS;AACd,UAAO,KAAK;SACP;AAGL,WAAM,8BAA8B;AACpC,QAAK,SAAS,cAAA,yBAAyB;AACvC,WAAM,wCAAwC,KAAK,QAAQ,OAAO;AAElE,UAAO,KAAK"}
1
+ {"version":3,"file":"config.js","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n /**\n * @deprecated use configPath or config.getConfigPath();\n */\n public self_path: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(config: ConfigYaml & { config_path: string }) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n // backport self_path for previous to version 6\n // @ts-expect-error\n config.configPath = config.config_path ?? config.self_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configPath = config.configPath;\n this.self_path = this.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = _.merge(defaultSecurity, config.security);\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n searchRemote: config.flags?.searchRemote ?? true,\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure.\n * The secret must be exactly 32 characters long for aes-256-ctr encryption.\n * If no secret is provided, a new one will be generated.\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && _.isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length !== TOKEN_VALID_LENGTH) {\n throw new Error(\n `Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. ` +\n `Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n }\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n return this.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ug from "debug";
8
8
  import _ from "lodash";
9
9
  import assert from "node:assert";
10
- import { APP_ERROR, authUtils, cryptoUtils, validationUtils, warningUtils } from "@verdaccio/core";
10
+ import { APP_ERROR, authUtils, cryptoUtils, validationUtils } from "@verdaccio/core";
11
11
  //#region src/config.ts
12
- var { Codes } = warningUtils;
13
12
  var strategicConfigProps = ["uplinks", "packages"];
14
13
  var allowedEnvConfig = [
15
14
  "http_proxy",
@@ -22,10 +21,6 @@ var defaultUserRateLimiting = {
22
21
  windowMs: 900 * 1e3,
23
22
  max: 1e3
24
23
  };
25
- function isNodeVersionGreaterThan21() {
26
- const [major, minor] = process.versions.node.split(".").map(Number);
27
- return major > 21 || major === 21 && minor >= 0;
28
- }
29
24
  var TOKEN_VALID_LENGTH = 32;
30
25
  /**
31
26
  * Coordinates the application configuration
@@ -47,23 +42,21 @@ var Config = class {
47
42
  plugins;
48
43
  security;
49
44
  server;
50
- configOverrideOptions;
51
45
  secret;
52
46
  flags;
53
47
  userRateLimit;
54
- constructor(config, configOverrideOptions = { forceMigrateToSecureLegacySignature: true }) {
48
+ constructor(config) {
55
49
  const self = this;
56
50
  this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;
57
51
  if (!config.configPath) {
58
52
  config.configPath = config.config_path ?? config.self_path;
59
53
  if (!config.configPath) throw new Error("configPath property is required");
60
54
  }
61
- this.configOverrideOptions = configOverrideOptions;
62
55
  this.configPath = config.configPath;
63
56
  this.self_path = this.configPath;
64
57
  debug("config path: %s", this.configPath);
65
58
  this.plugins = config.plugins;
66
- this.security = _.merge(_.merge(defaultSecurity, { api: { migrateToSecureLegacySignature: this.configOverrideOptions.forceMigrateToSecureLegacySignature } }), config.security);
59
+ this.security = _.merge(defaultSecurity, config.security);
67
60
  this.server = {
68
61
  ...serverSettings_default,
69
62
  ...config.server
@@ -96,9 +89,6 @@ var Config = class {
96
89
  });
97
90
  if (!this.server_id) this.server_id = cryptoUtils.generateRandomHexString(6);
98
91
  }
99
- getMigrateToSecureLegacySignature() {
100
- return this.security.api.migrateToSecureLegacySignature;
101
- }
102
92
  getConfigPath() {
103
93
  return this.configPath;
104
94
  }
@@ -112,49 +102,17 @@ var Config = class {
112
102
  return authUtils.getMatchedPackagesSpec(pkgName, this.packages);
113
103
  }
114
104
  /**
115
- * Verify if the secret complies with the required structure
116
- * - If the secret is not provided, it will generate a new one
117
- * - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)
118
- * - If the secret is provided:
119
- * - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup
120
- * - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning
121
- * - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be
122
- * generated with the new signature model
105
+ * Verify if the secret complies with the required structure.
106
+ * The secret must be exactly 32 characters long for aes-256-ctr encryption.
107
+ * If no secret is provided, a new one will be generated.
123
108
  * @secret external secret key
124
109
  */
125
110
  checkSecretKey(secret) {
126
111
  debug("checking secret key init");
127
112
  if (typeof secret === "string" && _.isEmpty(secret) === false) {
128
113
  debug("checking secret key length %s", secret.length);
129
- if (secret.length > TOKEN_VALID_LENGTH) if (isNodeVersionGreaterThan21()) {
130
- debug("is node version greater than 21");
131
- if (this.getMigrateToSecureLegacySignature() === true) {
132
- this.secret = generateRandomSecretKey();
133
- debug("rewriting secret key with length %s", this.secret.length);
134
- return this.secret;
135
- }
136
- debug("secret does not comply with the required length, current length %d, application will fail on startup", secret.length);
137
- throw new Error(`Invalid storage secret key length, must be 32 characters long but is ${secret.length}.
138
- The secret length in Node.js 22 or higher must be 32 characters long. Please consider generate a new one.
139
- Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`);
140
- } else {
141
- debug("is node version lower than 22");
142
- if (this.getMigrateToSecureLegacySignature() === true) {
143
- this.secret = generateRandomSecretKey();
144
- debug("rewriting secret key with length %s", this.secret.length);
145
- return this.secret;
146
- }
147
- debug("triggering deprecation warning for secret key length %s", secret.length);
148
- warningUtils.emit(Codes.VERWAR007);
149
- this.secret = secret;
150
- return this.secret;
151
- }
152
- else if (secret.length === TOKEN_VALID_LENGTH) {
153
- debug("detected valid secret key length %s", secret.length);
154
- this.secret = secret;
155
- return this.secret;
156
- }
157
- debug("reusing previous key with length %s", secret.length);
114
+ if (secret.length !== TOKEN_VALID_LENGTH) throw new Error(`Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`);
115
+ debug("detected valid secret key length %s", secret.length);
158
116
  this.secret = secret;
159
117
  return this.secret;
160
118
  } else {
@@ -166,6 +124,6 @@ var Config = class {
166
124
  }
167
125
  };
168
126
  //#endregion
169
- export { Config, WEB_TITLE, defaultUserRateLimiting, isNodeVersionGreaterThan21 };
127
+ export { Config, WEB_TITLE, defaultUserRateLimiting };
170
128
 
171
129
  //# sourceMappingURL=config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils, warningUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst { Codes } = warningUtils;\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nexport function isNodeVersionGreaterThan21() {\n const [major, minor] = process.versions.node.split('.').map(Number);\n return major > 21 || (major === 21 && minor >= 0);\n}\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n /**\n * @deprecated use configPath or config.getConfigPath();\n */\n public self_path: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n private configOverrideOptions: { forceMigrateToSecureLegacySignature: boolean };\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(\n config: ConfigYaml & { config_path: string },\n // forceEnhancedLegacySignature is a property that\n // allows switch a new legacy aes signature token signature\n // for older versions do not want to have this new signature model\n // this property must be false\n configOverrideOptions = { forceMigrateToSecureLegacySignature: true }\n ) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n // backport self_path for previous to version 6\n // @ts-expect-error\n config.configPath = config.config_path ?? config.self_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configOverrideOptions = configOverrideOptions;\n this.configPath = config.configPath;\n this.self_path = this.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = _.merge(\n // override the default security configuration via constructor\n _.merge(defaultSecurity, {\n api: {\n migrateToSecureLegacySignature:\n this.configOverrideOptions.forceMigrateToSecureLegacySignature,\n },\n }),\n config.security\n );\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n searchRemote: config.flags?.searchRemote ?? true,\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getMigrateToSecureLegacySignature() {\n return this.security.api.migrateToSecureLegacySignature;\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure\n * - If the secret is not provided, it will generate a new one\n * - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)\n * - If the secret is provided:\n * - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup\n * - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning\n * - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be\n * generated with the new signature model\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && _.isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length > TOKEN_VALID_LENGTH) {\n if (isNodeVersionGreaterThan21()) {\n debug('is node version greater than 21');\n if (this.getMigrateToSecureLegacySignature() === true) {\n this.secret = generateRandomSecretKey();\n debug('rewriting secret key with length %s', this.secret.length);\n return this.secret;\n }\n // oops, user needs to generate a new secret key\n debug(\n 'secret does not comply with the required length, current length %d, application will fail on startup',\n secret.length\n );\n throw new Error(\n `Invalid storage secret key length, must be 32 characters long but is ${secret.length}. \n The secret length in Node.js 22 or higher must be 32 characters long. Please consider generate a new one. \n Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n } else {\n debug('is node version lower than 22');\n if (this.getMigrateToSecureLegacySignature() === true) {\n this.secret = generateRandomSecretKey();\n debug('rewriting secret key with length %s', this.secret.length);\n return this.secret;\n }\n debug('triggering deprecation warning for secret key length %s', secret.length);\n // still using Node.js versions previous to 22, but we need to emit a deprecation warning\n // deprecation warning, secret key is too long and must be 32\n // this will be removed in the next major release and will produce an error\n warningUtils.emit(Codes.VERWAR007);\n this.secret = secret;\n return this.secret;\n }\n } else if (secret.length === TOKEN_VALID_LENGTH) {\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n }\n debug('reusing previous key with length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n // generate a new a secret key\n // FUTURE: this might be an external secret key, perhaps within config file?\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;AAwBA,IAAM,EAAE,UAAU;AAElB,IAAM,uBAAuB,CAAC,WAAW,WAAW;AACpD,IAAM,mBAAmB;CAAC;CAAc;CAAe;CAAW;AAClE,IAAM,QAAQ,WAAW,mBAAmB;AAE5C,IAAa,YAAY;AAGzB,IAAa,0BAA0B;CACrC,UAAU,MAAU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AAK;;AAEd,UAAM,2DAA2D,OAAO,OAAO;AAI/E,iBAAa,KAAK,MAAM,UAAU;AAClC,SAAK,SAAS;AACd,WAAO,KAAK;;YAEL,OAAO,WAAW,oBAAoB;AAC/C,UAAM,uCAAuC,OAAO,OAAO;AAC3D,SAAK,SAAS;AACd,WAAO,KAAK;;AAEd,SAAM,uCAAuC,OAAO,OAAO;AAC3D,QAAK,SAAS;AACd,UAAO,KAAK;SACP;AAGL,SAAM,8BAA8B;AACpC,QAAK,SAAS,yBAAyB;AACvC,SAAM,wCAAwC,KAAK,QAAQ,OAAO;AAElE,UAAO,KAAK"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n /**\n * @deprecated use configPath or config.getConfigPath();\n */\n public self_path: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(config: ConfigYaml & { config_path: string }) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n // backport self_path for previous to version 6\n // @ts-expect-error\n config.configPath = config.config_path ?? config.self_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configPath = config.configPath;\n this.self_path = this.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = _.merge(defaultSecurity, config.security);\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n searchRemote: config.flags?.searchRemote ?? true,\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure.\n * The secret must be exactly 32 characters long for aes-256-ctr encryption.\n * If no secret is provided, a new one will be generated.\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && _.isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length !== TOKEN_VALID_LENGTH) {\n throw new Error(\n `Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. ` +\n `Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n }\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;AAwBA,IAAM,uBAAuB,CAAC,WAAW,WAAW;AACpD,IAAM,mBAAmB;CAAC;CAAc;CAAe;CAAW;AAClE,IAAM,QAAQ,WAAW,mBAAmB;AAE5C,IAAa,YAAY;AAGzB,IAAa,0BAA0B;CACrC,UAAU,MAAU;CACpB,KAAK;CACN;AAED,IAAM,qBAAqB;;;;AAK3B,IAAM,SAAN,MAAkC;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;CAIA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA,YAAmB,QAA8C;EAC/D,MAAM,OAAO;AACb,OAAK,UAAU,QAAQ,IAAI,0BAA0B,OAAO;AAC5D,MAAI,CAAC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,SAAO,KAAK;;;;;;;;CASd,uBAA8B,SAAuC;AAEnE,SAAO,UAAU,uBAAuB,SAAS,KAAK,SAAS;;;;;;;;CASjE,eAAsB,QAAyB;AAC7C,QAAM,2BAA2B;AACjC,MAAI,OAAO,WAAW,YAAY,EAAE,QAAQ,OAAO,KAAK,OAAO;AAC7D,SAAM,iCAAiC,OAAO,OAAO;AACrD,OAAI,OAAO,WAAW,mBACpB,OAAM,IAAI,MACR,8CAA8C,mBAAmB,0BAA0B,OAAO,OAAO,oGAE1G;AAEH,SAAM,uCAAuC,OAAO,OAAO;AAC3D,QAAK,SAAS;AACd,UAAO,KAAK;SACP;AACL,SAAM,8BAA8B;AACpC,QAAK,SAAS,yBAAyB;AACvC,SAAM,wCAAwC,KAAK,QAAQ,OAAO;AAClE,UAAO,KAAK"}
package/build/index.js CHANGED
@@ -41,7 +41,6 @@ exports.getListenAddress = require_address.getListenAddress;
41
41
  exports.getProxiesForPackage = require_uplinks.getProxiesForPackage;
42
42
  exports.getUserAgent = require_agent.getUserAgent;
43
43
  exports.hasProxyTo = require_uplinks.hasProxyTo;
44
- exports.isNodeVersionGreaterThan21 = require_config.isNodeVersionGreaterThan21;
45
44
  exports.normalisePackageAccess = require_package_access.normalisePackageAccess;
46
45
  exports.normalizeUserList = require_package_access.normalizeUserList;
47
46
  exports.parseAddress = require_address.parseAddress;
package/build/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { PACKAGE_ACCESS, ROLES, normalisePackageAccess, normalizeUserList } from
3
3
  import { TIME_EXPIRATION_1H, defaultSecurity } from "./security.mjs";
4
4
  import { TOKEN_VALID_LENGTH, generateRandomSecretKey } from "./token.mjs";
5
5
  import { DEFAULT_REGISTRY, DEFAULT_UPLINK, getProxiesForPackage, hasProxyTo, sanityCheckNames, sanityCheckUplinksProps, uplinkSanityCheck } from "./uplinks.mjs";
6
- import { Config, WEB_TITLE, defaultUserRateLimiting, isNodeVersionGreaterThan21 } from "./config.mjs";
6
+ import { Config, WEB_TITLE, defaultUserRateLimiting } from "./config.mjs";
7
7
  import { fileExists, folderExists } from "./config-utils.mjs";
8
8
  import { findConfigFile, readDefaultConfig } from "./config-path.mjs";
9
9
  import { fromJStoYAML, getConfigParsed, parseConfigFile } from "./parse.mjs";
@@ -11,4 +11,4 @@ import { createAnonymousRemoteUser, createRemoteUser, defaultLoggedUserRoles, de
11
11
  import ConfigBuilder from "./builder.mjs";
12
12
  import { getDefaultConfig } from "./conf/index.mjs";
13
13
  import { getListenAddress, parseAddress } from "./address.mjs";
14
- export { Config, ConfigBuilder, DEFAULT_REGISTRY, DEFAULT_UPLINK, PACKAGE_ACCESS, ROLES, TIME_EXPIRATION_1H, TOKEN_VALID_LENGTH, WEB_TITLE, createAnonymousRemoteUser, createRemoteUser, defaultLoggedUserRoles, defaultNonLoggedUserRoles, defaultSecurity, defaultUserRateLimiting, fileExists, findConfigFile, folderExists, fromJStoYAML, generateRandomSecretKey, getConfigParsed, getDefaultConfig, getListenAddress, getProxiesForPackage, getUserAgent, hasProxyTo, isNodeVersionGreaterThan21, normalisePackageAccess, normalizeUserList, parseAddress, parseConfigFile, readDefaultConfig, sanityCheckNames, sanityCheckUplinksProps, uplinkSanityCheck };
14
+ export { Config, ConfigBuilder, DEFAULT_REGISTRY, DEFAULT_UPLINK, PACKAGE_ACCESS, ROLES, TIME_EXPIRATION_1H, TOKEN_VALID_LENGTH, WEB_TITLE, createAnonymousRemoteUser, createRemoteUser, defaultLoggedUserRoles, defaultNonLoggedUserRoles, defaultSecurity, defaultUserRateLimiting, fileExists, findConfigFile, folderExists, fromJStoYAML, generateRandomSecretKey, getConfigParsed, getDefaultConfig, getListenAddress, getProxiesForPackage, getUserAgent, hasProxyTo, normalisePackageAccess, normalizeUserList, parseAddress, parseConfigFile, readDefaultConfig, sanityCheckNames, sanityCheckUplinksProps, uplinkSanityCheck };
package/build/security.js CHANGED
@@ -5,10 +5,7 @@ var defaultSecurity = {
5
5
  sign: { expiresIn: "1h" },
6
6
  verify: {}
7
7
  },
8
- api: {
9
- legacy: true,
10
- migrateToSecureLegacySignature: true
11
- }
8
+ api: { legacy: true }
12
9
  };
13
10
  //#endregion
14
11
  exports.TIME_EXPIRATION_1H = TIME_EXPIRATION_1H;
@@ -1 +1 @@
1
- {"version":3,"file":"security.js","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n migrateToSecureLegacySignature: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAelC,IAAa,kBAA4B;CACvC,KAdyC;EACzC,MAAM,EAEJ,WAAA,MACD;EACD,QAAQ,EAAE;EACX;CASC,KAP2C;EAC3C,QAAQ;EACR,gCAAgC;EACjC;CAKA"}
1
+ {"version":3,"file":"security.js","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAclC,IAAa,kBAA4B;CACvC,KAbyC;EACzC,MAAM,EAEJ,WAAA,MACD;EACD,QAAQ,EAAE;EACX;CAQC,KAN2C,EAC3C,QAAQ,MACT;CAKA"}
@@ -5,10 +5,7 @@ var defaultSecurity = {
5
5
  sign: { expiresIn: "1h" },
6
6
  verify: {}
7
7
  },
8
- api: {
9
- legacy: true,
10
- migrateToSecureLegacySignature: true
11
- }
8
+ api: { legacy: true }
12
9
  };
13
10
  //#endregion
14
11
  export { TIME_EXPIRATION_1H, defaultSecurity };
@@ -1 +1 @@
1
- {"version":3,"file":"security.mjs","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n migrateToSecureLegacySignature: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAelC,IAAa,kBAA4B;CACvC,KAdyC;EACzC,MAAM,EAEJ,WAAA,MACD;EACD,QAAQ,EAAE;EACX;CASC,KAP2C;EAC3C,QAAQ;EACR,gCAAgC;EACjC;CAKA"}
1
+ {"version":3,"file":"security.mjs","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAclC,IAAa,kBAA4B;CACvC,KAbyC;EACzC,MAAM,EAEJ,WAAA,MACD;EACD,QAAQ,EAAE;EACX;CAQC,KAN2C,EAC3C,QAAQ,MACT;CAKA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/config",
3
- "version": "9.0.0-next-9.5",
3
+ "version": "9.0.0-next-9.7",
4
4
  "description": "Verdaccio Configuration",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -33,13 +33,13 @@
33
33
  "node": ">=24"
34
34
  },
35
35
  "dependencies": {
36
- "@verdaccio/core": "9.0.0-next-9.5",
36
+ "@verdaccio/core": "9.0.0-next-9.7",
37
37
  "debug": "4.4.3",
38
38
  "js-yaml": "4.1.1",
39
39
  "lodash": "4.17.23"
40
40
  },
41
41
  "devDependencies": {
42
- "@verdaccio/types": "14.0.0-next-9.2",
42
+ "@verdaccio/types": "14.0.0-next-9.4",
43
43
  "vitest": "4.1.0"
44
44
  },
45
45
  "funding": {