0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-27 22:59:51 -05:00

feat: add strict_ssl_option, fixes #587

This commit is contained in:
Aaron Lozier 2018-03-17 09:47:28 -05:00
parent 7237ab340f
commit f0fef44885
4 changed files with 12 additions and 0 deletions

View file

@ -1,4 +1,5 @@
030 <chocolatey030@gmail.com> 030 <chocolatey030@gmail.com>
Aaron Lozier <lozieraj@gmail.com>
Alex Kocharin <alex@kocharin.ru> Alex Kocharin <alex@kocharin.ru>
Alex Kocharin <rlidwka@kocharin.ru> Alex Kocharin <rlidwka@kocharin.ru>
Alex Vernacchia <avernacchia@exacttarget.com> Alex Vernacchia <avernacchia@exacttarget.com>

View file

@ -48,6 +48,9 @@ uplinks:
# to be stored in the local storage (defaults to true) # to be stored in the local storage (defaults to true)
#cache: false #cache: false
# set this to false to disable strict SSL cert check (defaults to true)
#strict_ssl: false
packages: packages:
'@*/*': '@*/*':
# scoped packages # scoped packages

View file

@ -36,6 +36,7 @@ max_fails | number | No |2 | all | limit maximun failure request | 2
cache | boolean | No |[true,false] | >= 2.1 | avoid cache tarballs | true cache | boolean | No |[true,false] | >= 2.1 | avoid cache tarballs | true
auth | list | No | type: [bearer,basic], [token: "token",token_env: [true,\<get name process.env\>]] | >= 2.5 | assigns the header 'Authorization' see: http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules | disabled auth | list | No | type: [bearer,basic], [token: "token",token_env: [true,\<get name process.env\>]] | >= 2.5 | assigns the header 'Authorization' see: http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules | disabled
headers | list | No | authorization: "Basic YourBase64EncodedCredentials==" | all | list of custom headers for the uplink | disabled headers | list | No | authorization: "Basic YourBase64EncodedCredentials==" | all | list of custom headers for the uplink | disabled
strict_ssl |boolean | No | [true,false] | >= 3.0 | If true, requires SSL certificates be valid. | true
### You Must know ### You Must know

View file

@ -56,6 +56,7 @@ class ProxyStorage implements IProxy {
upname: string; upname: string;
proxy: string; proxy: string;
last_request_time: number; last_request_time: number;
strict_ssl: boolean;
/** /**
* Constructor * Constructor
@ -88,6 +89,7 @@ class ProxyStorage implements IProxy {
this.timeout = parseInterval(setConfig(this.config, 'timeout', '30s')); this.timeout = parseInterval(setConfig(this.config, 'timeout', '30s'));
this.max_fails = Number(setConfig(this.config, 'max_fails', 2 )); this.max_fails = Number(setConfig(this.config, 'max_fails', 2 ));
this.fail_timeout = parseInterval(setConfig(this.config, 'fail_timeout', '5m' )); this.fail_timeout = parseInterval(setConfig(this.config, 'fail_timeout', '5m' ));
this.strict_ssl = Boolean(setConfig(this.config, 'strict_ssl', true));
} }
/** /**
@ -129,6 +131,7 @@ class ProxyStorage implements IProxy {
method: method, method: method,
headers: headers, headers: headers,
uri: uri, uri: uri,
strictSSL: this.strict_ssl
}, 'making request: \'@{method} @{uri}\''); }, 'making request: \'@{method} @{uri}\'');
if (isObject(options.json)) { if (isObject(options.json)) {
@ -203,6 +206,7 @@ class ProxyStorage implements IProxy {
encoding: null, encoding: null,
gzip: true, gzip: true,
timeout: this.timeout, timeout: this.timeout,
strictSSL: this.strict_ssl
}, requestCallback); }, requestCallback);
let statusCalled = false; let statusCalled = false;
@ -387,6 +391,7 @@ class ProxyStorage implements IProxy {
json: true, json: true,
headers: headers, headers: headers,
req: options.req, req: options.req,
strictSSL: this.strict_ssl
}, (err, res, body) => { }, (err, res, body) => {
if (err) { if (err) {
return callback(err); return callback(err);
@ -418,6 +423,7 @@ class ProxyStorage implements IProxy {
const readStream = this.request({ const readStream = this.request({
uri_full: url, uri_full: url,
encoding: null, encoding: null,
strictSSL: this.strict_ssl,
headers: { headers: {
Accept: contenTypeAccept, Accept: contenTypeAccept,
}, },
@ -465,6 +471,7 @@ class ProxyStorage implements IProxy {
const requestStream: stream$Readable = this.request({ const requestStream: stream$Readable = this.request({
uri: options.req.url, uri: options.req.url,
req: options.req, req: options.req,
strictSSL: this.strict_ssl,
headers: { headers: {
referer: options.req.headers.referer, referer: options.req.headers.referer,
}, },