@verdaccio/config 7.0.0-next.6 → 8.0.0-next-8.1
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 +174 -0
- package/README.md +69 -0
- package/build/agent.js +1 -1
- package/build/agent.js.map +1 -1
- package/build/builder.js +2 -3
- package/build/builder.js.map +1 -1
- package/build/conf/default.yaml +10 -1
- package/build/conf/docker.yaml +10 -1
- package/build/conf/index.js.map +1 -1
- package/build/config-path.d.ts +2 -3
- package/build/config-path.js +51 -22
- package/build/config-path.js.map +1 -1
- package/build/config-utils.js +14 -3
- package/build/config-utils.js.map +1 -1
- package/build/config.d.ts +13 -5
- package/build/config.js +71 -35
- package/build/config.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/package-access.js +4 -1
- package/build/package-access.js.map +1 -1
- package/build/parse.js +1 -1
- package/build/parse.js.map +1 -1
- package/build/security.js +2 -1
- package/build/security.js.map +1 -1
- package/build/serverSettings.js.map +1 -1
- package/build/token.d.ts +1 -0
- package/build/token.js +2 -0
- package/build/token.js.map +1 -1
- package/build/uplinks.js +1 -1
- package/build/uplinks.js.map +1 -1
- package/build/user.js.map +1 -1
- package/package.json +8 -10
- package/src/builder.ts +1 -2
- package/src/conf/default.yaml +10 -1
- package/src/conf/docker.yaml +10 -1
- package/src/config-path.ts +57 -25
- package/src/config-utils.ts +13 -2
- package/src/config.ts +79 -35
- package/src/package-access.ts +4 -0
- package/src/security.ts +1 -0
- package/src/token.ts +2 -0
- package/test/__snapshots__/builder.spec.ts.snap +2 -2
- package/test/__snapshots__/config-parsing.spec.ts.snap +2 -2
- package/test/agent.spec.ts +2 -0
- package/test/builder.spec.ts +55 -0
- package/test/config-parsing.spec.ts +1 -0
- package/test/config-utils.spec.ts +1 -0
- package/test/config.path.spec.ts +102 -74
- package/test/config.spec.ts +71 -12
- package/test/package-access.spec.ts +1 -0
- package/test/token.spec.ts +2 -0
- package/test/uplinks.spec.ts +2 -0
- package/test/utils.spec.ts +2 -0
- package/jest.config.js +0 -9
package/build/config-utils.js
CHANGED
|
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.fileExists = fileExists;
|
|
7
7
|
exports.folderExists = folderExists;
|
|
8
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
8
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const debug = (0, _debug.default)('verdaccio:config:config-utils');
|
|
12
|
+
|
|
10
13
|
/**
|
|
11
14
|
* Check whether the path already exist.
|
|
12
15
|
* @param {String} path
|
|
@@ -14,9 +17,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
17
|
*/
|
|
15
18
|
function folderExists(path) {
|
|
16
19
|
try {
|
|
20
|
+
debug('check folder exist', path);
|
|
17
21
|
const stat = _fs.default.statSync(path);
|
|
18
|
-
|
|
22
|
+
const isDirectory = stat.isDirectory();
|
|
23
|
+
debug('folder exist', isDirectory);
|
|
24
|
+
return isDirectory;
|
|
19
25
|
} catch (_) {
|
|
26
|
+
debug('folder %s does not exist', path);
|
|
20
27
|
return false;
|
|
21
28
|
}
|
|
22
29
|
}
|
|
@@ -28,9 +35,13 @@ function folderExists(path) {
|
|
|
28
35
|
*/
|
|
29
36
|
function fileExists(path) {
|
|
30
37
|
try {
|
|
38
|
+
debug('check file exist', path);
|
|
31
39
|
const stat = _fs.default.statSync(path);
|
|
32
|
-
|
|
40
|
+
const isFile = stat.isFile();
|
|
41
|
+
debug('file exist', isFile);
|
|
42
|
+
return isFile;
|
|
33
43
|
} catch (_) {
|
|
44
|
+
debug('file %s does not exist', path);
|
|
34
45
|
return false;
|
|
35
46
|
}
|
|
36
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-utils.js","names":["
|
|
1
|
+
{"version":3,"file":"config-utils.js","names":["_debug","_interopRequireDefault","require","_fs","e","__esModule","default","debug","buildDebug","folderExists","path","stat","fs","statSync","isDirectory","_","fileExists","isFile"],"sources":["../src/config-utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\n\nconst debug = buildDebug('verdaccio:config:config-utils');\n\n/**\n * Check whether the path already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function folderExists(path: string): boolean {\n try {\n debug('check folder exist', path);\n const stat = fs.statSync(path);\n const isDirectory = stat.isDirectory();\n debug('folder exist', isDirectory);\n return isDirectory;\n } catch (_: any) {\n debug('folder %s does not exist', path);\n return false;\n }\n}\n\n/**\n * Check whether the file already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function fileExists(path: string): boolean {\n try {\n debug('check file exist', path);\n const stat = fs.statSync(path);\n const isFile = stat.isFile();\n debug('file exist', isFile);\n return isFile;\n } catch (_: any) {\n debug('file %s does not exist', path);\n return false;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpB,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;;AAEzD;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,IAAY,EAAW;EAClD,IAAI;IACFH,KAAK,CAAC,oBAAoB,EAAEG,IAAI,CAAC;IACjC,MAAMC,IAAI,GAAGC,WAAE,CAACC,QAAQ,CAACH,IAAI,CAAC;IAC9B,MAAMI,WAAW,GAAGH,IAAI,CAACG,WAAW,CAAC,CAAC;IACtCP,KAAK,CAAC,cAAc,EAAEO,WAAW,CAAC;IAClC,OAAOA,WAAW;EACpB,CAAC,CAAC,OAAOC,CAAM,EAAE;IACfR,KAAK,CAAC,0BAA0B,EAAEG,IAAI,CAAC;IACvC,OAAO,KAAK;EACd;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASM,UAAUA,CAACN,IAAY,EAAW;EAChD,IAAI;IACFH,KAAK,CAAC,kBAAkB,EAAEG,IAAI,CAAC;IAC/B,MAAMC,IAAI,GAAGC,WAAE,CAACC,QAAQ,CAACH,IAAI,CAAC;IAC9B,MAAMO,MAAM,GAAGN,IAAI,CAACM,MAAM,CAAC,CAAC;IAC5BV,KAAK,CAAC,YAAY,EAAEU,MAAM,CAAC;IAC3B,OAAOA,MAAM;EACf,CAAC,CAAC,OAAOF,CAAM,EAAE;IACfR,KAAK,CAAC,wBAAwB,EAAEG,IAAI,CAAC;IACrC,OAAO,KAAK;EACd;AACF","ignoreList":[]}
|
package/build/config.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const defaultUserRateLimiting: {
|
|
|
4
4
|
windowMs: number;
|
|
5
5
|
max: number;
|
|
6
6
|
};
|
|
7
|
+
export declare function isNodeVersionGreaterThan21(): boolean;
|
|
7
8
|
/**
|
|
8
9
|
* Coordinates the application configuration
|
|
9
10
|
*/
|
|
@@ -23,23 +24,30 @@ declare class Config implements AppConfig {
|
|
|
23
24
|
plugins: string | void | null;
|
|
24
25
|
security: Security;
|
|
25
26
|
serverSettings: ServerSettingsConf;
|
|
27
|
+
private configOverrideOptions;
|
|
26
28
|
secret: string;
|
|
27
29
|
flags: FlagsConfig;
|
|
28
30
|
userRateLimit: RateLimit;
|
|
29
|
-
private configOptions;
|
|
30
31
|
constructor(config: ConfigYaml & {
|
|
31
32
|
config_path: string;
|
|
32
|
-
},
|
|
33
|
-
|
|
33
|
+
}, configOverrideOptions?: {
|
|
34
|
+
forceMigrateToSecureLegacySignature: boolean;
|
|
34
35
|
});
|
|
35
|
-
|
|
36
|
+
getMigrateToSecureLegacySignature(): boolean;
|
|
36
37
|
getConfigPath(): string;
|
|
37
38
|
/**
|
|
38
39
|
* Check for package spec
|
|
39
40
|
*/
|
|
40
41
|
getMatchedPackagesSpec(pkgName: string): PackageAccess | void;
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
+
* Verify if the secret complies with the required structure
|
|
44
|
+
* - If the secret is not provided, it will generate a new one
|
|
45
|
+
* - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)
|
|
46
|
+
* - If the secret is provided:
|
|
47
|
+
* - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup
|
|
48
|
+
* - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning
|
|
49
|
+
* - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be
|
|
50
|
+
* generated with the new signature model
|
|
43
51
|
* @secret external secret key
|
|
44
52
|
*/
|
|
45
53
|
checkSecretKey(secret?: string): string;
|
package/build/config.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.defaultUserRateLimiting = exports.WEB_TITLE = exports.Config = void 0;
|
|
7
|
+
exports.isNodeVersionGreaterThan21 = isNodeVersionGreaterThan21;
|
|
7
8
|
var _assert = _interopRequireDefault(require("assert"));
|
|
8
9
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
@@ -16,7 +17,7 @@ var _security = require("./security");
|
|
|
16
17
|
var _serverSettings = _interopRequireDefault(require("./serverSettings"));
|
|
17
18
|
var _token = require("./token");
|
|
18
19
|
var _uplinks = require("./uplinks");
|
|
19
|
-
function _interopRequireDefault(
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
21
|
const strategicConfigProps = ['uplinks', 'packages'];
|
|
21
22
|
const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];
|
|
22
23
|
const debug = (0, _debug.default)('verdaccio:config');
|
|
@@ -28,6 +29,11 @@ const defaultUserRateLimiting = exports.defaultUserRateLimiting = {
|
|
|
28
29
|
// 15 minutes
|
|
29
30
|
max: 1000
|
|
30
31
|
};
|
|
32
|
+
function isNodeVersionGreaterThan21() {
|
|
33
|
+
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
34
|
+
return major > 21 || major === 21 && minor >= 0;
|
|
35
|
+
}
|
|
36
|
+
const TOKEN_VALID_LENGTH = 32;
|
|
31
37
|
|
|
32
38
|
/**
|
|
33
39
|
* Coordinates the application configuration
|
|
@@ -44,12 +50,11 @@ class Config {
|
|
|
44
50
|
// allows switch a new legacy aes signature token signature
|
|
45
51
|
// for older versions do not want to have this new signature model
|
|
46
52
|
// this property must be false
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
configOverrideOptions = {
|
|
54
|
+
forceMigrateToSecureLegacySignature: true
|
|
49
55
|
}) {
|
|
50
56
|
var _config$flags$searchR, _config$flags, _config$flags$changeP, _config$flags2;
|
|
51
57
|
const self = this;
|
|
52
|
-
this.configOptions = configOptions;
|
|
53
58
|
this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;
|
|
54
59
|
if (!config.configPath) {
|
|
55
60
|
var _config$config_path;
|
|
@@ -60,11 +65,18 @@ class Config {
|
|
|
60
65
|
throw new Error('configPath property is required');
|
|
61
66
|
}
|
|
62
67
|
}
|
|
68
|
+
this.configOverrideOptions = configOverrideOptions;
|
|
63
69
|
this.configPath = config.configPath;
|
|
64
70
|
this.self_path = this.configPath;
|
|
65
71
|
debug('config path: %s', this.configPath);
|
|
66
72
|
this.plugins = config.plugins;
|
|
67
|
-
this.security = _lodash.default.merge(
|
|
73
|
+
this.security = _lodash.default.merge(
|
|
74
|
+
// override the default security configuration via constructor
|
|
75
|
+
_lodash.default.merge(_security.defaultSecurity, {
|
|
76
|
+
api: {
|
|
77
|
+
migrateToSecureLegacySignature: this.configOverrideOptions.forceMigrateToSecureLegacySignature
|
|
78
|
+
}
|
|
79
|
+
}), config.security);
|
|
68
80
|
this.serverSettings = _serverSettings.default;
|
|
69
81
|
this.flags = {
|
|
70
82
|
searchRemote: (_config$flags$searchR = (_config$flags = config.flags) === null || _config$flags === void 0 ? void 0 : _config$flags.searchRemote) !== null && _config$flags$searchR !== void 0 ? _config$flags$searchR : true,
|
|
@@ -112,14 +124,8 @@ class Config {
|
|
|
112
124
|
this.server_id = (0, _utils.generateRandomHexString)(6);
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (this.security.enhancedLegacySignature === true) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
return this.configOptions.forceEnhancedLegacySignature;
|
|
127
|
+
getMigrateToSecureLegacySignature() {
|
|
128
|
+
return this.security.api.migrateToSecureLegacySignature;
|
|
123
129
|
}
|
|
124
130
|
getConfigPath() {
|
|
125
131
|
return this.configPath;
|
|
@@ -134,35 +140,65 @@ class Config {
|
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
/**
|
|
137
|
-
*
|
|
143
|
+
* Verify if the secret complies with the required structure
|
|
144
|
+
* - If the secret is not provided, it will generate a new one
|
|
145
|
+
* - For any Node.js version the new secret will be 32 characters long (to allow compatibility with modern Node.js versions)
|
|
146
|
+
* - If the secret is provided:
|
|
147
|
+
* - If Node.js 22 or higher, the secret must be 32 characters long thus the application will fail on startup
|
|
148
|
+
* - If Node.js 21 or lower, the secret will be used as is but will display a deprecation warning
|
|
149
|
+
* - If the property `security.api.migrateToSecureLegacySignature` is provided and set to true, the secret will be
|
|
150
|
+
* generated with the new signature model
|
|
138
151
|
* @secret external secret key
|
|
139
152
|
*/
|
|
140
153
|
checkSecretKey(secret) {
|
|
141
|
-
|
|
142
|
-
debug('check secret key');
|
|
154
|
+
debug('checking secret key init');
|
|
143
155
|
if (typeof secret === 'string' && _lodash.default.isEmpty(secret) === false) {
|
|
156
|
+
debug('checking secret key length %s', secret.length);
|
|
157
|
+
if (secret.length > TOKEN_VALID_LENGTH) {
|
|
158
|
+
if (isNodeVersionGreaterThan21()) {
|
|
159
|
+
debug('is node version greater than 21');
|
|
160
|
+
if (this.getMigrateToSecureLegacySignature() === true) {
|
|
161
|
+
this.secret = (0, _token.generateRandomSecretKey)();
|
|
162
|
+
debug('rewriting secret key with length %s', this.secret.length);
|
|
163
|
+
return this.secret;
|
|
164
|
+
}
|
|
165
|
+
// oops, user needs to generate a new secret key
|
|
166
|
+
debug('secret does not comply with the required length, current length %d, application will fail on startup', secret.length);
|
|
167
|
+
throw new Error(`Invalid storage secret key length, must be 32 characters long but is ${secret.length}.
|
|
168
|
+
The secret length in Node.js 22 or higher must be 32 characters long. Please consider generate a new one.
|
|
169
|
+
Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`);
|
|
170
|
+
} else {
|
|
171
|
+
debug('is node version lower than 22');
|
|
172
|
+
if (this.getMigrateToSecureLegacySignature() === true) {
|
|
173
|
+
this.secret = (0, _token.generateRandomSecretKey)();
|
|
174
|
+
debug('rewriting secret key with length %s', this.secret.length);
|
|
175
|
+
return this.secret;
|
|
176
|
+
}
|
|
177
|
+
debug('triggering deprecation warning for secret key length %s', secret.length);
|
|
178
|
+
// still using Node.js versions previous to 22, but we need to emit a deprecation warning
|
|
179
|
+
// deprecation warning, secret key is too long and must be 32
|
|
180
|
+
// this will be removed in the next major release and will produce an error
|
|
181
|
+
_core.warningUtils.emit(_warningUtils.Codes.VERWAR007);
|
|
182
|
+
this.secret = secret;
|
|
183
|
+
return this.secret;
|
|
184
|
+
}
|
|
185
|
+
} else if (secret.length === TOKEN_VALID_LENGTH) {
|
|
186
|
+
debug('detected valid secret key length %s', secret.length);
|
|
187
|
+
this.secret = secret;
|
|
188
|
+
return this.secret;
|
|
189
|
+
}
|
|
190
|
+
debug('reusing previous key with length %s', secret.length);
|
|
144
191
|
this.secret = secret;
|
|
145
|
-
|
|
146
|
-
return secret;
|
|
147
|
-
}
|
|
148
|
-
// generate a new a secret key
|
|
149
|
-
// FUTURE: this might be an external secret key, perhaps within config file?
|
|
150
|
-
debug('generating a new secret key');
|
|
151
|
-
if (this.getEnhancedLegacySignature()) {
|
|
152
|
-
debug('key generated with "enhanced" legacy signature user config');
|
|
153
|
-
this.secret = (0, _token.generateRandomSecretKey)();
|
|
192
|
+
return this.secret;
|
|
154
193
|
} else {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
_core.warningUtils.emit(_warningUtils.Codes.VERWAR005);
|
|
194
|
+
var _this$secret;
|
|
195
|
+
// generate a new a secret key
|
|
196
|
+
// FUTURE: this might be an external secret key, perhaps within config file?
|
|
197
|
+
debug('generating a new secret key');
|
|
198
|
+
this.secret = (0, _token.generateRandomSecretKey)();
|
|
199
|
+
debug('generated a new secret key length %s', (_this$secret = this.secret) === null || _this$secret === void 0 ? void 0 : _this$secret.length);
|
|
200
|
+
return this.secret;
|
|
163
201
|
}
|
|
164
|
-
debug('generated a new secret key length %s', (_this$secret = this.secret) === null || _this$secret === void 0 ? void 0 : _this$secret.length);
|
|
165
|
-
return this.secret;
|
|
166
202
|
}
|
|
167
203
|
}
|
|
168
204
|
exports.Config = Config;
|
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["_assert","_interopRequireDefault","require","_debug","_lodash","_core","_warningUtils","_utils","_agent","_packageAccess","_security","_serverSettings","_token","_uplinks","obj","__esModule","default","strategicConfigProps","allowedEnvConfig","debug","buildDebug","WEB_TITLE","exports","defaultUserRateLimiting","windowMs","max","Config","constructor","config","configOptions","forceEnhancedLegacySignature","_config$flags$searchR","_config$flags","_config$flags$changeP","_config$flags2","self","storage","process","env","VERDACCIO_STORAGE_PATH","configPath","_config$config_path","config_path","self_path","Error","plugins","security","_","merge","defaultSecurity","serverSettings","flags","searchRemote","changePassword","user_agent","configProp","getUserAgent","userRateLimit","assert","isObject","APP_ERROR","CONFIG_NOT_VALID","forEach","x","uplinks","sanityCheckUplinksProps","uplinkSanityCheck","packages","normalisePackageAccess","envConf","toUpperCase","server_id","generateRandomHexString","getEnhancedLegacySignature","enhancedLegacySignature","getConfigPath","getMatchedPackagesSpec","pkgName","checkSecretKey","secret","_this$security","_this$secret","isEmpty","generateRandomSecretKey","warningUtils","emit","Codes","VERWAR005","length"],"sources":["../src/config.ts"],"sourcesContent":["import assert from 'assert';\nimport buildDebug from 'debug';\nimport _ from 'lodash';\n\nimport { APP_ERROR, warningUtils } from '@verdaccio/core';\nimport { Codes } from '@verdaccio/core/build/warning-utils';\nimport {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\nimport { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport serverSettings 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\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 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 serverSettings: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n private configOptions: { forceEnhancedLegacySignature: boolean };\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 configOptions = { forceEnhancedLegacySignature: true }\n ) {\n const self = this;\n this.configOptions = configOptions;\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.serverSettings = serverSettings;\n this.flags = {\n searchRemote: config.flags?.searchRemote ?? true,\n changePassword: config.flags?.changePassword ?? 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(_.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(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 = generateRandomHexString(6);\n }\n }\n\n public getEnhancedLegacySignature() {\n if (typeof this?.security.enhancedLegacySignature !== 'undefined') {\n if (this.security.enhancedLegacySignature === true) {\n return true;\n }\n return false;\n }\n return this.configOptions.forceEnhancedLegacySignature;\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Store or create whether receive a secret key\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('check secret key');\n if (typeof secret === 'string' && _.isEmpty(secret) === false) {\n this.secret = secret;\n debug('reusing previous key');\n return secret;\n }\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\n if (this.getEnhancedLegacySignature()) {\n debug('key generated with \"enhanced\" legacy signature user config');\n this.secret = generateRandomSecretKey();\n } else {\n debug('key generated with legacy signature user config');\n this.secret = generateRandomHexString(32);\n }\n // set this to false allow use old token signature and is not recommended\n // only use for migration reasons, major release will remove this property and\n // set it by default\n if (this.security?.enhancedLegacySignature === false) {\n warningUtils.emit(Codes.VERWAR005);\n }\n\n debug('generated a new secret key length %s', this.secret?.length);\n return this.secret;\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAYA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAA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;EACpB;AACF;AAACzD,OAAA,CAAAI,MAAA,GAAAA,MAAA"}
|
|
1
|
+
{"version":3,"file":"config.js","names":["_assert","_interopRequireDefault","require","_debug","_lodash","_core","_warningUtils","_utils","_agent","_packageAccess","_security","_serverSettings","_token","_uplinks","e","__esModule","default","strategicConfigProps","allowedEnvConfig","debug","buildDebug","WEB_TITLE","exports","defaultUserRateLimiting","windowMs","max","isNodeVersionGreaterThan21","major","minor","process","versions","node","split","map","Number","TOKEN_VALID_LENGTH","Config","constructor","config","configOverrideOptions","forceMigrateToSecureLegacySignature","_config$flags$searchR","_config$flags","_config$flags$changeP","_config$flags2","self","storage","env","VERDACCIO_STORAGE_PATH","configPath","_config$config_path","config_path","self_path","Error","plugins","security","_","merge","defaultSecurity","api","migrateToSecureLegacySignature","serverSettings","flags","searchRemote","changePassword","user_agent","configProp","getUserAgent","userRateLimit","assert","isObject","APP_ERROR","CONFIG_NOT_VALID","forEach","x","uplinks","sanityCheckUplinksProps","uplinkSanityCheck","packages","normalisePackageAccess","envConf","toUpperCase","server_id","generateRandomHexString","getMigrateToSecureLegacySignature","getConfigPath","getMatchedPackagesSpec","pkgName","checkSecretKey","secret","isEmpty","length","generateRandomSecretKey","warningUtils","emit","Codes","VERWAR007","_this$secret"],"sources":["../src/config.ts"],"sourcesContent":["import assert from 'assert';\nimport buildDebug from 'debug';\nimport _ from 'lodash';\n\nimport { APP_ERROR, warningUtils } from '@verdaccio/core';\nimport { Codes } from '@verdaccio/core/build/warning-utils';\nimport {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\nimport { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport serverSettings 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\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 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 serverSettings: 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.serverSettings = serverSettings;\n this.flags = {\n searchRemote: config.flags?.searchRemote ?? true,\n changePassword: config.flags?.changePassword ?? 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(_.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(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 = 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 */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return 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":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAA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AI,CAACsE,MAAM,GAAG,IAAAG,8BAAuB,EAAC,CAAC;MACvCzE,KAAK,CAAC,sCAAsC,GAAA8E,YAAA,GAAE,IAAI,CAACR,MAAM,cAAAQ,YAAA,uBAAXA,YAAA,CAAaN,MAAM,CAAC;MAElE,OAAO,IAAI,CAACF,MAAM;IACpB;EACF;AACF;AAACnE,OAAA,CAAAc,MAAA,GAAAA,MAAA","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -132,5 +132,5 @@ Object.keys(_user).forEach(function (key) {
|
|
|
132
132
|
});
|
|
133
133
|
var _builder = _interopRequireDefault(require("./builder"));
|
|
134
134
|
var _conf = require("./conf");
|
|
135
|
-
function _interopRequireDefault(
|
|
135
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
136
136
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_config","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_configPath","_token","_packageAccess","_parse","_uplinks","_security","_agent","_user","_builder","_interopRequireDefault","_conf","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_config","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_configPath","_token","_packageAccess","_parse","_uplinks","_security","_agent","_user","_builder","_interopRequireDefault","_conf","e","__esModule","default"],"sources":["../src/index.ts"],"sourcesContent":["export * from './config';\nexport * from './config-path';\nexport * from './token';\nexport * from './package-access';\nexport { fromJStoYAML, parseConfigFile } from './parse';\nexport * from './uplinks';\nexport * from './security';\nexport * from './agent';\nexport * from './user';\nexport { default as ConfigBuilder } from './builder';\nexport { getDefaultConfig } from './conf';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI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GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
package/build/package-access.js
CHANGED
|
@@ -7,9 +7,11 @@ exports.ROLES = exports.PACKAGE_ACCESS = void 0;
|
|
|
7
7
|
exports.normalisePackageAccess = normalisePackageAccess;
|
|
8
8
|
exports.normalizeUserList = normalizeUserList;
|
|
9
9
|
var _assert = _interopRequireDefault(require("assert"));
|
|
10
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
10
11
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
11
12
|
var _core = require("@verdaccio/core");
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const debug = (0, _debug.default)('verdaccio:config:utils');
|
|
13
15
|
// @deprecated use @verdaccio/core:authUtils
|
|
14
16
|
const ROLES = exports.ROLES = {
|
|
15
17
|
$ALL: '$all',
|
|
@@ -58,6 +60,7 @@ function normalisePackageAccess(packages) {
|
|
|
58
60
|
for (const pkg in packages) {
|
|
59
61
|
if (Object.prototype.hasOwnProperty.call(packages, pkg)) {
|
|
60
62
|
const packageAccess = packages[pkg];
|
|
63
|
+
debug('package access %s for %s ', packageAccess, pkg);
|
|
61
64
|
const isInvalid = _lodash.default.isObject(packageAccess) && _lodash.default.isArray(packageAccess) === false;
|
|
62
65
|
(0, _assert.default)(isInvalid, `CONFIG: bad "'${pkg}'" package description (object expected)`);
|
|
63
66
|
normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-access.js","names":["_assert","_interopRequireDefault","require","_lodash","_core","
|
|
1
|
+
{"version":3,"file":"package-access.js","names":["_assert","_interopRequireDefault","require","_debug","_lodash","_core","e","__esModule","default","debug","buildDebug","ROLES","exports","$ALL","ALL","$AUTH","$ANONYMOUS","DEPRECATED_ALL","DEPRECATED_AUTH","DEPRECATED_ANONYMOUS","PACKAGE_ACCESS","SCOPE","normalizeUserList","groupsList","result","_","isNil","isEmpty","isString","groupsArray","split","push","Array","isArray","errorUtils","getInternalError","JSON","stringify","flatten","normalisePackageAccess","packages","normalizedPkgs","access","publish","unpublish","proxy","pkg","Object","prototype","hasOwnProperty","call","packageAccess","isInvalid","isObject","assert","isUndefined"],"sources":["../src/package-access.ts"],"sourcesContent":["import assert from 'assert';\nimport buildDebug from 'debug';\nimport _ from 'lodash';\n\nimport { errorUtils } from '@verdaccio/core';\nimport { PackageAccess } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:config:utils');\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\n// @deprecated use @verdaccio/core:authUtils\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\n// @deprecated use @verdaccio/core:authUtils\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (_.isNil(groupsList) || _.isEmpty(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (_.isString(groupsList)) {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw errorUtils.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return _.flatten(result);\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (_.isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n debug('package access %s for %s ', packageAccess, pkg);\n const isInvalid = _.isObject(packageAccess) && _.isArray(packageAccess) === false;\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = _.isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAA6C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG7C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,wBAAwB,CAAC;AAMlD;AACO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG;EACnBE,IAAI,EAAE,MAAM;EACZC,GAAG,EAAE,KAAK;EACVC,KAAK,EAAE,gBAAgB;EACvBC,UAAU,EAAE,YAAY;EACxBC,cAAc,EAAE,MAAM;EACtBC,eAAe,EAAE,gBAAgB;EACjCC,oBAAoB,EAAE;AACxB,CAAC;;AAED;AACO,MAAMC,cAAc,GAAAR,OAAA,CAAAQ,cAAA,GAAG;EAC5BC,KAAK,EAAE,MAAM;EACbP,GAAG,EAAE;AACP,CAAC;AAEM,SAASQ,iBAAiBA,CAACC,UAAe,EAAO;EACtD,MAAMC,MAAa,GAAG,EAAE;EACxB,IAAIC,eAAC,CAACC,KAAK,CAACH,UAAU,CAAC,IAAIE,eAAC,CA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EAACF,SAAS,EAAE,iBAAiBN,GAAG,0CAA0C,CAAC;MAEjFL,cAAc,CAACK,GAAG,CAAC,CAACJ,MAAM,GAAGpB,iBAAiB,CAAC6B,aAAa,CAACT,MAAM,CAAC;MACpED,cAAc,CAACK,GAAG,CAAC,CAACH,OAAO,GAAGrB,iBAAiB,CAAC6B,aAAa,CAACR,OAAO,CAAC;MACtEF,cAAc,CAACK,GAAG,CAAC,CAACD,KAAK,GAAGvB,iBAAiB,CAAC6B,aAAa,CAACN,KAAK,CAAC;MAClE;MACAJ,cAAc,CAACK,GAAG,CAAC,CAACF,SAAS,GAAGnB,eAAC,CAAC8B,WAAW,CAACJ,aAAa,CAACP,SAAS,CAAC,GAClE,KAAK,GACLtB,iBAAiB,CAAC6B,aAAa,CAACP,SAAS,CAAC;IAChD;EACF;EAEA,OAAOH,cAAc;AACvB","ignoreList":[]}
|
package/build/parse.js
CHANGED
|
@@ -11,7 +11,7 @@ var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
|
11
11
|
var _lodash = require("lodash");
|
|
12
12
|
var _core = require("@verdaccio/core");
|
|
13
13
|
var _configUtils = require("./config-utils");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const debug = (0, _debug.default)('verdaccio:config:parse');
|
|
16
16
|
|
|
17
17
|
/**
|
package/build/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","names":["_debug","_interopRequireDefault","require","_fs","_jsYaml","_lodash","_core","_configUtils","
|
|
1
|
+
{"version":3,"file":"parse.js","names":["_debug","_interopRequireDefault","require","_fs","_jsYaml","_lodash","_core","_configUtils","e","__esModule","default","debug","buildDebug","parseConfigFile","configPath","fileExists","Error","test","yamlConfig","YAML","load","fs","readFileSync","strict","Object","assign","config_path","jsonConfig","code","message","APP_ERROR","CONFIG_NOT_VALID","fromJStoYAML","config","isObject","dump"],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash';\n\nimport { APP_ERROR } from '@verdaccio/core';\nimport { ConfigYaml } from '@verdaccio/types';\n\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a config file from yaml to JSON.\n * @param configPath the absolute path of the configuration file\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n debug('parsing config file: %o', configPath);\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8'), {\n strict: false,\n }) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n }\n\n const jsonConfig = require(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n debug('config module not found %o error: %o', configPath, e.message);\n throw Error(APP_ERROR.CONFIG_NOT_VALID);\n }\n\n throw e;\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAGA,IAAAK,YAAA,GAAAL,OAAA;AAA4C,SAAAD,uBAAAO,CAAA,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C,CAAC;EACzC,IAAI,IAAAuB,gBAAQ,EAACD,MAAM,CAAC,EAAE;IACpB,OAAOd,eAAI,CAACgB,IAAI,CAACF,MAAM,CAAC;EAC1B,CAAC,MAAM;IACL,MAAM,IAAIjB,KAAK,CAAC,8BAA8B,CAAC;EACjD;AACF","ignoreList":[]}
|
package/build/security.js
CHANGED
package/build/security.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","names":["TIME_EXPIRATION_1H","exports","defaultWebTokenOptions","sign","expiresIn","verify","defaultApiTokenConf","legacy","defaultSecurity","web","api"],"sources":["../src/security.ts"],"sourcesContent":["import { 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":";;;;;;AAEA;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAI;AAEtC,MAAME,sBAAkC,GAAG;EACzCC,IAAI,EAAE;IACJ;IACAC,SAAS,EAAEJ;EACb,CAAC;EACDK,MAAM,EAAE,CAAC;AACX,CAAC;AAED,MAAMC,mBAAoC,GAAG;EAC3CC,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"security.js","names":["TIME_EXPIRATION_1H","exports","defaultWebTokenOptions","sign","expiresIn","verify","defaultApiTokenConf","legacy","migrateToSecureLegacySignature","defaultSecurity","web","api"],"sources":["../src/security.ts"],"sourcesContent":["import { 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":";;;;;;AAEA;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAI;AAEtC,MAAME,sBAAkC,GAAG;EACzCC,IAAI,EAAE;IACJ;IACAC,SAAS,EAAEJ;EACb,CAAC;EACDK,MAAM,EAAE,CAAC;AACX,CAAC;AAED,MAAMC,mBAAoC,GAAG;EAC3CC,MAAM,EAAE,IAAI;EACZC,8BAA8B,EAAE;AAClC,CAAC;AAEM,MAAMC,eAAyB,GAAAR,OAAA,CAAAQ,eAAA,GAAG;EACvCC,GAAG,EAAER,sBAAsB;EAC3BS,GAAG,EAAEL;AACP,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSettings.js","names":["rateLimit","windowMs","max","keepAliveTimeout"],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";;;;;;iCAAe;EACb;EACA;EACAA,SAAS,EAAE;IACTC,QAAQ,EAAE,IAAI;IACdC,GAAG,EAAE;EACP,CAAC;EACD;EACAC,gBAAgB,EAAE;AACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"serverSettings.js","names":["rateLimit","windowMs","max","keepAliveTimeout"],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";;;;;;iCAAe;EACb;EACA;EACAA,SAAS,EAAE;IACTC,QAAQ,EAAE,IAAI;IACdC,GAAG,EAAE;EACP,CAAC;EACD;EACAC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
|
package/build/token.d.ts
CHANGED
package/build/token.js
CHANGED
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TOKEN_VALID_LENGTH = void 0;
|
|
7
7
|
exports.generateRandomSecretKey = generateRandomSecretKey;
|
|
8
8
|
var _crypto = require("crypto");
|
|
9
|
+
// TODO: code duplicated at @verdaccio/signature
|
|
9
10
|
const TOKEN_VALID_LENGTH = exports.TOKEN_VALID_LENGTH = 32;
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Secret key must have 32 characters.
|
|
14
|
+
* // TODO: code duplicated at @verdaccio/signature
|
|
13
15
|
*/
|
|
14
16
|
function generateRandomSecretKey() {
|
|
15
17
|
return (0, _crypto.randomBytes)(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);
|
package/build/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":["_crypto","require","TOKEN_VALID_LENGTH","exports","generateRandomSecretKey","randomBytes","toString","substring"],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"token.js","names":["_crypto","require","TOKEN_VALID_LENGTH","exports","generateRandomSecretKey","randomBytes","toString","substring"],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'crypto';\n\n// TODO: code duplicated at @verdaccio/signature\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n * // TODO: code duplicated at @verdaccio/signature\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,EAAE;;AAEpC;AACA;AACA;AACA;AACO,SAASE,uBAAuBA,CAAA,EAAW;EAChD,OAAO,IAAAC,mBAAW,EAACH,kBAAkB,CAAC,CAACI,QAAQ,CAAC,QAAQ,CAAC,CAACC,SAAS,CAAC,CAAC,EAAEL,kBAAkB,CAAC;AAC5F","ignoreList":[]}
|
package/build/uplinks.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.uplinkSanityCheck = uplinkSanityCheck;
|
|
|
11
11
|
var _assert = _interopRequireDefault(require("assert"));
|
|
12
12
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
13
|
var _utils = require("@verdaccio/utils");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const DEFAULT_REGISTRY = exports.DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
16
16
|
const DEFAULT_UPLINK = exports.DEFAULT_UPLINK = 'npmjs';
|
|
17
17
|
const BLACKLIST = {
|
package/build/uplinks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uplinks.js","names":["_assert","_interopRequireDefault","require","_lodash","_utils","
|
|
1
|
+
{"version":3,"file":"uplinks.js","names":["_assert","_interopRequireDefault","require","_lodash","_utils","e","__esModule","default","DEFAULT_REGISTRY","exports","DEFAULT_UPLINK","BLACKLIST","all","anonymous","undefined","owner","none","uplinkSanityCheck","uplinks","users","newUplinks","_","clone","newUsers","uplink","Object","prototype","hasOwnProperty","call","cache","sanityCheckNames","sanityCheckUplinksProps","configUpLinks","assert","url","isString","replace","hasProxyTo","pkg","upLink","packages","matchedPkg","getMatchedPackagesSpec","proxyList","proxy","some","curr","item","match","isNil"],"sources":["../src/uplinks.ts"],"sourcesContent":["import assert from 'assert';\nimport _ from 'lodash';\n\nimport { PackageList, UpLinksConfList } from '@verdaccio/types';\nimport { getMatchedPackagesSpec } from '@verdaccio/utils';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = _.clone(uplinks);\n let newUsers = _.clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (typeof newUplinks[uplink].cache === 'undefined') {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = _.clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(_.isString(uplinks[uplink].url), 'CONFIG: wrong url format for uplink: ' + uplink);\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const matchedPkg = getMatchedPackagesSpec(pkg, packages);\n const proxyList = typeof matchedPkg !== 'undefined' ? matchedPkg.proxy : [];\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(_.isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAA0D,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,4BAA4B;AACrD,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,OAAO;AAErC,MAAMC,SAAS,GAAG;EAChBC,GAAG,EAAE,IAAI;EACTC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfC,KAAK,EAAE,IAAI;EACXC,IAAI,EAAE;AACR,CAAC;AAEM,SAASC,iBAAiBA,CAC/BC,OAAwB,EACxBC,KAAU,GAAGR,SAAS,EACL;EACjB,MAAMS,UAAU,GAAGC,eAAC,CAACC,KAAK,CAACJ,OAAO,CAAC;EACnC,IAAIK,QAAQ,GAAGF,eAAC,CAACC,KAAK,CAACH,KAAK,CAAC;EAE7B,KAAK,MAAMK,MAAM,IAAIJ,UAAU,EAAE;IAC/B,IAAIK,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACR,UAAU,EAAEI,MAAM,CAAC,EAAE;MAC5D,IAAI,OAAOJ,UAAU,CAACI,MAAM,CAAC,CAACK,KAAK,KAAK,WAAW,EAAE;QACnDT,UAAU,CAACI,MAAM,CAAC,CAACK,KAAK,GAAG,IAAI;MACjC;MACAN,QAAQ,GAAGO,gBAAgB,CAACN,MAAM,EAAED,QAAQ,CAAC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M,EACjB,gCAAgC,GAAGA,IACrC,CAAC;EACD,IAAAd,eAAM,EAAC,CAACc,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,+BAA+B,GAAGD,IAAI,CAAC;EACjE,IAAAd,eAAM,EAACZ,eAAC,CAAC4B,KAAK,CAAC9B,KAAK,CAAC4B,IAAI,CAAC,CAAC,EAAE,iCAAiC,GAAGA,IAAI,CAAC;EACtE5B,KAAK,CAAC4B,IAAI,CAAC,GAAG,IAAI;EAElB,OAAO5B,KAAK;AACd","ignoreList":[]}
|
package/build/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","names":["_packageAccess","require","defaultLoggedUserRoles","exports","ROLES","$ALL","$AUTH","DEPRECATED_ALL","DEPRECATED_AUTH","ALL","defaultNonLoggedUserRoles","$ANONYMOUS","DEPRECATED_ANONYMOUS","createRemoteUser","name","pluginGroups","isGroupValid","Array","isArray","groups","from","Set","concat","real_groups","createAnonymousRemoteUser","undefined"],"sources":["../src/user.ts"],"sourcesContent":["import { RemoteUser } from '@verdaccio/types';\n\nimport { ROLES } from './package-access';\n\n/**\n * All logged users will have by default the group $all and $authenticate\n */\nexport const defaultLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$AUTH,\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_AUTH,\n ROLES.ALL,\n];\n/**\n *\n */\nexport const defaultNonLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$ANONYMOUS,\n // groups without '$' are going to be deprecated eventually\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_ANONYMOUS,\n];\n\n/**\n * Create a RemoteUser object\n * @return {Object} { name: xx, pluginGroups: [], real_groups: [] }\n */\nexport function createRemoteUser(name: string, pluginGroups: string[]): RemoteUser {\n const isGroupValid: boolean = Array.isArray(pluginGroups);\n const groups = Array.from(\n new Set((isGroupValid ? pluginGroups : []).concat([...defaultLoggedUserRoles]))\n );\n\n return {\n name,\n groups,\n real_groups: pluginGroups,\n };\n}\n\n/**\n * Builds an anonymous remote user in case none is logged in.\n * @return {Object} { name: xx, groups: [], real_groups: [] }\n */\nexport function createAnonymousRemoteUser(): RemoteUser {\n return {\n name: undefined,\n groups: [...defaultNonLoggedUserRoles],\n real_groups: [],\n };\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CACpCE,oBAAK,CAACC,IAAI,EACVD,oBAAK,CAACE,KAAK,EACXF,oBAAK,CAACG,cAAc,EACpBH,oBAAK,CAACI,eAAe,EACrBJ,oBAAK,CAACK,GAAG,CACV;AACD;AACA;AACA;AACO,MAAMC,yBAAyB,GAAAP,OAAA,CAAAO,yBAAA,GAAG,CACvCN,oBAAK,CAACC,IAAI,EACVD,oBAAK,CAACO,UAAU;AAChB;AACAP,oBAAK,CAACG,cAAc,EACpBH,oBAAK,CAACQ,oBAAoB,CAC3B;;AAED;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAACC,IAAY,EAAEC,YAAsB,EAAc;EACjF,MAAMC,YAAqB,GAAGC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC;EACzD,MAAMI,MAAM,GAAGF,KAAK,CAACG,IAAI,CACvB,IAAIC,GAAG,CAAC,CAACL,YAAY,GAAGD,YAAY,GAAG,EAAE,EAAEO,MAAM,CAAC,CAAC,GAAGpB,sBAAsB,CAAC,CAAC,CAChF,CAAC;EAED,OAAO;IACLY,IAAI;IACJK,MAAM;IACNI,WAAW,EAAER;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASS,yBAAyBA,CAAA,EAAe;EACtD,OAAO;IACLV,IAAI,EAAEW,SAAS;IACfN,MAAM,EAAE,CAAC,GAAGT,yBAAyB,CAAC;IACtCa,WAAW,EAAE;EACf,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"user.js","names":["_packageAccess","require","defaultLoggedUserRoles","exports","ROLES","$ALL","$AUTH","DEPRECATED_ALL","DEPRECATED_AUTH","ALL","defaultNonLoggedUserRoles","$ANONYMOUS","DEPRECATED_ANONYMOUS","createRemoteUser","name","pluginGroups","isGroupValid","Array","isArray","groups","from","Set","concat","real_groups","createAnonymousRemoteUser","undefined"],"sources":["../src/user.ts"],"sourcesContent":["import { RemoteUser } from '@verdaccio/types';\n\nimport { ROLES } from './package-access';\n\n/**\n * All logged users will have by default the group $all and $authenticate\n */\nexport const defaultLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$AUTH,\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_AUTH,\n ROLES.ALL,\n];\n/**\n *\n */\nexport const defaultNonLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$ANONYMOUS,\n // groups without '$' are going to be deprecated eventually\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_ANONYMOUS,\n];\n\n/**\n * Create a RemoteUser object\n * @return {Object} { name: xx, pluginGroups: [], real_groups: [] }\n */\nexport function createRemoteUser(name: string, pluginGroups: string[]): RemoteUser {\n const isGroupValid: boolean = Array.isArray(pluginGroups);\n const groups = Array.from(\n new Set((isGroupValid ? pluginGroups : []).concat([...defaultLoggedUserRoles]))\n );\n\n return {\n name,\n groups,\n real_groups: pluginGroups,\n };\n}\n\n/**\n * Builds an anonymous remote user in case none is logged in.\n * @return {Object} { name: xx, groups: [], real_groups: [] }\n */\nexport function createAnonymousRemoteUser(): RemoteUser {\n return {\n name: undefined,\n groups: [...defaultNonLoggedUserRoles],\n real_groups: [],\n };\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CACpCE,oBAAK,CAACC,IAAI,EACVD,oBAAK,CAACE,KAAK,EACXF,oBAAK,CAACG,cAAc,EACpBH,oBAAK,CAACI,eAAe,EACrBJ,oBAAK,CAACK,GAAG,CACV;AACD;AACA;AACA;AACO,MAAMC,yBAAyB,GAAAP,OAAA,CAAAO,yBAAA,GAAG,CACvCN,oBAAK,CAACC,IAAI,EACVD,oBAAK,CAACO,UAAU;AAChB;AACAP,oBAAK,CAACG,cAAc,EACpBH,oBAAK,CAACQ,oBAAoB,CAC3B;;AAED;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAACC,IAAY,EAAEC,YAAsB,EAAc;EACjF,MAAMC,YAAqB,GAAGC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC;EACzD,MAAMI,MAAM,GAAGF,KAAK,CAACG,IAAI,CACvB,IAAIC,GAAG,CAAC,CAACL,YAAY,GAAGD,YAAY,GAAG,EAAE,EAAEO,MAAM,CAAC,CAAC,GAAGpB,sBAAsB,CAAC,CAAC,CAChF,CAAC;EAED,OAAO;IACLY,IAAI;IACJK,MAAM;IACNI,WAAW,EAAER;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASS,yBAAyBA,CAAA,EAAe;EACtD,OAAO;IACLV,IAAI,EAAEW,SAAS;IACfN,MAAM,EAAE,CAAC,GAAGT,yBAAyB,CAAC;IACtCa,WAAW,EAAE;EACf,CAAC;AACH","ignoreList":[]}
|