1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-20 17:05:52 +01:00

add more test proxy (#2236)

* add more test proxy

* test tarball and search

* format

* refactor uplinks
This commit is contained in:
Juan Picado 2021-05-08 19:21:21 +02:00 committed by GitHub
parent 8582548559
commit 52b47868e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1600 additions and 5307 deletions

@ -42,8 +42,8 @@
},
"devDependencies": {
"@verdaccio/types": "workspace:11.0.0-6-next.7",
"express": "^4.17.1",
"node-mocks-http": "^1.10.1"
"express": "4.17.1",
"node-mocks-http": "1.10.1"
},
"scripts": {
"clean": "rimraf ./build",

@ -46,12 +46,13 @@
"@verdaccio/streams": "workspace:11.0.0-alpha.3",
"@verdaccio/utils": "workspace:6.0.0-6-next.4",
"JSONStream": "1.3.5",
"lodash": "^4.17.20",
"lodash": "4.17.20",
"request": "2.87.0"
},
"devDependencies": {
"@verdaccio/types": "workspace:11.0.0-6-next.7",
"nock": "13.0.11"
"nock": "13.0.11",
"node-mocks-http": "1.10.1"
},
"funding": {
"type": "opencollective",

@ -1,2 +1 @@
export * from './up-storage';
export * from './uplink-util';

@ -64,7 +64,6 @@ export interface IProxy {
fail_timeout: number;
upname: string;
fetchTarball(url: string): IReadTarball;
isUplinkValid(url: string): boolean;
search(options: any);
getRemoteMetadata(name: string, options: any, callback: Callback): void;
}
@ -436,27 +435,6 @@ class ProxyStorage implements IProxy {
}
}
/**
* Determine whether can fetch from the provided URL
* @param {*} url
* @return {Boolean}
*/
public isUplinkValid(url: string): boolean {
// $FlowFixMe
const urlParsed: UrlWithStringQuery = URL.parse(url);
const isHTTPS = (urlDomainParsed: URL): boolean =>
urlDomainParsed.protocol === 'https:' &&
(urlParsed.port === null || urlParsed.port === '443');
const getHost = (urlDomainParsed): boolean =>
isHTTPS(urlDomainParsed) ? urlDomainParsed.hostname : urlDomainParsed.host;
const isMatchProtocol: boolean = urlParsed.protocol === this.url.protocol;
const isMatchHost: boolean = getHost(urlParsed) === getHost(this.url);
// @ts-ignore
const isMatchPath: boolean = urlParsed.path.indexOf(this.url.path) === 0;
return isMatchProtocol && isMatchHost && isMatchPath;
}
/**
* Get a remote package metadata
* @param {*} name package name

Binary file not shown.

@ -0,0 +1,567 @@
{
"verdaccio": {
"name": "verdaccio",
"description": "A lightweight private npm proxy registry",
"maintainers": [
"=jotadeveloper",
"=ayusharma",
"=trentearl",
"=jmwilkinson",
"=sergiohgz",
"=verdaccio.npm"
],
"url": null,
"keywords": [],
"version": "5.0.4",
"time": "2021-04-28 ",
"words": "verdaccio a lightweight private npm proxy registry =jotadeveloper =ayusharma =trentearl =jmwilkinson =sergiohgz =verdaccio.npm"
},
"verdaccio-bitbucket": {
"name": "verdaccio-bitbucket",
"description": "Verdaccio module to authenticate users via Bitbucket",
"maintainers": ["=idangozlan"],
"url": null,
"keywords": [],
"version": "3.0.1",
"time": "2020-11-17 ",
"words": "verdaccio-bitbucket verdaccio module to authenticate users via bitbucket =idangozlan"
},
"@verdaccio/streams": {
"name": "@verdaccio/streams",
"description": "Stream extension for Verdaccio",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/streams stream extension for verdaccio =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"@verdaccio/commons-api": {
"name": "@verdaccio/commons-api",
"description": "Commons API utilities for Verdaccio",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/commons-api commons api utilities for verdaccio =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-auth-bitbucket": {
"name": "verdaccio-auth-bitbucket",
"description": "Verdaccio module to authenticate users via Bitbucket",
"maintainers": ["=tomamatics"],
"url": null,
"keywords": [],
"version": "2.0.3",
"time": "2020-11-12 ",
"words": "verdaccio-auth-bitbucket verdaccio module to authenticate users via bitbucket =tomamatics"
},
"verdaccio-audit": {
"name": "verdaccio-audit",
"description": "Verdaccio Middleware plugin to bypass npmjs audit",
"maintainers": ["=jotadeveloper", "=ayusharma", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "verdaccio-audit verdaccio middleware plugin to bypass npmjs audit =jotadeveloper =ayusharma =verdaccio.npm"
},
"@verdaccio/ui-theme": {
"name": "@verdaccio/ui-theme",
"description": "Verdaccio User Interface",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "3.1.0",
"time": "2021-04-27 ",
"words": "@verdaccio/ui-theme verdaccio user interface =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"@verdaccio/local-storage": {
"name": "@verdaccio/local-storage",
"description": "Local storage implementation",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.6",
"time": "2021-05-01 ",
"words": "@verdaccio/local-storage local storage implementation =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"@verdaccio/file-locking": {
"name": "@verdaccio/file-locking",
"description": "library that handle file locking",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/file-locking library that handle file locking =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-htpasswd": {
"name": "verdaccio-htpasswd",
"description": "htpasswd auth plugin for Verdaccio",
"maintainers": ["=jotadeveloper", "=ayusharma", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "verdaccio-htpasswd htpasswd auth plugin for verdaccio =jotadeveloper =ayusharma =verdaccio.npm"
},
"verdaccio-badger": {
"name": "verdaccio-badger",
"description": "verdaccio middleware plugin to serve svg badges",
"maintainers": ["=paddek"],
"url": null,
"keywords": [],
"version": "1.0.0",
"time": "2020-08-02 ",
"words": "verdaccio-badger verdaccio middleware plugin to serve svg badges =paddek"
},
"@verdaccio/readme": {
"name": "@verdaccio/readme",
"description": "Readme markdown parser",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/readme readme markdown parser =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-dynamodb": {
"name": "verdaccio-dynamodb",
"description": "Verdaccio DynamoDB Auth Plugin",
"maintainers": ["=cwilson"],
"url": null,
"keywords": [],
"version": "1.1.8",
"time": "2020-06-24 ",
"words": "verdaccio-dynamodb verdaccio dynamodb auth plugin =cwilson"
},
"@outcome-co/verdaccio-github-auth": {
"name": "@outcome-co/verdaccio-github-auth",
"description": "Verdaccio Github Authentication Plugin",
"maintainers": ["=d-tw"],
"url": null,
"keywords": [],
"version": "2.0.9",
"time": "2021-05-05 ",
"words": "@outcome-co/verdaccio-github-auth verdaccio github authentication plugin =d-tw"
},
"verdaccio-memory": {
"name": "verdaccio-memory",
"description": "Storage implementation in memory",
"maintainers": ["=jotadeveloper", "=ayusharma", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "verdaccio-memory storage implementation in memory =jotadeveloper =ayusharma =verdaccio.npm"
},
"@verdaccio/types": {
"name": "@verdaccio/types",
"description": "verdaccio types definitions",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/types verdaccio types definitions =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-auth-memory": {
"name": "verdaccio-auth-memory",
"description": "Auth plugin for Verdaccio that keeps users in memory",
"maintainers": ["=jotadeveloper", "=ayusharma", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "verdaccio-auth-memory auth plugin for verdaccio that keeps users in memory =jotadeveloper =ayusharma =verdaccio.npm"
},
"generator-verdaccio-plugin": {
"name": "generator-verdaccio-plugin",
"description": "plugin generator for verdaccio",
"maintainers": ["=jotadeveloper", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "3.0.1",
"time": "2020-12-23 ",
"words": "generator-verdaccio-plugin plugin generator for verdaccio =jotadeveloper =verdaccio.npm"
},
"verdaccio-bitbucket-server": {
"name": "verdaccio-bitbucket-server",
"description": "Verdaccio Authentication Plugin via Bitbucket Server",
"maintainers": ["=oeph"],
"url": null,
"keywords": [],
"version": "1.3.1",
"time": "2020-09-24 ",
"words": "verdaccio-bitbucket-server verdaccio authentication plugin via bitbucket server =oeph"
},
"verdaccio-theme-hilio": {
"name": "verdaccio-theme-hilio",
"description": "Verdaccio User Interface",
"maintainers": ["=joebnb"],
"url": null,
"keywords": [],
"version": "1.14.5",
"time": "2021-01-12 ",
"words": "verdaccio-theme-hilio verdaccio user interface =joebnb"
},
"verdaccio-aws-s3-storage": {
"name": "verdaccio-aws-s3-storage",
"description": "AWS S3 storage implementation for Verdaccio",
"maintainers": ["=jotadeveloper", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.1.0",
"time": "2021-05-02 ",
"words": "verdaccio-aws-s3-storage aws s3 storage implementation for verdaccio =jotadeveloper =verdaccio.npm"
},
"verdaccio-minio": {
"name": "verdaccio-minio",
"description": "A verdaccio plugin for storing data in Minio",
"maintainers": ["=barolab"],
"url": null,
"keywords": [],
"version": "0.2.5",
"time": "2020-03-16 ",
"words": "verdaccio-minio a verdaccio plugin for storing data in minio =barolab"
},
"p3x-verdaccio-cli": {
"name": "p3x-verdaccio-cli",
"description": "🍶 Verdaccio CLI",
"maintainers": ["=patrikx3"],
"url": null,
"keywords": [],
"version": "2021.4.113",
"time": "2021-03-07 ",
"words": "p3x-verdaccio-cli 🍶 verdaccio cli =patrikx3"
},
"verdaccio-theme-xdf": {
"name": "verdaccio-theme-xdf",
"description": "Verdaccio User Interface",
"maintainers": ["=likaizhu"],
"url": null,
"keywords": [],
"version": "1.0.0",
"time": "2020-11-25 ",
"words": "verdaccio-theme-xdf verdaccio user interface =likaizhu"
},
"kiss-verdaccio-types": {
"name": "kiss-verdaccio-types",
"description": "verdaccio types definitions",
"maintainers": ["=qd397"],
"url": null,
"keywords": [],
"version": "9.7.3",
"time": "2021-02-22 ",
"words": "kiss-verdaccio-types verdaccio types definitions =qd397"
},
"@verdaccio/testing-utilities": {
"name": "@verdaccio/testing-utilities",
"description": "Utils for Verdaccio",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/testing-utilities utils for verdaccio =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-git": {
"name": "verdaccio-git",
"description": "Publish packages to git repositories.",
"maintainers": ["=amazeelabs"],
"url": null,
"keywords": [],
"version": "0.1.29",
"time": "2021-03-01 ",
"words": "verdaccio-git publish packages to git repositories. =amazeelabs"
},
"eslint-plugin-verdaccio": {
"name": "eslint-plugin-verdaccio",
"description": "Verdaccio code guidelines",
"maintainers": ["=jotadeveloper", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "eslint-plugin-verdaccio verdaccio code guidelines =jotadeveloper =verdaccio.npm"
},
"@verdaccio/active-directory": {
"name": "@verdaccio/active-directory",
"description": "Active Directory authentication plugin for Verdaccio",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/active-directory active directory authentication plugin for verdaccio =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-google-cloud": {
"name": "verdaccio-google-cloud",
"description": "Google Cloud storage implementation for Verdaccio",
"maintainers": ["=jotadeveloper", "=verdaccio.npm"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "verdaccio-google-cloud google cloud storage implementation for verdaccio =jotadeveloper =verdaccio.npm"
},
"verdaccio-pacman": {
"name": "verdaccio-pacman",
"description": "Verdaccio Middleware Plugin to manage tags and versions of packages",
"maintainers": ["=paddek"],
"url": null,
"keywords": [],
"version": "1.1.1",
"time": "2020-10-07 ",
"words": "verdaccio-pacman verdaccio middleware plugin to manage tags and versions of packages =paddek"
},
"verdaccio-ldap-memcached": {
"name": "verdaccio-ldap-memcached",
"description": "LDAP auth plugin for verdaccio",
"maintainers": ["=therippa"],
"url": null,
"keywords": [],
"version": "1.4.1",
"time": "2018-02-02 ",
"words": "verdaccio-ldap-memcached ldap auth plugin for verdaccio =therippa"
},
"@verdaccio/eslint-config": {
"name": "@verdaccio/eslint-config",
"description": "Verdaccio ESLint shareable config",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/eslint-config verdaccio eslint shareable config =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"uino-verdaccio": {
"name": "uino-verdaccio",
"description": "A lightweight private npm proxy registry",
"maintainers": ["=qd397"],
"url": null,
"keywords": [],
"version": "4.8.5",
"time": "2021-02-22 ",
"words": "uino-verdaccio a lightweight private npm proxy registry =qd397"
},
"@verdaccio/babel-preset": {
"name": "@verdaccio/babel-preset",
"description": "A common preset for Verdaccio projects",
"maintainers": ["=sergiohgz", "=verdaccio.npm", "=jotadeveloper", "=ayusharma"],
"url": null,
"keywords": [],
"version": "10.0.0",
"time": "2021-03-29 ",
"words": "@verdaccio/babel-preset a common preset for verdaccio projects =sergiohgz =verdaccio.npm =jotadeveloper =ayusharma"
},
"verdaccio-gitlab-hilio": {
"name": "verdaccio-gitlab-hilio",
"description": "private npm registry (Verdaccio) using gitlab-ce as authentication and authorization provider",
"maintainers": ["=joebnb"],
"url": null,
"keywords": [],
"version": "1.1.17",
"time": "2021-04-07 ",
"words": "verdaccio-gitlab-hilio private npm registry (verdaccio) using gitlab-ce as authentication and authorization provider =joebnb"
},
"verdaccio-ldap": {
"name": "verdaccio-ldap",
"description": "LDAP auth plugin for verdaccio",
"maintainers": ["=alexandre-io"],
"url": null,
"keywords": [],
"version": "4.2.0",
"time": "2020-08-15 ",
"words": "verdaccio-ldap ldap auth plugin for verdaccio =alexandre-io"
},
"verdaccio-github-oauth-ui": {
"name": "verdaccio-github-oauth-ui",
"description": "<h1 align=\"center\"> 📦🔐 Verdaccio GitHub OAuth - With UI Support </h1>",
"maintainers": ["=abraham-schilling"],
"url": null,
"keywords": [],
"version": "3.0.0",
"time": "2021-05-02 ",
"words": "verdaccio-github-oauth-ui <h1 align=\"center\"> 📦🔐 verdaccio github oauth - with ui support </h1> =abraham-schilling"
},
"verdaccio-https": {
"name": "verdaccio-https",
"description": "verdaccio middleware plugin to redirect to https",
"maintainers": ["=honzahommer"],
"url": null,
"keywords": [],
"version": "1.0.11",
"time": "2019-10-19 ",
"words": "verdaccio-https verdaccio middleware plugin to redirect to https =honzahommer"
},
"mlc-verdaccio-s3-archiver": {
"name": "mlc-verdaccio-s3-archiver",
"description": "Builds an archive of your verdaccio instance, then backup it to AWS S3.",
"maintainers": ["=moonlight-coding"],
"url": null,
"keywords": [],
"version": "1.0.3",
"time": "2020-05-17 ",
"words": "mlc-verdaccio-s3-archiver builds an archive of your verdaccio instance, then backup it to aws s3. =moonlight-coding"
},
"verdaccio-pg-storage": {
"name": "verdaccio-pg-storage",
"description": "Storage plugin to host packages PostgreSQL",
"maintainers": ["=yckao"],
"url": null,
"keywords": [],
"version": "1.0.3",
"time": "2020-06-24 ",
"words": "verdaccio-pg-storage storage plugin to host packages postgresql =yckao"
},
"verdaccio-openmetrics": {
"name": "verdaccio-openmetrics",
"description": "Verdaccio plugin exposing an OpenMetrics/Prometheus endpoint with health and traffic metrics",
"maintainers": ["=freightbot"],
"url": null,
"keywords": [],
"version": "1.1.0",
"time": "2021-03-22 ",
"words": "verdaccio-openmetrics verdaccio plugin exposing an openmetrics/prometheus endpoint with health and traffic metrics =freightbot"
},
"verdaccio-apm-server": {
"name": "verdaccio-apm-server",
"description": "An amazing verdaccio plugin",
"maintainers": ["=soul741"],
"url": null,
"keywords": [],
"version": "1.0.14",
"time": "2020-09-28 ",
"words": "verdaccio-apm-server an amazing verdaccio plugin =soul741"
},
"verdaccio-local-storage-with-cache-db": {
"name": "verdaccio-local-storage-with-cache-db",
"description": "Local storage implementation",
"maintainers": ["=joebnb"],
"url": null,
"keywords": [],
"version": "9.7.5",
"time": "2020-11-28 ",
"words": "verdaccio-local-storage-with-cache-db local storage implementation =joebnb"
},
"verdaccio-azure-ad-login": {
"name": "verdaccio-azure-ad-login",
"description": "Let your users authenticate into Verdaccio using Azure AD OAuth",
"maintainers": ["=ihton"],
"url": null,
"keywords": [],
"version": "1.0.5",
"time": "2021-02-25 ",
"words": "verdaccio-azure-ad-login let your users authenticate into verdaccio using azure ad oauth =ihton"
},
"@freighthub/verdaccio-openmetrics": {
"name": "@freighthub/verdaccio-openmetrics",
"description": "Verdaccio plugin exposing an OpenMetrics/Prometheus endpoint with health and traffic metrics",
"maintainers": [
"=pallavimalik",
"=lydia.seidlitz",
"=michelle.chua",
"=rodmatos",
"=danopia",
"=diogocostaferraz",
"=namit1211",
"=matang.dave",
"=wes.lim",
"=orinelin",
"=beheim",
"=erikmuttersbach",
"=justgoscha",
"=firellon",
"=l-oris",
"=artfwo",
"=pravinbashyal",
"=freightbot",
"=milos.mircov",
"=unsal.gokdag",
"=norocketscientist",
"=sid23",
"=vedpbharti",
"=fr-yp",
"=prabhakalaivani",
"=baptlesta",
"=luisantunesdeveloper",
"=blueyedgeek",
"=rashidfh",
"=ulymarins",
"=pedrock",
"=jose.suero",
"=anup.dev",
"=sidoshi",
"=mridulmeh",
"=dhayanand",
"=avijit.gupta",
"=dijia",
"=batuhandirek",
"=dayemsiddiqui",
"=eruditespirit",
"=ajayvarghese003",
"=ortserga",
"=fmueller_bln",
"=imartyn",
"=sabbir.ahmmed",
"=aditya337",
"=ranyardmforto",
"=mtrabelsi",
"=lsamayoa-forto",
"=nitesh-forto",
"=albertvp",
"=aliasgarhada",
"=ruizmurcia",
"=micszym",
"=b3nshi",
"=dawidmf"
],
"url": null,
"keywords": [],
"version": "1.0.1",
"time": "2021-01-12 ",
"words": "@freighthub/verdaccio-openmetrics verdaccio plugin exposing an openmetrics/prometheus endpoint with health and traffic metrics =pallavimalik =lydia.seidlitz =michelle.chua =rodmatos =danopia =diogocostaferraz =namit1211 =matang.dave =wes.lim =orinelin =beheim =erikmuttersbach =justgoscha =firellon =l-oris =artfwo =pravinbashyal =freightbot =milos.mircov =unsal.gokdag =norocketscientist =sid23 =vedpbharti =fr-yp =prabhakalaivani =baptlesta =luisantunesdeveloper =blueyedgeek =rashidfh =ulymarins =pedrock =jose.suero =anup.dev =sidoshi =mridulmeh =dhayanand =avijit.gupta =dijia =batuhandirek =dayemsiddiqui =eruditespirit =ajayvarghese003 =ortserga =fmueller_bln =imartyn =sabbir.ahmmed =aditya337 =ranyardmforto =mtrabelsi =lsamayoa-forto =nitesh-forto =albertvp =aliasgarhada =ruizmurcia =micszym =b3nshi =dawidmf"
},
"bulk-npm-publish": {
"name": "bulk-npm-publish",
"description": "Publish Multiple NPM packages from verdaccio storage",
"maintainers": ["=rluvaton"],
"url": null,
"keywords": [],
"version": "3.0.2",
"time": "2021-03-15 ",
"words": "bulk-npm-publish publish multiple npm packages from verdaccio storage =rluvaton"
},
"verdaccio-acl-plugin": {
"name": "verdaccio-acl-plugin",
"description": "Plugin to simplify group permissions management",
"maintainers": ["=t3o-it"],
"url": null,
"keywords": [],
"version": "1.0.1",
"time": "2021-02-01 ",
"words": "verdaccio-acl-plugin plugin to simplify group permissions management =t3o-it"
},
"verdaccio-openid-connect": {
"name": "verdaccio-openid-connect",
"description": "Verdaccio authentication plugin for OpenID Connect. When installed, `npm login --registry ...` command will open the browser to start login flow.",
"maintainers": ["=aikoven"],
"url": null,
"keywords": [],
"version": "1.0.2",
"time": "2021-01-31 ",
"words": "verdaccio-openid-connect verdaccio authentication plugin for openid connect. when installed, `npm login --registry ...` command will open the browser to start login flow. =aikoven"
},
"verdaccio-groups2": {
"name": "verdaccio-groups2",
"description": "- 一个verdaccio group管理插件(auth插件)",
"maintainers": ["=jeffery0211"],
"url": null,
"keywords": [],
"version": "1.0.2",
"time": "2021-01-02 ",
"words": "verdaccio-groups2 - 一个verdaccio group管理插件(auth插件) =jeffery0211"
}
}

@ -0,0 +1,744 @@
[
{
"name": "verdaccio",
"scope": "unscoped",
"version": "5.0.4",
"description": "A lightweight private npm proxy registry",
"keywords": [
"private",
"package",
"repository",
"registry",
"enterprise",
"modules",
"proxy",
"server",
"verdaccio"
],
"date": "2021-04-28T05:24:23.696Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/verdaccio",
"bugs": "https://github.com/verdaccio/verdaccio/issues"
},
"author": {
"name": "Verdaccio Maintainers",
"email": "verdaccio.npm@gmail.com",
"username": "verdaccio.npm"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
},
{
"username": "trentearl",
"email": "trent@trentearl.com"
},
{
"username": "jmwilkinson",
"email": "J.Wilkinson@f5.com"
},
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
}
]
},
{
"name": "verdaccio-bitbucket",
"scope": "unscoped",
"version": "3.0.1",
"description": "Verdaccio module to authenticate users via Bitbucket",
"keywords": [
"sinopia",
"verdaccio",
"bitbucket",
"atlassian",
"auth",
"node",
"nodejs",
"js",
"javascript"
],
"date": "2020-11-17T18:31:50.893Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-bitbucket",
"homepage": "https://github.com/idangozlan/verdaccio-bitbucket#readme",
"repository": "https://github.com/idangozlan/verdaccio-bitbucket",
"bugs": "https://github.com/idangozlan/verdaccio-bitbucket/issues"
},
"author": {
"name": "Idan Gozlan",
"email": "idangozlan@gmail.com",
"username": "idangozlan"
},
"publisher": {
"username": "idangozlan",
"email": "idangozlan@gmail.com"
},
"maintainers": [
{
"username": "idangozlan",
"email": "idangozlan@gmail.com"
}
]
},
{
"name": "verdaccio-auth-bitbucket",
"scope": "unscoped",
"version": "2.0.3",
"description": "Verdaccio module to authenticate users via Bitbucket",
"keywords": [
"sinopia",
"verdaccio",
"bitbucket",
"atlassian",
"auth",
"node",
"nodejs",
"js",
"javascript"
],
"date": "2020-11-12T16:44:32.807Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-auth-bitbucket",
"homepage": "https://github.com/tomamatics/verdaccio-bitbucket#readme",
"repository": "https://github.com/tomamatics/verdaccio-bitbucket",
"bugs": "https://github.com/tomamatics/verdaccio-bitbucket/issues"
},
"author": {
"name": "Tom Pachtner",
"email": "tompachtner@gmail.com"
},
"publisher": {
"username": "tomamatics",
"email": "tom@pachtner.net"
},
"maintainers": [
{
"username": "tomamatics",
"email": "tom@pachtner.net"
}
]
},
{
"name": "verdaccio-badger",
"scope": "unscoped",
"version": "1.0.0",
"description": "verdaccio middleware plugin to serve svg badges",
"keywords": ["verdaccio", "plugin", "middleware", "badge", "badges"],
"date": "2020-08-02T18:08:10.321Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-badger",
"homepage": "https://github.com/PaddeK/verdaccio-badger",
"repository": "https://github.com/PaddeK/verdaccio-badger",
"bugs": "https://github.com/PaddeK/verdaccio-badger/issues"
},
"author": {
"name": "Patrick Klös",
"email": "pkloes@web.de",
"username": "paddek"
},
"publisher": {
"username": "paddek",
"email": "pkloes@web.de"
},
"maintainers": [
{
"username": "paddek",
"email": "pkloes@web.de"
}
]
},
{
"name": "@verdaccio/streams",
"scope": "verdaccio",
"version": "10.0.0",
"description": "Stream extension for Verdaccio",
"keywords": ["verdaccio", "streams"],
"date": "2021-03-29T13:01:49.263Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Fstreams",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "@verdaccio/commons-api",
"scope": "verdaccio",
"version": "10.0.0",
"description": "Commons API utilities for Verdaccio",
"keywords": ["http", "verdaccio", "api"],
"date": "2021-03-29T13:01:51.477Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Fcommons-api",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "verdaccio-audit",
"scope": "unscoped",
"version": "10.0.0",
"description": "Verdaccio Middleware plugin to bypass npmjs audit",
"keywords": ["verdaccio", "plugin", "middleware", "audit"],
"date": "2021-03-29T13:01:49.126Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-audit",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
}
]
},
{
"name": "@verdaccio/ui-theme",
"scope": "verdaccio",
"version": "3.1.0",
"description": "Verdaccio User Interface",
"keywords": ["verdaccio", "verdaccio-plugin", "verdaccio-theme"],
"date": "2021-04-27T20:14:01.392Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Fui-theme",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/ui",
"bugs": "https://github.com/verdaccio/ui/issues"
},
"author": {
"name": "Verdaccio Core Team",
"email": "verdaccio.npm@gmail.com",
"username": "verdaccio.npm"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "@verdaccio/local-storage",
"scope": "verdaccio",
"version": "10.0.6",
"description": "Local storage implementation",
"keywords": ["plugin", "verdaccio", "storage", "local-storage"],
"date": "2021-05-01T07:51:30.546Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Flocal-storage",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "@verdaccio/file-locking",
"scope": "verdaccio",
"version": "10.0.0",
"description": "library that handle file locking",
"keywords": ["verdaccio", "lock", "fs"],
"date": "2021-03-29T13:01:49.338Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Ffile-locking",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "verdaccio-htpasswd",
"scope": "unscoped",
"version": "10.0.0",
"description": "htpasswd auth plugin for Verdaccio",
"keywords": ["verdaccio", "plugin", "auth", "htpasswd"],
"date": "2021-03-29T13:01:56.726Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-htpasswd",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Ayush Sharma",
"email": "ayush.aceit@gmail.com",
"username": "ayusharma"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
}
]
},
{
"name": "@verdaccio/readme",
"scope": "verdaccio",
"version": "10.0.0",
"description": "Readme markdown parser",
"keywords": ["verdaccio", "readme", "markdown"],
"date": "2021-03-29T13:01:49.184Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Freadme",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "verdaccio-dynamodb",
"scope": "unscoped",
"version": "1.1.8",
"description": "Verdaccio DynamoDB Auth Plugin",
"keywords": ["aws", "auth-plugin", "verdaccio", "dynamodb", "verdaccio-plugin"],
"date": "2020-06-24T00:27:56.073Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-dynamodb",
"homepage": "https://github.com/pusherman/verdaccio-dynamodb#readme",
"repository": "https://github.com/pusherman/verdaccio-dynamodb",
"bugs": "https://github.com/pusherman/verdaccio-dynamodb/issues"
},
"author": {
"name": "Corey Wilson",
"email": "corey@eastcodes.com",
"username": "cwilson"
},
"publisher": {
"username": "cwilson",
"email": "corey@eastcodes.com"
},
"maintainers": [
{
"username": "cwilson",
"email": "corey@eastcodes.com"
}
]
},
{
"name": "@outcome-co/verdaccio-github-auth",
"scope": "outcome-co",
"version": "2.0.9",
"description": "Verdaccio Github Authentication Plugin",
"date": "2021-05-05T09:20:40.658Z",
"links": {
"npm": "https://www.npmjs.com/package/%40outcome-co%2Fverdaccio-github-auth",
"homepage": "https://github.com/outcome-co/verdaccio-github-auth-js",
"repository": "https://github.com/outcome-co/verdaccio-github-auth-js",
"bugs": "https://github.com/outcome-co/verdaccio-github-auth-js/issues"
},
"author": {
"name": "Outcome Engineering",
"email": "engineering@outcome.co",
"url": "https://outcome.co"
},
"publisher": {
"username": "d-tw",
"email": "douglas@outcome.co"
},
"maintainers": [
{
"username": "d-tw",
"email": "douglas@outcome.co"
}
]
},
{
"name": "verdaccio-bitbucket-server",
"scope": "unscoped",
"version": "1.3.1",
"description": "Verdaccio Authentication Plugin via Bitbucket Server",
"keywords": ["verdaccio", "verdaccio-plugin", "bitbucket", "bitbucket-server"],
"date": "2020-09-24T18:02:25.638Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-bitbucket-server",
"homepage": "https://github.com/oeph/verdaccio-bitbucket-server#readme",
"repository": "https://github.com/oeph/verdaccio-bitbucket-server",
"bugs": "https://github.com/oeph/verdaccio-bitbucket-server/issues"
},
"author": {
"name": "oeph"
},
"publisher": {
"username": "oeph",
"email": "npm@philippoeh.me"
},
"maintainers": [
{
"username": "oeph",
"email": "npm@philippoeh.me"
}
]
},
{
"name": "verdaccio-memory",
"scope": "unscoped",
"version": "10.0.0",
"description": "Storage implementation in memory",
"keywords": ["verdaccio", "plugin", "storage", "memory"],
"date": "2021-03-29T13:01:59.285Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-memory",
"homepage": "https://verdaccio.org"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
}
]
},
{
"name": "@verdaccio/types",
"scope": "verdaccio",
"version": "10.0.0",
"description": "verdaccio types definitions",
"keywords": ["verdaccio", "typescript", "types"],
"date": "2021-03-29T13:01:49.294Z",
"links": {
"npm": "https://www.npmjs.com/package/%40verdaccio%2Ftypes",
"homepage": "https://verdaccio.org",
"repository": "https://github.com/verdaccio/monorepo",
"bugs": "https://github.com/verdaccio/monorepo/issues"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "sergiohgz",
"email": "sergio@sergiohgz.eu"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
}
]
},
{
"name": "verdaccio-auth-memory",
"scope": "unscoped",
"version": "10.0.0",
"description": "Auth plugin for Verdaccio that keeps users in memory",
"keywords": ["verdaccio", "plugin", "auth", "memory"],
"date": "2021-03-29T13:02:02.215Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-auth-memory",
"homepage": "https://verdaccio.org"
},
"author": {
"name": "Juan Picado",
"email": "juanpicado19@gmail.com",
"username": "jotadeveloper"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "ayusharma",
"email": "ayush.aceit@gmail.com"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
}
]
},
{
"name": "generator-verdaccio-plugin",
"scope": "unscoped",
"version": "3.0.1",
"description": "plugin generator for verdaccio",
"keywords": ["verdaccio-plugin", "yeoman-generator"],
"date": "2020-12-23T10:31:29.150Z",
"links": {
"npm": "https://www.npmjs.com/package/generator-verdaccio-plugin",
"homepage": "https://github.com/verdaccio",
"repository": "https://github.com/verdaccio/generator-verdaccio-plugin",
"bugs": "https://github.com/verdaccio/generator-verdaccio-plugin/issues"
},
"author": {
"name": "Juan Picado",
"email": "@jotadeveloper",
"url": "https://github.com/verdaccio/generator-verdaccio-plugin"
},
"publisher": {
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
},
"maintainers": [
{
"username": "jotadeveloper",
"email": "juanpicado19@gmail.com"
},
{
"username": "verdaccio.npm",
"email": "verdaccio.npm@gmail.com"
}
]
},
{
"name": "verdaccio-minio",
"scope": "unscoped",
"version": "0.2.5",
"description": "A verdaccio plugin for storing data in Minio",
"keywords": ["Verdaccio", "S3", "Minio"],
"date": "2020-03-16T08:49:58.248Z",
"links": {
"npm": "https://www.npmjs.com/package/verdaccio-minio",
"homepage": "https://github.com/barolab/verdaccio-minio#readme",
"repository": "https://github.com/barolab/verdaccio-minio",
"bugs": "https://github.com/barolab/verdaccio-minio/issues"
},
"author": {
"name": "Romain Bailly",
"email": "rbailly17000@gmail.com",
"username": "barolab"
},
"publisher": {
"username": "barolab",
"email": "rbailly17000@gmail.com"
},
"maintainers": [
{
"username": "barolab",
"email": "rbailly17000@gmail.com"
}
]
}
]

@ -1,8 +1,15 @@
import path from 'path';
import nock from 'nock';
import * as httpMocks from 'node-mocks-http';
import { Config, parseConfigFile } from '@verdaccio/config';
import { ErrorCode } from '@verdaccio/utils';
import { API_ERROR } from '@verdaccio/commons-api';
import {
API_ERROR,
HEADERS,
HEADER_TYPE,
HTTP_STATUS,
VerdaccioError,
} from '@verdaccio/commons-api';
import { ProxyStorage } from '../src/up-storage';
const getConf = (name) => path.join(__dirname, '/conf', name);
@ -39,110 +46,302 @@ describe('proxy', () => {
};
const proxyPath = getConf('proxy1.yaml');
const conf = new Config(parseConfigFile(proxyPath));
describe('basic requests', () => {
test('proxy call with etag', (done) => {
nock(domain)
.get('/jquery')
.reply(
200,
{ body: 'test' },
{
etag: () => `_ref_4444`,
}
);
describe('search', () => {
test('get file from v1 endpoint', (done) => {
const url = '/-/v1/search';
nock(domain).get(url).replyWithFile(200, path.join(__dirname, 'partials/search-v1.json'));
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (_error, body, etag) => {
expect(etag).toEqual('_ref_4444');
expect(body).toEqual({ body: 'test' });
const req = httpMocks.createRequest({
method: 'GET',
headers: {
referer: 'some.org',
['x-forwarded-for']: '10.0.0.1',
},
connection: {
remoteAddress: 'localhost',
},
url,
});
const stream = prox1.search({ req });
stream.on('data', (data) => {
expect(data).toBeDefined();
done();
});
});
test('proxy call with etag as option', (done) => {
nock(domain)
.get('/jquery')
.reply(
200,
{ body: 'test' },
{
etag: () => `_ref_4444`,
}
);
test('abort search from v1 endpoint', (done) => {
const url = '/-/v1/search';
nock(domain).get(url).delay(20000);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', { etag: 'rev_3333' }, (_error, body, etag) => {
expect(etag).toEqual('_ref_4444');
expect(body).toEqual({ body: 'test' });
const req = httpMocks.createRequest({
method: 'GET',
headers: {
referer: 'some.org',
['x-forwarded-for']: '10.0.0.1',
},
connection: {
remoteAddress: 'localhost',
},
url,
});
const stream = prox1.search({ req });
stream.on('end', () => {
done();
});
// TODO: apply correct types here
// @ts-ignore
stream.abort();
});
// TODO: we should test the gzip deflate here, but is hard to test
// fix me if you can deal with Incorrect Header Check issue
test.todo('get file from v1 endpoint with gzip headers');
test('search v1 endpoint fails', (done) => {
const url = '/-/v1/search';
nock(domain).get(url).replyWithError('search endpoint is down');
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
const req = httpMocks.createRequest({
method: 'GET',
headers: {
referer: 'some.org',
['x-forwarded-for']: '10.0.0.1',
},
connection: {
remoteAddress: 'localhost',
},
url,
});
const stream = prox1.search({ req });
stream.on('error', (error) => {
expect(error).toEqual(Error('search endpoint is down'));
done();
});
});
test('proxy not found', (done) => {
nock(domain).get('/jquery').reply(404);
test('search v1 endpoint bad status code', (done) => {
const url = '/-/v1/search';
nock(domain).get(url).reply(409);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', { etag: 'rev_3333' }, (error) => {
expect(error).toEqual(ErrorCode.getNotFound(API_ERROR.NOT_PACKAGE_UPLINK));
const req = httpMocks.createRequest({
method: 'GET',
headers: {
referer: 'some.org',
['x-forwarded-for']: '10.0.0.1',
},
connection: {
remoteAddress: 'localhost',
},
url,
});
const stream = prox1.search({ req });
stream.on('error', (error) => {
expect(error).toEqual(ErrorCode.getInternalError(`bad status code 409 from uplink`));
done();
});
});
});
describe('tarballs', () => {
test('tarball call', (done) => {
describe('fetchTarball', () => {
test('get file tarball no content-length', (done) => {
nock(domain)
.get('/jquery')
.reply(
200,
{ body: 'test' },
{
etag: () => `_ref_4444`,
}
);
.get('/jquery/-/jquery-0.0.1.tgz')
.replyWithFile(201, path.join(__dirname, 'partials/jquery-0.0.1.tgz'));
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (_error, body, etag) => {
expect(etag).toEqual('_ref_4444');
expect(body).toEqual({ body: 'test' });
const stream = prox1.fetchTarball('https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz');
stream.on('data', (data) => {
expect(data).toBeDefined();
done();
});
});
test('get file tarball correct content-length', (done) => {
nock(domain)
.get('/jquery/-/jquery-0.0.1.tgz')
// types does not match here with documentation
// @ts-expect-error
.replyWithFile(201, path.join(__dirname, 'partials/jquery-0.0.1.tgz'), {
[HEADER_TYPE.CONTENT_LENGTH]: 277,
});
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
const stream = prox1.fetchTarball('https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz');
stream.on(HEADER_TYPE.CONTENT_LENGTH, (data) => {
expect(data).toEqual('277');
done();
});
});
describe('error handling', () => {
test('should be offline uplink', (done) => {
const tarball = 'https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz';
nock(domain).get('/jquery/-/jquery-0.0.1.tgz').times(100).replyWithError('some error');
const proxy = new ProxyStorage(defaultRequestOptions, conf);
const stream = proxy.fetchTarball(tarball);
// to test a uplink is offline we have to be try 3 times
// the default failed request are set to 2
process.nextTick(function () {
stream.on('error', function (err) {
expect(err).not.toBeNull();
// expect(err.statusCode).toBe(404);
expect(proxy.failed_requests).toBe(1);
const streamSecondTry = proxy.fetchTarball(tarball);
streamSecondTry.on('error', function (err) {
expect(err).not.toBeNull();
/*
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
*/
// expect(err.statusCode).toBe(404);
expect(proxy.failed_requests).toBe(2);
const streamThirdTry = proxy.fetchTarball(tarball);
streamThirdTry.on('error', function (err: VerdaccioError) {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(HTTP_STATUS.INTERNAL_ERROR);
expect(proxy.failed_requests).toBe(2);
expect(err.message).toMatch(API_ERROR.UPLINK_OFFLINE);
done();
});
});
});
});
});
test('not found tarball', (done) => {
nock(domain).get('/jquery/-/jquery-0.0.1.tgz').reply(404);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
const stream = prox1.fetchTarball('https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz');
stream.on('error', (response) => {
expect(response).toEqual(ErrorCode.getNotFound(API_ERROR.NOT_FILE_UPLINK));
done();
});
});
test('fail tarball request', (done) => {
nock(domain).get('/jquery/-/jquery-0.0.1.tgz').replyWithError('boom file');
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
const stream = prox1.fetchTarball('https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz');
stream.on('error', (response) => {
expect(response).toEqual(Error('boom file'));
done();
});
});
test('bad uplink request', (done) => {
nock(domain).get('/jquery/-/jquery-0.0.1.tgz').reply(409);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
const stream = prox1.fetchTarball('https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz');
stream.on('error', (response) => {
expect(response).toEqual(ErrorCode.getInternalError(`bad uplink status code: 409`));
done();
});
});
test('content length header mismatch', (done) => {
nock(domain)
.get('/jquery/-/jquery-0.0.1.tgz')
// types does not match here with documentation
// @ts-expect-error
.replyWithFile(201, path.join(__dirname, 'partials/jquery-0.0.1.tgz'), {
[HEADER_TYPE.CONTENT_LENGTH]: 0,
});
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
const stream = prox1.fetchTarball('https://registry.npmjs.org/jquery/-/jquery-0.0.1.tgz');
stream.on('error', (response) => {
expect(response).toEqual(ErrorCode.getInternalError(API_ERROR.CONTENT_MISMATCH));
done();
});
});
});
});
describe('error handling', () => {
test('reply with error', (done) => {
nock(domain).get('/jquery').replyWithError('something awful happened');
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (error) => {
expect(error).toEqual(new Error('something awful happened'));
done();
describe('getRemoteMetadata', () => {
describe('basic requests', () => {
test('proxy call with etag', (done) => {
nock(domain)
.get('/jquery')
.reply(
200,
{ body: 'test' },
{
etag: () => `_ref_4444`,
}
);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (_error, body, etag) => {
expect(etag).toEqual('_ref_4444');
expect(body).toEqual({ body: 'test' });
done();
});
});
test('proxy call with etag as option', (done) => {
nock(domain)
.get('/jquery')
.reply(
200,
{ body: 'test' },
{
etag: () => `_ref_4444`,
}
);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', { etag: 'rev_3333' }, (_error, body, etag) => {
expect(etag).toEqual('_ref_4444');
expect(body).toEqual({ body: 'test' });
done();
});
});
test('proxy not found', (done) => {
nock(domain).get('/jquery').reply(404);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', { etag: 'rev_3333' }, (error) => {
expect(error).toEqual(ErrorCode.getNotFound(API_ERROR.NOT_PACKAGE_UPLINK));
done();
});
});
});
test('reply with bad body json format', (done) => {
nock(domain).get('/jquery').reply(200, 'some-text');
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (error) => {
expect(error).toEqual(new SyntaxError('Unexpected token s in JSON at position 0'));
done();
describe('error handling', () => {
test('reply with error', (done) => {
nock(domain).get('/jquery').replyWithError('something awful happened');
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (error) => {
expect(error).toEqual(new Error('something awful happened'));
done();
});
});
});
test('400 error proxy call', (done) => {
nock(domain).get('/jquery').reply(409);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (error) => {
expect(error.statusCode).toEqual(500);
expect(mockInfo).toHaveBeenCalled();
expect(mockHttp).toHaveBeenCalledWith({
request: { method: 'GET', url: 'https://registry.npmjs.org/jquery' },
status: 409,
test('reply with bad body json format', (done) => {
nock(domain).get('/jquery').reply(200, 'some-text');
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (error) => {
expect(error).toEqual(new SyntaxError('Unexpected token s in JSON at position 0'));
done();
});
expect(mockHttp).toHaveBeenCalledWith({
bytes: { in: 0, out: 0 },
err: undefined,
error: undefined,
request: { method: 'GET', url: 'https://registry.npmjs.org/jquery' },
status: 409,
});
test('400 error proxy call', (done) => {
nock(domain).get('/jquery').reply(409);
const prox1 = new ProxyStorage(defaultRequestOptions, conf);
prox1.getRemoteMetadata('jquery', {}, (error) => {
expect(error.statusCode).toEqual(500);
expect(mockInfo).toHaveBeenCalled();
expect(mockHttp).toHaveBeenCalledWith({
request: { method: 'GET', url: 'https://registry.npmjs.org/jquery' },
status: 409,
});
expect(mockHttp).toHaveBeenCalledWith({
bytes: { in: 0, out: 0 },
err: undefined,
error: undefined,
request: { method: 'GET', url: 'https://registry.npmjs.org/jquery' },
status: 409,
});
done();
});
done();
});
});
});

@ -1,259 +0,0 @@
import path from 'path';
import _ from 'lodash';
import { Config as AppConfig } from '@verdaccio/config';
import { Config, UpLinkConf } from '@verdaccio/types';
import { VerdaccioError } from '@verdaccio/commons-api';
import { IProxy } from '@verdaccio/proxy';
import { API_ERROR, HTTP_STATUS } from '@verdaccio/commons-api';
import { mockServer, configExample, DOMAIN_SERVERS } from '@verdaccio/mock';
import { ProxyStorage } from '@verdaccio/proxy';
import { setup, logger } from '@verdaccio/logger';
setup([]);
describe('UpStorge', () => {
const mockServerPort = 55547;
let mockRegistry;
const uplinkDefault = {
url: `http://0.0.0.0:${mockServerPort}`,
};
const generateProxy = (config: UpLinkConf = uplinkDefault) => {
const appConfig: Config = new AppConfig(configExample());
return new ProxyStorage(config, appConfig);
};
beforeAll(async () => {
const binPath = require.resolve('verdaccio/bin/verdaccio');
const storePath = path.join(__dirname, '/mock/store');
mockRegistry = await mockServer(mockServerPort, { storePath, silence: true }).init(binPath);
});
afterAll(function (done) {
const [registry, pid] = mockRegistry;
registry.stop();
logger.info(`registry ${pid} has been stopped`);
done();
});
test('should be defined', () => {
const proxy = generateProxy();
expect(proxy).toBeDefined();
});
describe('UpStorge::getRemoteMetadata', () => {
test('should be get remote metadata', (done) => {
const proxy = generateProxy();
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 etag', (done) => {
const proxy = generateProxy();
proxy.getRemoteMetadata('jquery', { etag: '123456' }, (err, data, etag) => {
expect(err).toBeNull();
expect(_.isString(etag)).toBeTruthy();
expect(data.name).toBe('jquery');
done();
});
});
test('should be get remote metadata package does not exist', (done) => {
const proxy = generateProxy();
proxy.getRemoteMetadata('@verdaccio/fake-package', { etag: '123456' }, (err) => {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(HTTP_STATUS.NOT_FOUND);
expect(err.message).toMatch(API_ERROR.NOT_PACKAGE_UPLINK);
done();
});
});
});
describe('UpStorge::fetchTarball', () => {
test('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);
stream.on('error', function (err) {
expect(err).toBeNull();
done();
});
stream.on('content-length', function (contentLength) {
expect(contentLength).toBeDefined();
done();
});
});
test('should throw a 404 on fetch a tarball from uplink', (done) => {
const proxy = generateProxy();
const tarball = `http://${DOMAIN_SERVERS}:${mockServerPort}/jquery/-/no-exist-1.5.1.tgz`;
const stream = proxy.fetchTarball(tarball);
stream.on('error', function (err: VerdaccioError) {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(HTTP_STATUS.NOT_FOUND);
expect(err.message).toMatch(API_ERROR.NOT_FILE_UPLINK);
done();
});
stream.on('content-length', function (contentLength) {
expect(contentLength).toBeDefined();
done();
});
});
test('should be offline uplink', (done) => {
const proxy = generateProxy();
const tarball = 'http://404.verdaccioo.com';
const stream = proxy.fetchTarball(tarball);
expect(proxy.failed_requests).toBe(0);
// to test a uplink is offline we have to be try 3 times
// the default failed request are set to 2
process.nextTick(function () {
stream.on('error', function (err) {
expect(err).not.toBeNull();
// expect(err.statusCode).toBe(404);
expect(proxy.failed_requests).toBe(1);
const streamSecondTry = proxy.fetchTarball(tarball);
streamSecondTry.on('error', function (err) {
expect(err).not.toBeNull();
/*
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
*/
// expect(err.statusCode).toBe(404);
expect(proxy.failed_requests).toBe(2);
const streamThirdTry = proxy.fetchTarball(tarball);
streamThirdTry.on('error', function (err: VerdaccioError) {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(HTTP_STATUS.INTERNAL_ERROR);
expect(proxy.failed_requests).toBe(2);
expect(err.message).toMatch(API_ERROR.UPLINK_OFFLINE);
done();
});
});
});
});
});
});
describe('UpStorge::isUplinkValid', () => {
describe('valid use cases', () => {
const validateUpLink = (
url: string,
tarBallUrl = `${url}/artifactory/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz`
) => {
const uplinkConf = { url };
const proxy: IProxy = generateProxy(uplinkConf);
return proxy.isUplinkValid(tarBallUrl);
};
test('should validate tarball path against uplink', () => {
expect(validateUpLink('https://artifactory.mydomain.com')).toBe(true);
});
test('should validate tarball path against uplink case#2', () => {
expect(validateUpLink('https://artifactory.mydomain.com:443')).toBe(true);
});
test('should validate tarball path against uplink case#3', () => {
expect(validateUpLink('http://localhost')).toBe(true);
});
test('should validate tarball path against uplink case#4', () => {
expect(validateUpLink('http://my.domain.test')).toBe(true);
});
test('should validate tarball path against uplink case#5', () => {
expect(validateUpLink('http://my.domain.test:3000')).toBe(true);
});
// corner case https://github.com/verdaccio/verdaccio/issues/571
test('should validate tarball path against uplink case#6', () => {
// same protocol, same domain, port === 443 which is also the standard for https
expect(
validateUpLink(
'https://my.domain.test',
`https://my.domain.test:443/artifactory/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz`
)
).toBe(true);
});
test('should validate tarball path against uplink case#7', () => {
expect(validateUpLink('https://artifactory.mydomain.com:5569')).toBe(true);
});
test('should validate tarball path against uplink case#8', () => {
expect(validateUpLink('https://localhost:5539')).toBe(true);
});
});
describe('invalid use cases', () => {
test('should fails on validate tarball path against uplink', () => {
const url = 'https://artifactory.mydomain.com';
const tarBallUrl = 'https://localhost/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
const uplinkConf = { url };
const proxy: IProxy = generateProxy(uplinkConf);
expect(proxy.isUplinkValid(tarBallUrl)).toBe(false);
});
test('should fails on validate tarball path against uplink case#2', () => {
// different domain same, same port, same protocol
const url = 'https://domain';
const tarBallUrl = 'https://localhost/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
const uplinkConf = { url };
const proxy: IProxy = generateProxy(uplinkConf);
expect(proxy.isUplinkValid(tarBallUrl)).toBe(false);
});
test('should fails on validate tarball path against uplink case#3', () => {
// same domain, different protocol, different port
const url = 'http://localhost:5001';
const tarBallUrl = 'https://localhost:4000/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
const uplinkConf = { url };
const proxy: IProxy = generateProxy(uplinkConf);
expect(proxy.isUplinkValid(tarBallUrl)).toBe(false);
});
test('should fails on validate tarball path against uplink case#4', () => {
// same domain, same protocol, different port
const url = 'https://subdomain.domain:5001';
const tarBallUrl =
'https://subdomain.domain:4000/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
const uplinkConf = { url };
const proxy: IProxy = generateProxy(uplinkConf);
expect(proxy.isUplinkValid(tarBallUrl)).toBe(false);
});
test('should fails on validate tarball path against uplink case#5', () => {
// different protocol, different domain, different port
const url = 'https://subdomain.my:5001';
const tarBallUrl = 'http://subdomain.domain:4000/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
const uplinkConf = { url };
const proxy: IProxy = generateProxy(uplinkConf);
expect(proxy.isUplinkValid(tarBallUrl)).toBe(false);
});
});
});
});

File diff suppressed because it is too large Load Diff

@ -1,20 +0,0 @@
storage: ./storage
plugins: ./plugins
auth:
htpasswd:
file: ./htpasswd
security:
api:
jwt:
sign:
expiresIn: 10m
notBefore: 0
packages:
'@*/*':
access: $authenticated
publish: $authenticated
'**':
access: $authenticated
publish: $authenticated
logs:
- { type: stdout, format: pretty, level: warn }

@ -9,7 +9,7 @@ import { ProxyStorage } from '@verdaccio/proxy';
import { API_ERROR, HTTP_STATUS, DIST_TAGS } from '@verdaccio/commons-api';
import { ReadTarball } from '@verdaccio/streams';
import { ErrorCode, normalizeDistTags, validateMetadata, isObject } from '@verdaccio/utils';
import { setupUpLinks, updateVersionsHiddenUpLink, ProxyList, IProxy } from '@verdaccio/proxy';
import { ProxyList, IProxy } from '@verdaccio/proxy';
import {
IReadTarball,
IUploadTarball,
@ -38,6 +38,7 @@ import { SearchInstance } from './search';
import { LocalStorage } from './local-storage';
import { mergeVersions } from './metadata-utils';
import { setupUpLinks, updateVersionsHiddenUpLink } from './uplink-util';
import {
checkPackageLocal,
publishPackage,
@ -308,6 +309,7 @@ class Storage {
let uplink: any = null;
for (const uplinkId in self.uplinks) {
// https://github.com/verdaccio/verdaccio/issues/1642
if (hasProxyTo(name, uplinkId, self.config.packages)) {
uplink = self.uplinks[uplinkId];
}

@ -1,6 +1,6 @@
import { Versions, Config } from '@verdaccio/types';
import { ProxyStorage, IProxy, ProxyList } from './up-storage';
import { ProxyStorage, IProxy, ProxyList } from '@verdaccio/proxy';
/**
* Set up the Up Storage for each link.
@ -27,7 +27,6 @@ export function updateVersionsHiddenUpLink(versions: Versions, upLink: IProxy):
const version = versions[i];
// holds a "hidden" value to be used by the package storage.
// $FlowFixMe
version[Symbol.for('__verdaccio_uplink')] = upLink.upname;
}
}

10
pnpm-lock.yaml generated

@ -435,9 +435,9 @@ importers:
'@verdaccio/url': workspace:11.0.0-6-next.4
'@verdaccio/utils': workspace:6.0.0-6-next.4
debug: ^4.3.1
express: ^4.17.1
express: 4.17.1
lodash: ^4.17.21
node-mocks-http: ^1.10.1
node-mocks-http: 1.10.1
dependencies:
'@verdaccio/commons-api': link:../commons-api
'@verdaccio/url': link:../url
@ -885,8 +885,9 @@ importers:
'@verdaccio/types': workspace:11.0.0-6-next.7
'@verdaccio/utils': workspace:6.0.0-6-next.4
JSONStream: 1.3.5
lodash: ^4.17.20
lodash: 4.17.20
nock: 13.0.11
node-mocks-http: 1.10.1
request: 2.87.0
dependencies:
'@verdaccio/commons-api': link:../core/commons-api
@ -901,6 +902,7 @@ importers:
devDependencies:
'@verdaccio/types': link:../core/types
nock: 13.0.11
node-mocks-http: 1.10.1
packages/server:
specifiers:
@ -23876,7 +23878,7 @@ packages:
escape-html: 1.0.3
etag: 1.8.1
fresh: 0.5.2
http-errors: 1.7.2
http-errors: 1.7.3
mime: 1.6.0
ms: 2.1.1
on-finished: 2.3.0