Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP6
nodejs8.17836
CVE-2020-15095.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File CVE-2020-15095.patch of Package nodejs8.17836
From a9857b8f6869451ff058789c4631fadfde5bbcbc Mon Sep 17 00:00:00 2001 From: claudiahdz <cghr1990@gmail.com> Date: Thu, 25 Jun 2020 19:34:47 -0500 Subject: [PATCH] chore: remove auth info from logs --- bin/npm-cli.js | 4 +++- lib/fetch-package-metadata.js | 9 ++++++--- lib/utils/error-handler.js | 5 ++++- lib/utils/error-message.js | 5 +++++ lib/utils/replace-info.js | 22 ++++++++++++++++++++++ 5 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 lib/utils/replace-info.js diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js index 93eddc7a3..c0d9be004 100755 --- a/deps/npm/bin/npm-cli.js +++ b/deps/npm/bin/npm-cli.js @@ -28,6 +28,7 @@ var npm = require('../lib/npm.js') var npmconf = require('../lib/config/core.js') var errorHandler = require('../lib/utils/error-handler.js') + var replaceInfo = require('../lib/utils/replace-info.js') var configDefs = npmconf.defs var shorthands = configDefs.shorthands @@ -40,7 +41,8 @@ process.argv.splice(1, 1, 'npm', '-g') } - log.verbose('cli', process.argv) + var args = replaceInfo(process.argv) + log.verbose('cli', args) var conf = nopt(types, shorthands) npm.argv = conf.argv.remain diff --git a/deps/npm/lib/fetch-package-metadata.js b/deps/npm/lib/fetch-package-metadata.js index c4f46f513..ebb378647 100644 --- a/deps/npm/lib/fetch-package-metadata.js +++ b/deps/npm/lib/fetch-package-metadata.js @@ -3,6 +3,7 @@ const deprCheck = require('./utils/depr-check') const path = require('path') const log = require('npmlog') +const pacote = require('pacote') const readPackageTree = require('read-package-tree') const rimraf = require('rimraf') const validate = require('aproba') @@ -11,15 +12,17 @@ const npm = require('./npm') let npmConfig const npmlog = require('npmlog') const limit = require('call-limit') -const tempFilename = require('./utils/temp-filename') -const pacote = require('pacote') +const tempFilename = require('./utils/temp-filename.js') +const replaceInfo = require('./utils/replace-info.js') const isWindows = require('./utils/is-windows.js') function andLogAndFinish (spec, tracker, done) { validate('SOF|SZF|OOF|OZF', [spec, tracker, done]) return (er, pkg) => { if (er) { - log.silly('fetchPackageMetaData', 'error for ' + String(spec), er.message) + er.message = replaceInfo(er.message) + var spc = replaceInfo(String(spec)) + log.silly('fetchPackageMetaData', 'error for ' + spc, er.message) if (tracker) tracker.finish() } return done(er, pkg) diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index 3e6f176ef..902ad7af9 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -12,6 +12,7 @@ var exitCode = 0 var rollbacks = npm.rollbacks var chain = require('slide').chain var errorMessage = require('./error-message.js') +var replaceInfo = require('./replace-info.js') var stopMetrics = require('./metrics.js').stop const cacheFile = require('./cache-file.js') @@ -175,14 +176,16 @@ function errorHandler (er) { ].forEach(function (k) { var v = er[k] if (!v) return + v = replaceInfo(v) log.verbose(k, v) }) log.verbose('cwd', process.cwd()) var os = require('os') + var args = replaceInfo(process.argv) log.verbose('', os.type() + ' ' + os.release()) - log.verbose('argv', process.argv.map(JSON.stringify).join(' ')) + log.verbose('argv', args.map(JSON.stringify).join(' ')) log.verbose('node', process.version) log.verbose('npm ', 'v' + npm.version) diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js index 3faa78f30..78ccdeeb5 100644 --- a/deps/npm/lib/utils/error-message.js +++ b/deps/npm/lib/utils/error-message.js @@ -3,12 +3,17 @@ var npm = require('../npm.js') var util = require('util') var nameValidator = require('validate-npm-package-name') var npmlog = require('npmlog') +var replaceInfo = require('./replace-info.js') module.exports = errorMessage function errorMessage (er) { var short = [] var detail = [] + + er.message = replaceInfo(er.message) + er.stack = replaceInfo(er.stack) + switch (er.code) { case 'ENOAUDIT': short.push(['audit', er.message]) diff --git a/deps/npm/lib/utils/replace-info.js b/deps/npm/lib/utils/replace-info.js new file mode 100644 index 000000000..a613a3755 --- /dev/null +++ b/deps/npm/lib/utils/replace-info.js @@ -0,0 +1,22 @@ +const URL = require('url') + +// replaces auth info in an array +// of arguments or in a strings +function replaceInfo (arg) { + const isArray = Array.isArray(arg) + const isString = typeof arg === 'string' + + if (!isArray && !isString) return arg + + const args = isString ? arg.split(' ') : arg + const info = args.map(arg => { + try { + const url = new URL(arg) + return url.password === '' ? arg : arg.replace(url.password, '***') + } catch (e) { return arg } + }) + + return isString ? info.join(' ') : info +} + +module.exports = replaceInfo
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor