Skip to content
Snippets Groups Projects
Commit 8a8e5c8f authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: warn if localhost registry detected

parent db0efdf0
No related branches found
No related tags found
No related merge requests found
...@@ -66,6 +66,15 @@ function setNpmrc(input, trustLevel = 'low') { ...@@ -66,6 +66,15 @@ function setNpmrc(input, trustLevel = 'low') {
npmrc = ini.parse(input); npmrc = ini.parse(input);
// massage _auth to _authToken // massage _auth to _authToken
for (const [key, val] of Object.entries(npmrc)) { 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)) { if (key !== '_auth' && key.endsWith('_auth') && isBase64(val)) {
logger.debug('Massaging _auth to _authToken'); logger.debug('Massaging _auth to _authToken');
npmrc[key + 'Token'] = val; npmrc[key + 'Token'] = val;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment