diff --git a/node_modules/@npmcli/redact/lib/deep-map.js b/node_modules/@npmcli/redact/lib/deep-map.js index ad042dbdfc534..b555cf9fc4c8b 100644 --- a/node_modules/@npmcli/redact/lib/deep-map.js +++ b/node_modules/@npmcli/redact/lib/deep-map.js @@ -1,4 +1,28 @@ +function filterError (input) { + return { + errorType: input.name, + message: input.message, + stack: input.stack, + ...(input.code ? { code: input.code } : {}), + ...(input.statusCode ? { statusCode: input.statusCode } : {}), + } +} + const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) => { + // this is in an effort to maintain bole's error logging behavior + if (path.join('.') === '$' && input instanceof Error) { + return deepMap({ err: filterError(input) }, handler, path, seen) + } + if (input instanceof Error) { + return deepMap(filterError(input), handler, path, seen) + } + if (input instanceof Buffer) { + return `[unable to log instanceof buffer]` + } + if (input instanceof Uint8Array) { + return `[unable to log instanceof Uint8Array]` + } + if (Array.isArray(input)) { const result = [] for (let i = 0; i < input.length; i++) { @@ -21,11 +45,6 @@ const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) } else if (typeof input === 'object' || typeof input === 'function') { const result = {} - if (input instanceof Error) { - // `name` property is not included in `Object.getOwnPropertyNames(error)` - result.errorType = input.name - } - for (const propertyName of Object.getOwnPropertyNames(input)) { // skip logging internal properties if (propertyName.startsWith('_')) { diff --git a/node_modules/@npmcli/redact/package.json b/node_modules/@npmcli/redact/package.json index 2bcee9ea0884b..831387ca54106 100644 --- a/node_modules/@npmcli/redact/package.json +++ b/node_modules/@npmcli/redact/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/redact", - "version": "2.0.0", + "version": "2.0.1", "description": "Redact sensitive npm information from output", "main": "lib/index.js", "exports": { diff --git a/package-lock.json b/package-lock.json index 8698253d71537..03c1ffb10f476 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,7 +93,7 @@ "@npmcli/map-workspaces": "^3.0.6", "@npmcli/package-json": "^5.2.0", "@npmcli/promise-spawn": "^7.0.2", - "@npmcli/redact": "^2.0.0", + "@npmcli/redact": "^2.0.1", "@npmcli/run-script": "^8.1.0", "@sigstore/tuf": "^2.3.4", "abbrev": "^2.0.0", @@ -1760,9 +1760,9 @@ } }, "node_modules/@npmcli/redact": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.0.tgz", - "integrity": "sha512-SEjCPAVHWYUIQR+Yn03kJmrJjZDtJLYpj300m3HV9OTRZNpC5YpbMsM3eTkECyT4aWj8lDr9WeY6TWefpubtYQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.1.tgz", + "integrity": "sha512-YgsR5jCQZhVmTJvjduTOIHph0L73pK8xwMVaDY0PatySqVM9AZj93jpoXYSJqfHFxFkN9dmqTw6OiqExsS3LPw==", "inBundle": true, "license": "ISC", "engines": { diff --git a/package.json b/package.json index ed17a8e340de7..b2387fd145964 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@npmcli/map-workspaces": "^3.0.6", "@npmcli/package-json": "^5.2.0", "@npmcli/promise-spawn": "^7.0.2", - "@npmcli/redact": "^2.0.0", + "@npmcli/redact": "^2.0.1", "@npmcli/run-script": "^8.1.0", "@sigstore/tuf": "^2.3.4", "abbrev": "^2.0.0",