@verdaccio/core 6.0.0-6-next.61 → 6.0.0-6-next.63
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 +12 -0
- package/build/validation-utils.js +9 -4
- package/build/validation-utils.js.map +1 -1
- package/build/warning-utils.d.ts +1 -0
- package/build/warning-utils.js +2 -0
- package/build/warning-utils.js.map +1 -1
- package/package.json +4 -4
- package/src/validation-utils.ts +9 -8
- package/src/warning-utils.ts +7 -0
- package/test/validation-utilts.spec.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @verdaccio/core
|
|
2
2
|
|
|
3
|
+
## 6.0.0-6-next.63
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dc571aab: feat: add forceEnhancedLegacySignature
|
|
8
|
+
|
|
9
|
+
## 6.0.0-6-next.62
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 378e907d: fix(core): fix `isObject` function.`isObject(true)` should return false.
|
|
14
|
+
|
|
3
15
|
## 6.0.0-6-next.61
|
|
4
16
|
|
|
5
17
|
## 6.0.0-6-next.60
|
|
@@ -102,10 +102,15 @@ function normalizeMetadata(manifest, name) {
|
|
|
102
102
|
* @return {Boolean}
|
|
103
103
|
*/
|
|
104
104
|
function isObject(obj) {
|
|
105
|
-
if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
105
|
+
// if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {
|
|
106
|
+
// return false;
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
// return (
|
|
110
|
+
// (typeof obj === 'object' || typeof obj.prototype === 'undefined') &&
|
|
111
|
+
// Array.isArray(obj) === false
|
|
112
|
+
// );
|
|
113
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
109
114
|
}
|
|
110
115
|
function validatePassword(password, validation = _constants.DEFAULT_PASSWORD_VALIDATION) {
|
|
111
116
|
return typeof password === 'string' && validation instanceof RegExp ? password.match(validation) !== null : false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-utils.js","names":["isPackageNameScoped","name","startsWith","validateName","normalizedName","toLowerCase","isScoped","scopedName","split","match","includes","validatePackage","nameList","length","slice","normalizeMetadata","manifest","assert","strictEqual","_manifest","isObject","DIST_TAGS","obj","prototype","
|
|
1
|
+
{"version":3,"file":"validation-utils.js","names":["isPackageNameScoped","name","startsWith","validateName","normalizedName","toLowerCase","isScoped","scopedName","split","match","includes","validatePackage","nameList","length","slice","normalizeMetadata","manifest","assert","strictEqual","_manifest","isObject","DIST_TAGS","obj","Object","prototype","toString","call","validatePassword","password","validation","DEFAULT_PASSWORD_VALIDATION","RegExp"],"sources":["../src/validation-utils.ts"],"sourcesContent":["import assert from 'assert';\n\nimport { Manifest } from '@verdaccio/types';\n\nimport { DEFAULT_PASSWORD_VALIDATION, DIST_TAGS } from './constants';\n\nexport { validatePublishSingleVersion } from './schemes/publish-manifest';\n\nexport function isPackageNameScoped(name: string): boolean {\n return name.startsWith('@');\n}\n\n/**\n * From normalize-package-data/lib/fixer.js\n * @param {*} name the package name\n * @return {Boolean} whether is valid or not\n */\nexport function validateName(name: string): boolean {\n if (typeof name !== 'string') {\n return false;\n }\n\n let normalizedName: string = name.toLowerCase();\n\n const isScoped: boolean = isPackageNameScoped(name);\n const scopedName = name.split('/', 2)[1];\n\n if (isScoped && typeof scopedName !== 'undefined') {\n normalizedName = scopedName.toLowerCase();\n }\n\n /**\n * Some context about the first regex\n * - npm used to have a different tarball naming system.\n * eg: http://registry.npmjs.com/thirty-two\n * https://registry.npmjs.org/thirty-two/-/thirty-two@0.0.1.tgz\n * The file name thirty-two@0.0.1.tgz, the version and the pkg name was separated by an at (@)\n * while nowadays the naming system is based in dashes\n * https://registry.npmjs.org/verdaccio/-/verdaccio-1.4.0.tgz\n *\n * more info here: https://github.com/rlidwka/sinopia/issues/75\n */\n return !(\n !normalizedName.match(/^[-a-zA-Z0-9_.!~*'()@]+$/) ||\n normalizedName.startsWith('.') || // \".bin\", etc.\n ['node_modules', '__proto__', 'favicon.ico'].includes(normalizedName)\n );\n}\n\n/**\n * Validate a package.\n * @return {Boolean} whether the package is valid or not\n */\nexport function validatePackage(name: string): boolean {\n const nameList = name.split('/', 2);\n if (nameList.length === 1) {\n // normal package\n return validateName(nameList[0]);\n }\n // scoped package\n return nameList[0][0] === '@' && validateName(nameList[0].slice(1)) && validateName(nameList[1]);\n}\n\n/**\n * Validate the package metadata, add additional properties whether are missing within\n * the metadata properties.\n * @param {*} manifest\n * @param {*} name\n * @return {Object} the object with additional properties as dist-tags ad versions\n * FUTURE: rename to normalizeMetadata\n */\nexport function normalizeMetadata(manifest: Manifest, name: string): Manifest {\n assert.strictEqual(manifest.name, name);\n const _manifest = { ...manifest };\n\n if (!isObject(manifest[DIST_TAGS])) {\n _manifest[DIST_TAGS] = {};\n }\n\n // This may not be nee dit\n if (!isObject(manifest['versions'])) {\n _manifest['versions'] = {};\n }\n\n if (!isObject(manifest['time'])) {\n _manifest['time'] = {};\n }\n\n return _manifest;\n}\n\n/**\n * Check whether an element is an Object\n * @param {*} obj the element\n * @return {Boolean}\n */\nexport function isObject(obj: any): boolean {\n // if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {\n // return false;\n // }\n\n // return (\n // (typeof obj === 'object' || typeof obj.prototype === 'undefined') &&\n // Array.isArray(obj) === false\n // );\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\nexport function validatePassword(\n password: string,\n validation: RegExp = DEFAULT_PASSWORD_VALIDATION\n): boolean {\n return typeof password === 'string' && validation instanceof RegExp\n ? password.match(validation) !== null\n : false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAIA;AAEA;AAA0E;AAEnE,SAASA,mBAAmB,CAACC,IAAY,EAAW;EACzD,OAA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AACA;AACA;AACO,SAASG,iBAAiB,CAACC,QAAkB,EAAEf,IAAY,EAAY;EAC5EgB,eAAM,CAACC,WAAW,CAACF,QAAQ,CAACf,IAAI,EAAEA,IAAI,CAAC;EACvC,MAAMkB,SAAS,GAAG;IAAE,GAAGH;EAAS,CAAC;EAEjC,IAAI,CAACI,QAAQ,CAACJ,QAAQ,CAACK,oBAAS,CAAC,CAAC,EAAE;IAClCF,SAAS,CAACE,oBAAS,CAAC,GAAG,CAAC,CAAC;EAC3B;;EAEA;EACA,IAAI,CAACD,QAAQ,CAACJ,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE;IACnCG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;EAC5B;EAEA,IAAI,CAACC,QAAQ,CAACJ,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE;IAC/BG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;EACxB;EAEA,OAAOA,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQ,CAACE,GAAQ,EAAW;EAC1C;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA,OAAOC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,GAAG,CAAC,KAAK,iBAAiB;AAClE;AAEO,SAASK,gBAAgB,CAC9BC,QAAgB,EAChBC,UAAkB,GAAGC,sCAA2B,EACvC;EACT,OAAO,OAAOF,QAAQ,KAAK,QAAQ,IAAIC,UAAU,YAAYE,MAAM,GAC/DH,QAAQ,CAACnB,KAAK,CAACoB,UAAU,CAAC,KAAK,IAAI,GACnC,KAAK;AACX"}
|
package/build/warning-utils.d.ts
CHANGED
package/build/warning-utils.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.Codes = Codes;
|
|
|
17
17
|
Codes["VERWAR002"] = "VERWAR002";
|
|
18
18
|
Codes["VERWAR003"] = "VERWAR003";
|
|
19
19
|
Codes["VERWAR004"] = "VERWAR004";
|
|
20
|
+
Codes["VERWAR005"] = "VERWAR005";
|
|
20
21
|
Codes["VERDEP003"] = "VERDEP003";
|
|
21
22
|
})(Codes || (exports.Codes = Codes = {}));
|
|
22
23
|
warningInstance.create(verdaccioWarning, Codes.VERWAR002, `The property config "logs" property is longer supported, rename to "log" and use object instead`);
|
|
@@ -25,6 +26,7 @@ warningInstance.create(verdaccioWarning, Codes.VERWAR003, 'rotating-file type is
|
|
|
25
26
|
warningInstance.create(verdaccioWarning, Codes.VERWAR004, `invalid address - %s, we expect a port (e.g. "4873"),
|
|
26
27
|
host:port (e.g. "localhost:4873") or full url '(e.g. "http://localhost:4873/")
|
|
27
28
|
https://verdaccio.org/docs/en/configuration#listen-port`);
|
|
29
|
+
warningInstance.create(verdaccioWarning, Codes.VERWAR005, 'disable enhanced legacy signature is considered a security risk, please reconsider enable it');
|
|
28
30
|
warningInstance.create(verdaccioDeprecation, Codes.VERDEP003, 'multiple addresses will be deprecated in the next major, only use one');
|
|
29
31
|
function emit(code, a, b, c) {
|
|
30
32
|
warningInstance.emit(code, a, b, c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warning-utils.js","names":["warningInstance","warning","verdaccioWarning","verdaccioDeprecation","Codes","create","VERWAR002","VERWAR001","VERWAR003","VERWAR004","VERDEP003","emit","code","a","b","c"],"sources":["../src/warning-utils.ts"],"sourcesContent":["import warning from 'process-warning';\n\nconst warningInstance = warning();\nconst verdaccioWarning = 'VerdaccioWarning';\nconst verdaccioDeprecation = 'VerdaccioDeprecation';\n\nexport enum Codes {\n VERWAR001 = 'VERWAR001',\n VERWAR002 = 'VERWAR002',\n VERWAR003 = 'VERWAR003',\n VERWAR004 = 'VERWAR004',\n // deprecation warnings\n VERDEP003 = 'VERDEP003',\n}\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR002,\n `The property config \"logs\" property is longer supported, rename to \"log\" and use object instead`\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR001,\n `Verdaccio doesn't need superuser privileges. don't run it under root`\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR003,\n 'rotating-file type is not longer supported, consider use [logrotate] instead'\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR004,\n `invalid address - %s, we expect a port (e.g. \"4873\"), \nhost:port (e.g. \"localhost:4873\") or full url '(e.g. \"http://localhost:4873/\")\nhttps://verdaccio.org/docs/en/configuration#listen-port`\n);\n\nwarningInstance.create(\n verdaccioDeprecation,\n Codes.VERDEP003,\n 'multiple addresses will be deprecated in the next major, only use one'\n);\n\nexport function emit(code: string, a?: string, b?: string, c?: string) {\n warningInstance.emit(code, a, b, c);\n}\n"],"mappings":";;;;;;;AAAA;AAAsC;AAEtC,MAAMA,eAAe,GAAG,IAAAC,uBAAO,GAAE;AACjC,MAAMC,gBAAgB,GAAG,kBAAkB;AAC3C,MAAMC,oBAAoB,GAAG,sBAAsB;AAAC,IAExCC,KAAK;AAAA;AAAA,WAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;AAAA,GAALA,KAAK,qBAALA,KAAK;
|
|
1
|
+
{"version":3,"file":"warning-utils.js","names":["warningInstance","warning","verdaccioWarning","verdaccioDeprecation","Codes","create","VERWAR002","VERWAR001","VERWAR003","VERWAR004","VERWAR005","VERDEP003","emit","code","a","b","c"],"sources":["../src/warning-utils.ts"],"sourcesContent":["import warning from 'process-warning';\n\nconst warningInstance = warning();\nconst verdaccioWarning = 'VerdaccioWarning';\nconst verdaccioDeprecation = 'VerdaccioDeprecation';\n\nexport enum Codes {\n VERWAR001 = 'VERWAR001',\n VERWAR002 = 'VERWAR002',\n VERWAR003 = 'VERWAR003',\n VERWAR004 = 'VERWAR004',\n VERWAR005 = 'VERWAR005',\n // deprecation warnings\n VERDEP003 = 'VERDEP003',\n}\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR002,\n `The property config \"logs\" property is longer supported, rename to \"log\" and use object instead`\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR001,\n `Verdaccio doesn't need superuser privileges. don't run it under root`\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR003,\n 'rotating-file type is not longer supported, consider use [logrotate] instead'\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR004,\n `invalid address - %s, we expect a port (e.g. \"4873\"), \nhost:port (e.g. \"localhost:4873\") or full url '(e.g. \"http://localhost:4873/\")\nhttps://verdaccio.org/docs/en/configuration#listen-port`\n);\n\nwarningInstance.create(\n verdaccioWarning,\n Codes.VERWAR005,\n 'disable enhanced legacy signature is considered a security risk, please reconsider enable it'\n);\n\nwarningInstance.create(\n verdaccioDeprecation,\n Codes.VERDEP003,\n 'multiple addresses will be deprecated in the next major, only use one'\n);\n\nexport function emit(code: string, a?: string, b?: string, c?: string) {\n warningInstance.emit(code, a, b, c);\n}\n"],"mappings":";;;;;;;AAAA;AAAsC;AAEtC,MAAMA,eAAe,GAAG,IAAAC,uBAAO,GAAE;AACjC,MAAMC,gBAAgB,GAAG,kBAAkB;AAC3C,MAAMC,oBAAoB,GAAG,sBAAsB;AAAC,IAExCC,KAAK;AAAA;AAAA,WAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;EAALA,KAAK;AAAA,GAALA,KAAK,qBAALA,KAAK;AAUjBJ,eAAe,CAACK,MAAM,CACpBH,gBAAgB,EAChBE,KAAK,CAACE,SAAS,EACd,iGAAgG,CAClG;AAEDN,eAAe,CAACK,MAAM,CACpBH,gBAAgB,EAChBE,KAAK,CAACG,SAAS,EACd,sEAAqE,CACvE;AAEDP,eAAe,CAACK,MAAM,CACpBH,gBAAgB,EAChBE,KAAK,CAACI,SAAS,EACf,8EAA8E,CAC/E;AAEDR,eAAe,CAACK,MAAM,CACpBH,gBAAgB,EAChBE,KAAK,CAACK,SAAS,EACd;AACH;AACA,wDAAwD,CACvD;AAEDT,eAAe,CAACK,MAAM,CACpBH,gBAAgB,EAChBE,KAAK,CAACM,SAAS,EACf,8FAA8F,CAC/F;AAEDV,eAAe,CAACK,MAAM,CACpBF,oBAAoB,EACpBC,KAAK,CAACO,SAAS,EACf,uEAAuE,CACxE;AAEM,SAASC,IAAI,CAACC,IAAY,EAAEC,CAAU,EAAEC,CAAU,EAAEC,CAAU,EAAE;EACrEhB,eAAe,CAACY,IAAI,CAACC,IAAI,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC;AACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/core",
|
|
3
|
-
"version": "6.0.0-6-next.
|
|
3
|
+
"version": "6.0.0-6-next.63",
|
|
4
4
|
"description": "core utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"private",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"semver": "7.3.8",
|
|
39
39
|
"ajv": "8.11.2",
|
|
40
40
|
"process-warning": "1.0.0",
|
|
41
|
-
"core-js": "3.
|
|
41
|
+
"core-js": "3.28.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"lodash": "4.17.21",
|
|
45
|
-
"typedoc": "0.23.
|
|
45
|
+
"typedoc": "0.23.25",
|
|
46
46
|
"typedoc-plugin-missing-exports": "latest",
|
|
47
|
-
"@verdaccio/types": "11.0.0-6-next.
|
|
47
|
+
"@verdaccio/types": "11.0.0-6-next.22"
|
|
48
48
|
},
|
|
49
49
|
"funding": {
|
|
50
50
|
"type": "opencollective",
|
package/src/validation-utils.ts
CHANGED
|
@@ -95,14 +95,15 @@ export function normalizeMetadata(manifest: Manifest, name: string): Manifest {
|
|
|
95
95
|
* @return {Boolean}
|
|
96
96
|
*/
|
|
97
97
|
export function isObject(obj: any): boolean {
|
|
98
|
-
if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
98
|
+
// if (obj === null || typeof obj === 'undefined' || typeof obj === 'string') {
|
|
99
|
+
// return false;
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
// return (
|
|
103
|
+
// (typeof obj === 'object' || typeof obj.prototype === 'undefined') &&
|
|
104
|
+
// Array.isArray(obj) === false
|
|
105
|
+
// );
|
|
106
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
export function validatePassword(
|
package/src/warning-utils.ts
CHANGED
|
@@ -9,6 +9,7 @@ export enum Codes {
|
|
|
9
9
|
VERWAR002 = 'VERWAR002',
|
|
10
10
|
VERWAR003 = 'VERWAR003',
|
|
11
11
|
VERWAR004 = 'VERWAR004',
|
|
12
|
+
VERWAR005 = 'VERWAR005',
|
|
12
13
|
// deprecation warnings
|
|
13
14
|
VERDEP003 = 'VERDEP003',
|
|
14
15
|
}
|
|
@@ -39,6 +40,12 @@ host:port (e.g. "localhost:4873") or full url '(e.g. "http://localhost:4873/")
|
|
|
39
40
|
https://verdaccio.org/docs/en/configuration#listen-port`
|
|
40
41
|
);
|
|
41
42
|
|
|
43
|
+
warningInstance.create(
|
|
44
|
+
verdaccioWarning,
|
|
45
|
+
Codes.VERWAR005,
|
|
46
|
+
'disable enhanced legacy signature is considered a security risk, please reconsider enable it'
|
|
47
|
+
);
|
|
48
|
+
|
|
42
49
|
warningInstance.create(
|
|
43
50
|
verdaccioDeprecation,
|
|
44
51
|
Codes.VERDEP003,
|