diff --git a/package.json b/package.json index eedad68b5..83be4e942 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@types/lodash": "4.14.178", "@types/mime": "2.0.3", "@types/minimatch": "3.0.5", - "@types/node": "14.6.0", + "@types/node": "16.11.19", "@types/request": "2.48.8", "@types/semver": "7.3.9", "@types/supertest": "2.0.11", @@ -89,7 +89,7 @@ "kleur": "3.0.3", "lint-staged": "11.2.6", "nock": "12.0.3", - "node-fetch": "3.0.0-beta.6-exportfix", + "node-fetch": "cjs", "nodemon": "2.0.15", "npm-run-all": "4.1.5", "prettier": "2.3.2", diff --git a/packages/auth/src/legacy-token.ts b/packages/auth/src/legacy-token.ts index 085923b44..91b12c421 100644 --- a/packages/auth/src/legacy-token.ts +++ b/packages/auth/src/legacy-token.ts @@ -1,6 +1,6 @@ import { - HexBase64BinaryEncoding, - Utf8AsciiBinaryEncoding, + BinaryToTextEncoding, + CharacterEncoding, createCipheriv, createDecipheriv, randomBytes, @@ -12,8 +12,8 @@ import { TOKEN_VALID_LENGTH } from '@verdaccio/config'; const debug = buildDebug('verdaccio:auth:token:legacy'); export const defaultAlgorithm = process.env.VERDACCIO_LEGACY_ALGORITHM || 'aes-256-ctr'; -const inputEncoding: Utf8AsciiBinaryEncoding = 'utf8'; -const outputEncoding: HexBase64BinaryEncoding = 'hex'; +const inputEncoding: CharacterEncoding = 'utf8'; +const outputEncoding: BinaryToTextEncoding = 'hex'; // For AES, this is always 16 const IV_LENGTH = 16; // Must be 256 bits (32 characters) @@ -56,7 +56,8 @@ export function aesDecrypt(value: string, key: string): string | void { const secretKey = VERDACCIO_LEGACY_ENCRYPTION_KEY || key; // decipher the string const decipher = createDecipheriv(defaultAlgorithm, secretKey, IV); - let decrypted = decipher.update(encryptedText, outputEncoding, inputEncoding); + // FIXME: fix type here should allow Buffer + let decrypted = decipher.update(encryptedText as any, outputEncoding, inputEncoding); decrypted += decipher.final(inputEncoding); debug('token decrypted successfully'); return decrypted.toString(); diff --git a/packages/core/types/package.json b/packages/core/types/package.json index ea7b53b78..6702e981e 100644 --- a/packages/core/types/package.json +++ b/packages/core/types/package.json @@ -38,7 +38,7 @@ "build": "exit 0" }, "devDependencies": { - "@types/node": "14.6.0", + "@types/node": "16.11.19", "tsd": "0.19.1" }, "funding": { diff --git a/packages/plugins/audit/package.json b/packages/plugins/audit/package.json index df7133652..0f1869137 100644 --- a/packages/plugins/audit/package.json +++ b/packages/plugins/audit/package.json @@ -34,7 +34,7 @@ "express": "4.17.2", "body-parser": "1.19.1", "https-proxy-agent": "5.0.0", - "node-fetch": "3.0.0-beta.6-exportfix" + "node-fetch": "cjs" }, "devDependencies": { "@verdaccio/types": "workspace:11.0.0-6-next.10", diff --git a/packages/tools/benchmark/package.json b/packages/tools/benchmark/package.json index 1981dcee1..34eeaa656 100644 --- a/packages/tools/benchmark/package.json +++ b/packages/tools/benchmark/package.json @@ -22,7 +22,7 @@ }, "devDependencies": { "autocannon": "7.5.1", - "node-fetch": "3.0.0-beta.6-exportfix", + "node-fetch": "cjs", "ts-node": "10.4.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 490daf945..01c5c45cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,7 +40,7 @@ importers: '@types/lodash': 4.14.178 '@types/mime': 2.0.3 '@types/minimatch': 3.0.5 - '@types/node': 14.6.0 + '@types/node': 16.11.19 '@types/request': 2.48.8 '@types/semver': 7.3.9 '@types/supertest': 2.0.11 @@ -78,7 +78,7 @@ importers: kleur: 3.0.3 lint-staged: 11.2.6 nock: 12.0.3 - node-fetch: 3.0.0-beta.6-exportfix + node-fetch: cjs nodemon: 2.0.15 npm-run-all: 4.1.5 prettier: 2.3.2 @@ -130,7 +130,7 @@ importers: '@types/lodash': 4.14.178 '@types/mime': 2.0.3 '@types/minimatch': 3.0.5 - '@types/node': 14.6.0 + '@types/node': 16.11.19 '@types/request': 2.48.8 '@types/semver': 7.3.9 '@types/supertest': 2.0.11 @@ -168,14 +168,14 @@ importers: kleur: 3.0.3 lint-staged: 11.2.6 nock: 12.0.3 - node-fetch: 3.0.0-beta.6-exportfix + node-fetch: 2.6.6 nodemon: 2.0.15 npm-run-all: 4.1.5 prettier: 2.3.2 rimraf: 3.0.2 selfsigned: 1.10.11 supertest: 6.1.6 - ts-node: 10.4.0_6e8cc8d02ca17e0a40f714472b01e9ea + ts-node: 10.4.0_c0a8ca172db2ce87bc71f1a1cb132fc8 typescript: 4.5.4 update-ts-references: 2.4.1_typescript@4.5.4 verdaccio: 5.4.0 @@ -283,7 +283,7 @@ importers: kleur: 3.0.3 semver: 7.3.5 devDependencies: - ts-node: 10.4.0_6e8cc8d02ca17e0a40f714472b01e9ea + ts-node: 10.4.0_c0a8ca172db2ce87bc71f1a1cb132fc8 packages/config: specifiers: @@ -415,10 +415,10 @@ importers: packages/core/types: specifiers: - '@types/node': 14.6.0 + '@types/node': 16.11.19 tsd: 0.19.1 devDependencies: - '@types/node': 14.6.0 + '@types/node': 16.11.19 tsd: 0.19.1 packages/core/url: @@ -587,13 +587,13 @@ importers: express: 4.17.2 https-proxy-agent: 5.0.0 nock: 12.0.3 - node-fetch: 3.0.0-beta.6-exportfix + node-fetch: cjs supertest: 6.1.6 dependencies: body-parser: 1.19.1 express: 4.17.2 https-proxy-agent: 5.0.0 - node-fetch: 3.0.0-beta.6-exportfix + node-fetch: 2.6.6 devDependencies: '@verdaccio/types': link:../../core/types nock: 12.0.3 @@ -1066,7 +1066,7 @@ importers: autocannon: 7.5.1 clipanion: 3.1.0 get-port: 5.1.1 - node-fetch: 3.0.0-beta.6-exportfix + node-fetch: cjs semver: 7.3.5 temp-dir: 2.0.0 ts-node: 10.4.0 @@ -1077,8 +1077,8 @@ importers: temp-dir: 2.0.0 devDependencies: autocannon: 7.5.1 - node-fetch: 3.0.0-beta.6-exportfix - ts-node: 10.4.0_6e8cc8d02ca17e0a40f714472b01e9ea + node-fetch: 2.6.6 + ts-node: 10.4.0_c0a8ca172db2ce87bc71f1a1cb132fc8 packages/tools/docusaurus-plugin-contributors: specifiers: @@ -8340,7 +8340,7 @@ packages: /@types/autocannon/4.1.1: resolution: {integrity: sha512-VMwPSP6i6SWrSbF2CrjXy/UTt9dU6oJMwDudUVjoAyUqK6YgK5llES84leqyM324Gr1nhuJhDpenvgYYdWF4gQ==} dependencies: - '@types/node': 15.12.4 + '@types/node': 16.11.19 dev: true /@types/babel__core/7.1.14: @@ -8588,10 +8588,6 @@ packages: resolution: {integrity: sha512-e6ZowgGJmTuXa3GyaPbTGxX17tnThl2aSSizrFthQ7m9uLGZBXiGhgE55cjRZTF5kjZvYn9EOPOMljdjwbflxw==} dev: true - /@types/node/14.6.0: - resolution: {integrity: sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==} - dev: true - /@types/node/15.12.4: resolution: {integrity: sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==} @@ -8602,6 +8598,7 @@ packages: /@types/node/16.11.17: resolution: {integrity: sha512-C1vTZME8cFo8uxY2ui41xcynEotVkczIVI5AjLmy5pkpBv/FtG+jhtOlfcPysI8VRVwoOMv6NJm44LGnoMSWkw==} dev: true + optional: true /@types/node/16.11.19: resolution: {integrity: sha512-BPAcfDPoHlRQNKktbsbnpACGdypPFBuX4xQlsWDE7B8XXcfII+SpOLay3/qZmCLb39kV5S1RTYwXdkx2lwLYng==} @@ -8736,7 +8733,7 @@ packages: resolution: {integrity: sha512-whjk1EDJPcAR2kYHRbFl/lKeeKYTi05A15K9bnLInCVroNDCtXce57xKdI0/rQaA3K+6q0eFyUBPmqfSndUZdQ==} dependencies: '@types/caseless': 0.12.2 - '@types/node': 16.11.17 + '@types/node': 16.11.19 '@types/tough-cookie': 4.0.0 form-data: 2.5.1 dev: true @@ -8829,7 +8826,7 @@ packages: /@types/webpack/5.28.0: resolution: {integrity: sha512-8cP0CzcxUiFuA9xGJkfeVpqmWTk9nx6CWwamRGCj95ph1SmlRRk9KlCZ6avhCbZd4L68LvYT6l1kpdEnQXrF8w==} dependencies: - '@types/node': 15.12.4 + '@types/node': 16.11.19 tapable: 2.2.0 webpack: 5.52.0 transitivePeerDependencies: @@ -12088,10 +12085,6 @@ packages: dependencies: assert-plus: 1.0.0 - /data-uri-to-buffer/3.0.1: - resolution: {integrity: sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==} - engines: {node: '>= 6'} - /data-urls/1.1.0: resolution: {integrity: sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==} dependencies: @@ -13988,10 +13981,6 @@ packages: xml-js: 1.6.11 dev: false - /fetch-blob/1.0.6: - resolution: {integrity: sha512-XTotUY7hVtqdbHE0Ilm/u/nnXRv1T8nepxhMHzB885O0EkVvI05UlZq7rHQSd6hVDCNAGx4HTjbJO60Onjfckw==} - engines: {node: '>=6'} - /figures/3.2.0: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} @@ -16128,7 +16117,7 @@ packages: micromatch: 4.0.4 pretty-format: 27.4.6 slash: 3.0.0 - ts-node: 10.4.0_6e8cc8d02ca17e0a40f714472b01e9ea + ts-node: 10.4.0_c0a8ca172db2ce87bc71f1a1cb132fc8 transitivePeerDependencies: - bufferutil - canvas @@ -18079,13 +18068,6 @@ packages: dependencies: whatwg-url: 5.0.0 - /node-fetch/3.0.0-beta.6-exportfix: - resolution: {integrity: sha512-jhW2arLPAddi7q04JxlQtApqMQF8GxlGZV+wj5/WuDz3hpDTnAU9haJ5Fi2a0N3b4e728O4EIVACNq9nDCzLYw==} - engines: {node: '>=10.16'} - dependencies: - data-uri-to-buffer: 3.0.1 - fetch-blob: 1.0.6 - /node-forge/0.10.0: resolution: {integrity: sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==} engines: {node: '>= 6.0.0'} @@ -22977,36 +22959,6 @@ packages: resolution: {integrity: sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w==} dev: false - /ts-node/10.4.0_6e8cc8d02ca17e0a40f714472b01e9ea: - resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.7.0 - '@tsconfig/node10': 1.0.7 - '@tsconfig/node12': 1.0.7 - '@tsconfig/node14': 1.0.0 - '@tsconfig/node16': 1.0.2 - '@types/node': 14.6.0 - acorn: 8.4.1 - acorn-walk: 8.1.1 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 4.5.4 - yn: 3.1.1 - dev: true - /ts-node/10.4.0_c0a8ca172db2ce87bc71f1a1cb132fc8: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true