refactor: warn if localhost registry detected

This commit is contained in:
Rhys Arkins 2018-11-16 12:21:48 +01:00
parent db0efdf053
commit 8a8e5c8fed

View file

@ -66,6 +66,15 @@ function setNpmrc(input, trustLevel = 'low') {
npmrc = ini.parse(input);
// massage _auth to _authToken
for (const [key, val] of Object.entries(npmrc)) {
// istanbul ignore if
if (
trustLevel === 'low' &&
key.endsWith('registry') &&
val &&
val.includes('localhost')
) {
logger.warn({ key, val }, 'Detected localhost registry');
}
if (key !== '_auth' && key.endsWith('_auth') && isBase64(val)) {
logger.debug('Massaging _auth to _authToken');
npmrc[key + 'Token'] = val;