0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

feat: upgrade plugin htpassw major (#3712)

Replaces default auth plugin verdaccio-htpasswd@10.x by verdaccio-htpasswd@11.x which is being used in verdaccio 6.x (almost identical)
Apply backward compabiity
Reduces maintenance (monorepo plugin can be removed)
One more step to switch v6.x
Add Node.js 12 GH Action for check backward compatibility
This commit is contained in:
Juan Picado 2023-04-22 11:08:59 +02:00 committed by GitHub
parent b3ea8162ac
commit e939ca24af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 378 additions and 110 deletions

View file

@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: 'Use Node.js 12.x'
- name: 'Use Node.js 16.x'
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 12.x
node-version: 16.x
- name: Install Dependencies
run: yarn install
- name: 'Run verdaccio in the background'
@ -30,7 +30,7 @@ jobs:
run: |
source scripts/e2e-setup-ci.sh
yarn init --yes
yarn add jest@26.0.0 --registry http://localhost:4873
yarn add jest@29.5.0 --registry http://localhost:4873
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
yarn jest pass.test.js
@ -45,10 +45,10 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: 'Use Node.js 12.x'
- name: 'Use Node.js 16.x'
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 12.x
node-version: 16.x
- name: Install Dependencies
run: yarn install
- name: 'Run verdaccio in the background'
@ -64,7 +64,7 @@ jobs:
yarn set version berry
yarn config set npmRegistryServer "http://localhost:4873"
yarn config set unsafeHttpWhitelist --json '["localhost"]'
yarn add jest@26.0.0
yarn add jest@29.5.0
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
yarn jest pass.test.js
@ -79,10 +79,10 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: 'Use Node.js 12.x'
- name: 'Use Node.js 16.x'
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 12.x
node-version: 16.x
- name: 'install latest npm'
run: npm i -g npm@latest-6
- name: Install Dependencies
@ -97,7 +97,7 @@ jobs:
run: |
source scripts/e2e-setup-ci.sh
npm init --force
npm install jest@26.0.0 --registry http://localhost:4873
npm install jest@29.5.0 --registry http://localhost:4873
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
yarn jest pass.test.js
@ -112,10 +112,10 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: 'Use Node.js 12.x'
- name: 'Use Node.js 16.x'
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 12.x
node-version: 16.x
- name: 'install latest npm'
run: npm i -g npm@next-8
- name: Install Dependencies
@ -130,7 +130,7 @@ jobs:
run: |
source scripts/e2e-setup-ci.sh
npm init --force
npm install jest@26.0.0 --registry http://localhost:4873
npm install jest@29.5.0 --registry http://localhost:4873
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
yarn jest pass.test.js
@ -179,10 +179,10 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: 'Use Node.js 12.x'
- name: 'Use Node.js 16.x'
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 12.x
node-version: 16.x
- name: 'install latest pnpm'
run: npm i -g pnpm@latest-6
- name: Install Dependencies
@ -197,7 +197,7 @@ jobs:
run: |
source scripts/e2e-setup-ci.sh
pnpm init --force
pnpm install jest@26.0.0 --registry http://localhost:4873
pnpm install jest@29.5.0 --registry http://localhost:4873
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
yarn jest pass.test.js
@ -212,7 +212,7 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: 'Use Node.js 12.x'
- name: 'Use Node.js 16.x'
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 16.x
@ -230,7 +230,7 @@ jobs:
run: |
source scripts/e2e-setup-ci.sh
pnpm init
pnpm install jest@26.0.0 --registry http://localhost:4873
pnpm install jest@29.5.0 --registry http://localhost:4873
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
yarn jest pass.test.js

View file

@ -0,0 +1,41 @@
name: Module Smoke Test Node.js 12
on:
workflow_dispatch:
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: Use Node (latest)
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # tag=v2.5.1
with:
node-version: 12
- name: Docker test
run: |
docker run -d -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio:5
- name: login
run: npx npm-cli-login -u test -p 1234 -e test@domain.test -r http://localhost:4873
- name: Build
run: yarn build
- name: Types
run: yarn code:types
- name: Bump up package
run: npm version prerelease --no-git-tag-version --preid $(date +%s%N)
- name: publish verdaccio
run: npm publish --registry http://localhost:4873
- name: install verdaccio
run: npm i -g verdaccio --loglevel info --registry http://localhost:4873
- name: verdaccio version
run: verdaccio --version
- name: 'Running the integration test'
run: |
source scripts/e2e-setup-ci.sh
npm init --force
npm install jest@27.5.1 --registry http://localhost:4873
npm install verdaccio --registry http://localhost:4873
echo "test('require module should works', () => { const {runServer} = require('verdaccio') });" | tee module.spec.js
cat module.spec.js
yarn jest

View file

@ -2,7 +2,6 @@ name: Module Smoke Test 5.x
on:
workflow_dispatch:
pull_request:
push:
permissions:
contents: read
jobs:

158
.pnp.cjs generated
View file

@ -68,18 +68,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@typescript-eslint/eslint-plugin", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:5.59.0"],\
["@typescript-eslint/parser", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:5.59.0"],\
["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\
["@verdaccio/config", "npm:6.0.0-6-next.67"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/config", "npm:6.0.0-6-next.68"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/local-storage", "npm:10.3.3"],\
["@verdaccio/logger-7", "npm:6.0.0-6-next.12"],\
["@verdaccio/middleware", "npm:6.0.0-6-next.46"],\
["@verdaccio/logger-7", "npm:6.0.0-6-next.13"],\
["@verdaccio/middleware", "npm:6.0.0-6-next.47"],\
["@verdaccio/signature", "npm:6.0.0-6-next.2"],\
["@verdaccio/streams", "npm:10.2.1"],\
["@verdaccio/tarball", "npm:11.0.0-6-next.36"],\
["@verdaccio/tarball", "npm:11.0.0-6-next.37"],\
["@verdaccio/types", "npm:11.0.0-6-next.25"],\
["@verdaccio/ui-theme", "npm:6.0.0-6-next.67"],\
["@verdaccio/url", "npm:11.0.0-6-next.33"],\
["@verdaccio/utils", "npm:6.0.0-6-next.35"],\
["@verdaccio/ui-theme", "npm:6.0.0-6-next.68"],\
["@verdaccio/url", "npm:11.0.0-6-next.34"],\
["@verdaccio/utils", "npm:6.0.0-6-next.36"],\
["JSONStream", "npm:1.3.5"],\
["async", "npm:3.2.4"],\
["babel-eslint", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:10.1.0"],\
@ -137,9 +137,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["ts-node", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:10.9.1"],\
["typescript", "patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=23ec76"],\
["validator", "npm:13.9.0"],\
["verdaccio-audit", "npm:11.0.0-6-next.30"],\
["verdaccio-audit", "npm:11.0.0-6-next.31"],\
["verdaccio-auth-memory", "npm:10.2.2"],\
["verdaccio-htpasswd", "npm:10.5.5"],\
["verdaccio-htpasswd", "npm:11.0.0-6-next.38"],\
["verdaccio-memory", "npm:10.3.2"]\
],\
"linkType": "SOFT"\
@ -5120,12 +5120,12 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/config", [\
["npm:6.0.0-6-next.67", {\
"packageLocation": "./.yarn/cache/@verdaccio-config-npm-6.0.0-6-next.67-6558a1c7e5-822fd5d63d.zip/node_modules/@verdaccio/config/",\
["npm:6.0.0-6-next.68", {\
"packageLocation": "./.yarn/cache/@verdaccio-config-npm-6.0.0-6-next.68-7334112725-aa527a6f4a.zip/node_modules/@verdaccio/config/",\
"packageDependencies": [\
["@verdaccio/config", "npm:6.0.0-6-next.67"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/utils", "npm:6.0.0-6-next.35"],\
["@verdaccio/config", "npm:6.0.0-6-next.68"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/utils", "npm:6.0.0-6-next.36"],\
["debug", "virtual:29474417206615456729b7a578bf418b358d5457cdcef4bbfee11068b4718e28ceca45b525022e3820e15bd79419301ec7f358c2f28eae1e78ba4bae24d15383#npm:4.3.4"],\
["js-yaml", "npm:4.1.0"],\
["lodash", "npm:4.17.21"],\
@ -5136,10 +5136,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/core", [\
["npm:6.0.0-6-next.67", {\
"packageLocation": "./.yarn/cache/@verdaccio-core-npm-6.0.0-6-next.67-982000a47a-c039318870.zip/node_modules/@verdaccio/core/",\
["npm:6.0.0-6-next.68", {\
"packageLocation": "./.yarn/cache/@verdaccio-core-npm-6.0.0-6-next.68-f3485a7c2a-cbc581d047.zip/node_modules/@verdaccio/core/",\
"packageDependencies": [\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["ajv", "npm:8.11.2"],\
["core-js", "npm:3.28.0"],\
["http-errors", "npm:1.8.1"],\
@ -5158,6 +5158,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["lockfile", "npm:1.0.4"]\
],\
"linkType": "HARD"\
}],\
["npm:11.0.0-6-next.7", {\
"packageLocation": "./.yarn/cache/@verdaccio-file-locking-npm-11.0.0-6-next.7-b6bd1d57fa-86cf13ab75.zip/node_modules/@verdaccio/file-locking/",\
"packageDependencies": [\
["@verdaccio/file-locking", "npm:11.0.0-6-next.7"],\
["lockfile", "npm:1.0.4"]\
],\
"linkType": "HARD"\
}]\
]],\
["@verdaccio/local-storage", [\
@ -5178,22 +5186,22 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/logger-7", [\
["npm:6.0.0-6-next.12", {\
"packageLocation": "./.yarn/cache/@verdaccio-logger-7-npm-6.0.0-6-next.12-1a78df2245-3585b19083.zip/node_modules/@verdaccio/logger-7/",\
["npm:6.0.0-6-next.13", {\
"packageLocation": "./.yarn/cache/@verdaccio-logger-7-npm-6.0.0-6-next.13-f831a911ae-718cb0b289.zip/node_modules/@verdaccio/logger-7/",\
"packageDependencies": [\
["@verdaccio/logger-7", "npm:6.0.0-6-next.12"],\
["@verdaccio/logger-commons", "npm:6.0.0-6-next.35"],\
["@verdaccio/logger-7", "npm:6.0.0-6-next.13"],\
["@verdaccio/logger-commons", "npm:6.0.0-6-next.36"],\
["pino", "npm:7.11.0"]\
],\
"linkType": "HARD"\
}]\
]],\
["@verdaccio/logger-commons", [\
["npm:6.0.0-6-next.35", {\
"packageLocation": "./.yarn/cache/@verdaccio-logger-commons-npm-6.0.0-6-next.35-a2c2cd0eaf-1726111f2b.zip/node_modules/@verdaccio/logger-commons/",\
["npm:6.0.0-6-next.36", {\
"packageLocation": "./.yarn/cache/@verdaccio-logger-commons-npm-6.0.0-6-next.36-b211171bd3-85947d9598.zip/node_modules/@verdaccio/logger-commons/",\
"packageDependencies": [\
["@verdaccio/logger-commons", "npm:6.0.0-6-next.35"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/logger-commons", "npm:6.0.0-6-next.36"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/logger-prettify", "npm:6.0.0-6-next.9"],\
["colorette", "npm:2.0.19"],\
["debug", "virtual:29474417206615456729b7a578bf418b358d5457cdcef4bbfee11068b4718e28ceca45b525022e3820e15bd79419301ec7f358c2f28eae1e78ba4bae24d15383#npm:4.3.4"]\
@ -5216,14 +5224,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/middleware", [\
["npm:6.0.0-6-next.46", {\
"packageLocation": "./.yarn/cache/@verdaccio-middleware-npm-6.0.0-6-next.46-18be481d80-a53154f3b5.zip/node_modules/@verdaccio/middleware/",\
["npm:6.0.0-6-next.47", {\
"packageLocation": "./.yarn/cache/@verdaccio-middleware-npm-6.0.0-6-next.47-767adadf8b-a14a997ef3.zip/node_modules/@verdaccio/middleware/",\
"packageDependencies": [\
["@verdaccio/middleware", "npm:6.0.0-6-next.46"],\
["@verdaccio/config", "npm:6.0.0-6-next.67"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/url", "npm:11.0.0-6-next.33"],\
["@verdaccio/utils", "npm:6.0.0-6-next.35"],\
["@verdaccio/middleware", "npm:6.0.0-6-next.47"],\
["@verdaccio/config", "npm:6.0.0-6-next.68"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/url", "npm:11.0.0-6-next.34"],\
["@verdaccio/utils", "npm:6.0.0-6-next.36"],\
["debug", "virtual:29474417206615456729b7a578bf418b358d5457cdcef4bbfee11068b4718e28ceca45b525022e3820e15bd79419301ec7f358c2f28eae1e78ba4bae24d15383#npm:4.3.4"],\
["express", "npm:4.18.2"],\
["express-rate-limit", "npm:5.5.1"],\
@ -5256,13 +5264,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/tarball", [\
["npm:11.0.0-6-next.36", {\
"packageLocation": "./.yarn/cache/@verdaccio-tarball-npm-11.0.0-6-next.36-06d2d9ff39-857d74fbb1.zip/node_modules/@verdaccio/tarball/",\
["npm:11.0.0-6-next.37", {\
"packageLocation": "./.yarn/cache/@verdaccio-tarball-npm-11.0.0-6-next.37-dc849ead2d-c400432a17.zip/node_modules/@verdaccio/tarball/",\
"packageDependencies": [\
["@verdaccio/tarball", "npm:11.0.0-6-next.36"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/url", "npm:11.0.0-6-next.33"],\
["@verdaccio/utils", "npm:6.0.0-6-next.35"],\
["@verdaccio/tarball", "npm:11.0.0-6-next.37"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/url", "npm:11.0.0-6-next.34"],\
["@verdaccio/utils", "npm:6.0.0-6-next.36"],\
["debug", "virtual:29474417206615456729b7a578bf418b358d5457cdcef4bbfee11068b4718e28ceca45b525022e3820e15bd79419301ec7f358c2f28eae1e78ba4bae24d15383#npm:4.3.4"],\
["lodash", "npm:4.17.21"]\
],\
@ -5279,20 +5287,20 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/ui-theme", [\
["npm:6.0.0-6-next.67", {\
"packageLocation": "./.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.67-b1aee354b9-5e6a8deca7.zip/node_modules/@verdaccio/ui-theme/",\
["npm:6.0.0-6-next.68", {\
"packageLocation": "./.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.68-99120e3a98-1f8f361cf7.zip/node_modules/@verdaccio/ui-theme/",\
"packageDependencies": [\
["@verdaccio/ui-theme", "npm:6.0.0-6-next.67"]\
["@verdaccio/ui-theme", "npm:6.0.0-6-next.68"]\
],\
"linkType": "HARD"\
}]\
]],\
["@verdaccio/url", [\
["npm:11.0.0-6-next.33", {\
"packageLocation": "./.yarn/cache/@verdaccio-url-npm-11.0.0-6-next.33-64ed74304b-e138638e0f.zip/node_modules/@verdaccio/url/",\
["npm:11.0.0-6-next.34", {\
"packageLocation": "./.yarn/cache/@verdaccio-url-npm-11.0.0-6-next.34-003548794d-63adf681d8.zip/node_modules/@verdaccio/url/",\
"packageDependencies": [\
["@verdaccio/url", "npm:11.0.0-6-next.33"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/url", "npm:11.0.0-6-next.34"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["debug", "virtual:29474417206615456729b7a578bf418b358d5457cdcef4bbfee11068b4718e28ceca45b525022e3820e15bd79419301ec7f358c2f28eae1e78ba4bae24d15383#npm:4.3.4"],\
["lodash", "npm:4.17.21"],\
["validator", "npm:13.9.0"]\
@ -5301,11 +5309,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["@verdaccio/utils", [\
["npm:6.0.0-6-next.35", {\
"packageLocation": "./.yarn/cache/@verdaccio-utils-npm-6.0.0-6-next.35-5c76e3b578-97f04effaf.zip/node_modules/@verdaccio/utils/",\
["npm:6.0.0-6-next.36", {\
"packageLocation": "./.yarn/cache/@verdaccio-utils-npm-6.0.0-6-next.36-931feacba5-d6dbd7b476.zip/node_modules/@verdaccio/utils/",\
"packageDependencies": [\
["@verdaccio/utils", "npm:6.0.0-6-next.35"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/utils", "npm:6.0.0-6-next.36"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["lodash", "npm:4.17.21"],\
["minimatch", "npm:3.1.2"],\
["semver", "npm:7.3.8"]\
@ -11301,10 +11309,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
],\
"linkType": "HARD"\
}],\
["virtual:2c0413d013d95d792b4734fb5ba2b862c449db8f59693f269cdf9e3bf579fb5c5441b1fba98d8e06ba2937e2a5a71c997d9ebf245147018bc6b0d9897ab45083#npm:2.6.7", {\
"packageLocation": "./.yarn/__virtual__/node-fetch-virtual-c70b7cc8e9/0/cache/node-fetch-npm-2.6.7-777aa2a6df-8d816ffd1e.zip/node_modules/node-fetch/",\
["virtual:5b1ec82c597946a9cab5ff6462dd0319f4bddb816fb07702ea903ea5c4f6162c956ee44edcb7dd9eaa765aae33b49fd5eca0a4dfc2b9d28782e9e3491afbc9e7#npm:2.6.7", {\
"packageLocation": "./.yarn/__virtual__/node-fetch-virtual-74c984840a/0/cache/node-fetch-npm-2.6.7-777aa2a6df-8d816ffd1e.zip/node_modules/node-fetch/",\
"packageDependencies": [\
["node-fetch", "virtual:2c0413d013d95d792b4734fb5ba2b862c449db8f59693f269cdf9e3bf579fb5c5441b1fba98d8e06ba2937e2a5a71c997d9ebf245147018bc6b0d9897ab45083#npm:2.6.7"],\
["node-fetch", "virtual:5b1ec82c597946a9cab5ff6462dd0319f4bddb816fb07702ea903ea5c4f6162c956ee44edcb7dd9eaa765aae33b49fd5eca0a4dfc2b9d28782e9e3491afbc9e7#npm:2.6.7"],\
["@types/encoding", null],\
["encoding", null],\
["whatwg-url", "npm:5.0.0"]\
@ -13989,18 +13997,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@typescript-eslint/eslint-plugin", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:5.59.0"],\
["@typescript-eslint/parser", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:5.59.0"],\
["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\
["@verdaccio/config", "npm:6.0.0-6-next.67"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["@verdaccio/config", "npm:6.0.0-6-next.68"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/local-storage", "npm:10.3.3"],\
["@verdaccio/logger-7", "npm:6.0.0-6-next.12"],\
["@verdaccio/middleware", "npm:6.0.0-6-next.46"],\
["@verdaccio/logger-7", "npm:6.0.0-6-next.13"],\
["@verdaccio/middleware", "npm:6.0.0-6-next.47"],\
["@verdaccio/signature", "npm:6.0.0-6-next.2"],\
["@verdaccio/streams", "npm:10.2.1"],\
["@verdaccio/tarball", "npm:11.0.0-6-next.36"],\
["@verdaccio/tarball", "npm:11.0.0-6-next.37"],\
["@verdaccio/types", "npm:11.0.0-6-next.25"],\
["@verdaccio/ui-theme", "npm:6.0.0-6-next.67"],\
["@verdaccio/url", "npm:11.0.0-6-next.33"],\
["@verdaccio/utils", "npm:6.0.0-6-next.35"],\
["@verdaccio/ui-theme", "npm:6.0.0-6-next.68"],\
["@verdaccio/url", "npm:11.0.0-6-next.34"],\
["@verdaccio/utils", "npm:6.0.0-6-next.36"],\
["JSONStream", "npm:1.3.5"],\
["async", "npm:3.2.4"],\
["babel-eslint", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:10.1.0"],\
@ -14058,24 +14066,24 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["ts-node", "virtual:7f7b3df50ee4b7b1719ad19fad11505dc2788f3227a7e5cc9ca19f71d8cb309c9d33b532ea2b2b60ab65abf6cc12153df4643c5e6e17d01ea0ae0492723bb4b4#npm:10.9.1"],\
["typescript", "patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=23ec76"],\
["validator", "npm:13.9.0"],\
["verdaccio-audit", "npm:11.0.0-6-next.30"],\
["verdaccio-audit", "npm:11.0.0-6-next.31"],\
["verdaccio-auth-memory", "npm:10.2.2"],\
["verdaccio-htpasswd", "npm:10.5.5"],\
["verdaccio-htpasswd", "npm:11.0.0-6-next.38"],\
["verdaccio-memory", "npm:10.3.2"]\
],\
"linkType": "SOFT"\
}]\
]],\
["verdaccio-audit", [\
["npm:11.0.0-6-next.30", {\
"packageLocation": "./.yarn/cache/verdaccio-audit-npm-11.0.0-6-next.30-2c0413d013-3cfd734653.zip/node_modules/verdaccio-audit/",\
["npm:11.0.0-6-next.31", {\
"packageLocation": "./.yarn/cache/verdaccio-audit-npm-11.0.0-6-next.31-5b1ec82c59-f5a2afb2ba.zip/node_modules/verdaccio-audit/",\
"packageDependencies": [\
["verdaccio-audit", "npm:11.0.0-6-next.30"],\
["@verdaccio/config", "npm:6.0.0-6-next.67"],\
["@verdaccio/core", "npm:6.0.0-6-next.67"],\
["verdaccio-audit", "npm:11.0.0-6-next.31"],\
["@verdaccio/config", "npm:6.0.0-6-next.68"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["express", "npm:4.18.2"],\
["https-proxy-agent", "npm:5.0.1"],\
["node-fetch", "virtual:2c0413d013d95d792b4734fb5ba2b862c449db8f59693f269cdf9e3bf579fb5c5441b1fba98d8e06ba2937e2a5a71c997d9ebf245147018bc6b0d9897ab45083#npm:2.6.7"]\
["node-fetch", "virtual:5b1ec82c597946a9cab5ff6462dd0319f4bddb816fb07702ea903ea5c4f6162c956ee44edcb7dd9eaa765aae33b49fd5eca0a4dfc2b9d28782e9e3491afbc9e7#npm:2.6.7"]\
],\
"linkType": "HARD"\
}]\
@ -14091,15 +14099,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["verdaccio-htpasswd", [\
["npm:10.5.5", {\
"packageLocation": "./.yarn/cache/verdaccio-htpasswd-npm-10.5.5-51ff9070b2-1a5706af72.zip/node_modules/verdaccio-htpasswd/",\
["npm:11.0.0-6-next.38", {\
"packageLocation": "./.yarn/cache/verdaccio-htpasswd-npm-11.0.0-6-next.38-5ceb09d742-eb633f15ad.zip/node_modules/verdaccio-htpasswd/",\
"packageDependencies": [\
["verdaccio-htpasswd", "npm:10.5.5"],\
["@verdaccio/file-locking", "npm:10.3.1"],\
["verdaccio-htpasswd", "npm:11.0.0-6-next.38"],\
["@verdaccio/core", "npm:6.0.0-6-next.68"],\
["@verdaccio/file-locking", "npm:11.0.0-6-next.7"],\
["apache-md5", "npm:1.1.8"],\
["bcryptjs", "npm:2.4.3"],\
["core-js", "npm:3.28.0"],\
["debug", "virtual:29474417206615456729b7a578bf418b358d5457cdcef4bbfee11068b4718e28ceca45b525022e3820e15bd79419301ec7f358c2f28eae1e78ba4bae24d15383#npm:4.3.4"],\
["http-errors", "npm:2.0.0"],\
["http-errors", "npm:1.8.1"],\
["unix-crypt-td-js", "npm:1.1.4"]\
],\
"linkType": "HARD"\

View file

@ -19,17 +19,17 @@
"url": "https://opencollective.com/verdaccio"
},
"dependencies": {
"@verdaccio/config": "6.0.0-6-next.67",
"@verdaccio/core": "6.0.0-6-next.67",
"@verdaccio/config": "6.0.0-6-next.68",
"@verdaccio/core": "6.0.0-6-next.68",
"@verdaccio/local-storage": "10.3.3",
"@verdaccio/logger-7": "6.0.0-6-next.12",
"@verdaccio/middleware": "6.0.0-6-next.46",
"@verdaccio/logger-7": "6.0.0-6-next.13",
"@verdaccio/middleware": "6.0.0-6-next.47",
"@verdaccio/signature": "6.0.0-6-next.2",
"@verdaccio/streams": "10.2.1",
"@verdaccio/tarball": "11.0.0-6-next.36",
"@verdaccio/ui-theme": "6.0.0-6-next.67",
"@verdaccio/url": "11.0.0-6-next.33",
"@verdaccio/utils": "6.0.0-6-next.35",
"@verdaccio/tarball": "11.0.0-6-next.37",
"@verdaccio/ui-theme": "6.0.0-6-next.68",
"@verdaccio/url": "11.0.0-6-next.34",
"@verdaccio/utils": "6.0.0-6-next.36",
"JSONStream": "1.3.5",
"async": "3.2.4",
"body-parser": "1.20.2",
@ -56,8 +56,8 @@
"request": "2.88.2",
"semver": "7.5.0",
"validator": "13.9.0",
"verdaccio-audit": "11.0.0-6-next.30",
"verdaccio-htpasswd": "10.5.5"
"verdaccio-audit": "11.0.0-6-next.31",
"verdaccio-htpasswd": "11.0.0-6-next.38"
},
"devDependencies": {
"@babel/cli": "7.21.0",

View file

@ -30,4 +30,4 @@ middlewares:
audit:
enabled: true
logs: { type: stdout, format: json, level: warn }
log: { type: stdout, format: json, level: warn }

View file

@ -55,9 +55,23 @@ class Auth {
logger: this.logger,
};
let authConf = { ...config.auth };
if (authConf?.htpasswd) {
// special case for htpasswd plugin, the v6 version uses bcrypt by default
// 5.x enforces crypt to avoid breaking changes, but is highly recommended using
// bcrypt instead.
if (!authConf.htpasswd.algorithm) {
authConf.htpasswd.algorithm = 'crypt';
this.logger.info(
// eslint-disable-next-line max-len
'the "crypt" algorithm is deprecated consider switch to "bcrypt" in the configuration file. Read the documentation for additional details'
);
}
}
return loadPlugin<pluginUtils.Auth<Config>>(
config,
config.auth,
authConf,
pluginOptions,
(plugin: pluginUtils.Auth<Config>): boolean => {
const { authenticate, allow_access, allow_publish } = plugin;

View file

@ -363,7 +363,7 @@ class ProxyStorage {
private _setHeaderAuthorization(headers: any, type: string, token: any): void {
const _type: string = type.toLowerCase();
if (_type !== TOKEN_BEARER.toLowerCase() && _type !== TOKEN_BASIC.toLowerCase()) {
if ([TOKEN_BEARER.toLowerCase(), TOKEN_BASIC.toLowerCase()].includes(_type) === false) {
this._throwErrorAuth(`Auth type '${_type}' not allowed`);
}

View file

@ -25,6 +25,7 @@ export async function initializeServer(
// to avoid conflics
// FUTURE: self_path is configPath in v6
config.self_path = config.storage;
config.configPath = config.storage;
debug('storage: %s', config.storage);
const storage = new Storage(config);
await storage.init(config, []);

View file

@ -1,3 +1,4 @@
import nock from 'nock';
import supertest from 'supertest';
import { API_ERROR, HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core';
@ -10,9 +11,14 @@ const FORBIDDEN_VUE = 'authorization required to access package vue';
jest.setTimeout(20000);
describe('token', () => {
beforeEach(() => {
nock.cleanAll();
});
describe('basics', () => {
const FAKE_TOKEN: string = buildToken(TOKEN_BEARER, 'fake');
test.each([['user.yaml'], ['user.jwt.yaml']])('should test add a new user', async (conf) => {
nock('https://registry.verdaccio.org/').get(`/vue`).once().reply(200, { name: 'vue' });
const app = await initializeServer(conf);
const credentials = { name: 'JotaJWT', password: 'secretPass' };
const response = await createUser(app, credentials.name, credentials.password);

View file

@ -1,9 +1,16 @@
import _ from 'lodash';
import nock from 'nock';
import { Config, UpLinkConf } from '@verdaccio/types';
import AppConfig from '../../../../src/lib/config';
import { API_ERROR, HTTP_STATUS } from '../../../../src/lib/constants';
import {
API_ERROR,
ERROR_CODE,
HTTP_STATUS,
TOKEN_BASIC,
TOKEN_BEARER,
} from '../../../../src/lib/constants';
import { setup } from '../../../../src/lib/logger';
import ProxyStorage from '../../../../src/lib/up-storage';
import { DOMAIN_SERVERS } from '../../../functional/config.functional';
@ -28,6 +35,10 @@ describe('UpStorage', () => {
mockRegistry = await mockServer(mockServerPort).init();
});
beforeEach(() => {
nock.cleanAll();
});
afterAll(function (done) {
mockRegistry[0].stop();
done();
@ -39,7 +50,19 @@ describe('UpStorage', () => {
expect(proxy).toBeDefined();
});
describe('UpStorage::getRemoteMetadata', () => {
describe('getRemoteMetadata', () => {
beforeEach(() => {
// @ts-ignore
process.env.TOKEN_TEST_ENV = 'foo';
// @ts-ignore
process.env.NPM_TOKEN = 'foo';
});
afterEach(() => {
delete process.env.TOKEN_TEST_ENV;
delete process.env.NPM_TOKEN;
});
test('should be get remote metadata', (done) => {
const proxy = generateProxy();
@ -51,6 +74,28 @@ describe('UpStorage', () => {
});
});
test('should handle 404 on be get remote metadata', (done) => {
nock('http://localhost:55547').get(`/jquery`).once().reply(404, { name: 'jquery' });
const proxy = generateProxy();
proxy.getRemoteMetadata('jquery', {}, (err) => {
expect(err).not.toBeNull();
expect(err.message).toMatch(/package does not exist on uplink/);
done();
});
});
test('should handle 500 on be get remote metadata', (done) => {
nock('http://localhost:55547').get(`/jquery`).once().reply(500, { name: 'jquery' });
const proxy = generateProxy();
proxy.getRemoteMetadata('jquery', {}, (err) => {
expect(err).not.toBeNull();
expect(err.message).toMatch(/bad status code: 500/);
done();
});
});
test('should be get remote metadata with etag', (done) => {
const proxy = generateProxy();
@ -74,6 +119,7 @@ describe('UpStorage', () => {
});
test('should be get remote metadata with json when uplink is npmmirror', (done) => {
nock('https://registry.npmmirror.com').get(`/jquery`).reply(200, { name: 'jquery' });
const proxy = generateProxy({ url: 'https://registry.npmmirror.com' });
proxy.getRemoteMetadata('jquery', { json: true }, (err, data) => {
@ -82,10 +128,161 @@ describe('UpStorage', () => {
done();
});
});
test('should be get remote metadata with auth header bearer', (done) => {
nock('https://registry.npmmirror.com', {
reqheaders: {
authorization: 'Bearer foo',
},
})
.get(`/jquery`)
.reply(200, { name: 'jquery' });
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BEARER,
token: 'foo',
},
});
proxy.getRemoteMetadata('jquery', {}, (err, data, etag) => {
expect(err).toBeNull();
// expect(_.isString(etag)).toBeTruthy();
expect(data.name).toBe('jquery');
done();
});
});
test('should be get remote metadata with auth node env TOKEN_TEST_ENV header bearer', (done) => {
nock('https://registry.npmmirror.com', {
reqheaders: {
authorization: 'Bearer foo',
},
})
.get(`/jquery`)
.reply(200, { name: 'jquery' });
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BEARER,
token_env: 'TOKEN_TEST_ENV',
},
});
proxy.getRemoteMetadata('jquery', {}, (err, data, etag) => {
expect(err).toBeNull();
expect(data.name).toBe('jquery');
done();
});
});
test('should be get remote metadata with auth node env NPM_TOKEN header bearer', (done) => {
nock('https://registry.npmmirror.com', {
reqheaders: {
authorization: 'Bearer foo',
},
})
.get(`/jquery`)
.reply(200, { name: 'jquery' });
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BEARER,
token_env: true,
},
});
proxy.getRemoteMetadata('jquery', {}, (err, data, etag) => {
expect(err).toBeNull();
expect(data.name).toBe('jquery');
done();
});
});
test('should be get remote metadata with auth header basic', (done) => {
nock('https://registry.npmmirror.com', {
reqheaders: {
authorization: 'Basic foo',
},
})
.get(`/jquery`)
.reply(200, { name: 'jquery' });
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BASIC,
token: 'foo',
},
});
proxy.getRemoteMetadata('jquery', {}, (err, data, etag) => {
expect(err).toBeNull();
// expect(_.isString(etag)).toBeTruthy();
expect(data.name).toBe('jquery');
done();
});
});
});
describe('UpStorage::fetchTarball', () => {
test('should fetch a tarball from uplink', (done) => {
describe('error handling', () => {
test('should fails if auth type is missing', () => {
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BASIC,
token: undefined,
},
});
expect(function () {
proxy.getRemoteMetadata('jquery', {}, () => {});
}).toThrow(/token is required/);
});
test('should fails if token_env is undefined', () => {
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BASIC,
token_env: undefined,
},
});
expect(function () {
proxy.getRemoteMetadata('jquery', {}, () => {});
}).toThrow(ERROR_CODE.token_required);
});
test('should fails if token_env is false', () => {
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
type: TOKEN_BASIC,
token_env: false,
},
});
expect(function () {
proxy.getRemoteMetadata('jquery', {}, () => {});
}).toThrow(ERROR_CODE.token_required);
});
test.skip('should fails if invalid token type', () => {
const proxy = generateProxy({
url: 'https://registry.npmmirror.com',
auth: {
token: 'SomethingWrong',
},
});
expect(function () {
proxy.getRemoteMetadata('jquery', {}, () => {});
}).toThrow(ERROR_CODE.token_required);
});
});
describe('fetchTarball', () => {
test.skip('should fetch a tarball from uplink', (done) => {
const proxy = generateProxy();
const tarball = `http://${DOMAIN_SERVERS}:${mockServerPort}/jquery/-/jquery-1.5.1.tgz`;
const stream = proxy.fetchTarball(tarball);
@ -157,7 +354,7 @@ describe('UpStorage', () => {
}, 10000);
});
describe('UpStorage::isUplinkValid', () => {
describe('isUplinkValid', () => {
describe('valid use cases', () => {
const validateUpLink = (
url: string,

BIN
yarn.lock

Binary file not shown.