npm-profile
Advanced tools
Comparing version 4.0.2 to 4.0.3
27
index.js
'use strict' | ||
const fetch = require('npm-registry-fetch') | ||
const {HttpErrorBase} = require('npm-registry-fetch/errors.js') | ||
const { HttpErrorBase } = require('npm-registry-fetch/errors.js') | ||
const os = require('os') | ||
@@ -21,2 +21,12 @@ const pudding = require('figgy-pudding') | ||
const url = require('url') | ||
const isValidUrl = u => { | ||
if (u && typeof u === 'string') { | ||
const p = url.parse(u) | ||
return !!(p.protocol && p.slashes && p.host && p.path) | ||
} | ||
return false | ||
} | ||
const ProfileConfig = pudding({ | ||
@@ -80,17 +90,12 @@ creds: {}, | ||
}).then(([res, content]) => { | ||
const {doneUrl, loginUrl} = content | ||
const { doneUrl, loginUrl } = content | ||
process.emit('log', 'verbose', 'web auth', 'got response', content) | ||
if ( | ||
typeof doneUrl !== 'string' || | ||
typeof loginUrl !== 'string' || | ||
!doneUrl || | ||
!loginUrl | ||
) { | ||
if (!isValidUrl(doneUrl) || !isValidUrl(loginUrl)) { | ||
throw new WebLoginInvalidResponse('POST', res, content) | ||
} | ||
return content | ||
}).then(({doneUrl, loginUrl}) => { | ||
}).then(({ doneUrl, loginUrl }) => { | ||
process.emit('log', 'verbose', 'web auth', 'opening url pair') | ||
return opener(loginUrl).then( | ||
() => webAuthCheckLogin(doneUrl, opts.concat({cache: false})) | ||
() => webAuthCheckLogin(doneUrl, opts.concat({ cache: false })) | ||
) | ||
@@ -188,3 +193,3 @@ }).catch(er => { | ||
return fetch.json(target, opts.concat({ | ||
query: {write: true} | ||
query: { write: true } | ||
})).then(result => { | ||
@@ -191,0 +196,0 @@ Object.keys(result).forEach(function (k) { |
{ | ||
"name": "npm-profile", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "Library for updating an npmjs.com profile", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
29585
264
11