Skip to content

Commit

Permalink
deps: @npmcli/redact@2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Apr 30, 2024
1 parent a7145d4 commit 80eec03
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 159 deletions.
5 changes: 0 additions & 5 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@
!/npm-pick-manifest
!/npm-profile
!/npm-registry-fetch
!/npm-registry-fetch/node_modules/
/npm-registry-fetch/node_modules/*
!/npm-registry-fetch/node_modules/@npmcli/
/npm-registry-fetch/node_modules/@npmcli/*
!/npm-registry-fetch/node_modules/@npmcli/redact
!/npm-user-validate
!/p-map
!/pacote
Expand Down
File renamed without changes.
25 changes: 5 additions & 20 deletions node_modules/@npmcli/redact/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
const { URL } = require('url')
const matchers = require('./matchers')
const { redactUrlPassword } = require('./utils')

const REPLACE = '***'
const TOKEN_REGEX = /\bnpm_[a-zA-Z0-9]{36}\b/g
const GUID_REGEX = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/g

const redact = (value) => {
if (typeof value !== 'string' || !value) {
return value
}

let urlValue
try {
urlValue = new URL(value)
} catch {
// If it's not a URL then we can ignore all errors
}

if (urlValue?.password) {
urlValue.password = REPLACE
value = urlValue.toString()
}

return value
.replace(TOKEN_REGEX, `npm_${REPLACE}`)
.replace(GUID_REGEX, REPLACE)
return redactUrlPassword(value, REPLACE)
.replace(matchers.NPM_SECRET.pattern, `npm_${REPLACE}`)
.replace(matchers.UUID.pattern, REPLACE)
}

// split on \s|= similar to how nopt parses options
Expand All @@ -49,7 +35,6 @@ const redactLog = (arg) => {
} else if (Array.isArray(arg)) {
return arg.map((a) => typeof a === 'string' ? splitAndRedact(a) : a)
}

return arg
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 8 additions & 2 deletions node_modules/@npmcli/redact/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"name": "@npmcli/redact",
"version": "1.1.0",
"version": "2.0.0",
"description": "Redact sensitive npm information from output",
"main": "lib/index.js",
"exports": {
".": "./lib/index.js",
"./server": "./lib/server.js",
"./package.json": "./package.json"
},
"scripts": {
"test": "tap",
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
Expand Down Expand Up @@ -32,7 +37,8 @@
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
],
"timeout": 120
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.2",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 5 additions & 14 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"@npmcli/map-workspaces": "^3.0.6",
"@npmcli/package-json": "^5.1.0",
"@npmcli/promise-spawn": "^7.0.1",
"@npmcli/redact": "^1.1.0",
"@npmcli/redact": "^2.0.0",
"@npmcli/run-script": "^8.1.0",
"@sigstore/tuf": "^2.3.2",
"abbrev": "^2.0.0",
Expand Down Expand Up @@ -1787,9 +1787,9 @@
}
},
"node_modules/@npmcli/redact": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-1.1.0.tgz",
"integrity": "sha512-PfnWuOkQgu7gCbnSsAisaX7hKOdZ4wSAhAzH3/ph5dSGau52kCRrMMGbiSQLwyTZpgldkZ49b0brkOr1AzGBHQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.0.tgz",
"integrity": "sha512-SEjCPAVHWYUIQR+Yn03kJmrJjZDtJLYpj300m3HV9OTRZNpC5YpbMsM3eTkECyT4aWj8lDr9WeY6TWefpubtYQ==",
"inBundle": true,
"engines": {
"node": "^16.14.0 || >=18.0.0"
Expand Down Expand Up @@ -9043,15 +9043,6 @@
"node": "^16.14.0 || >=18.0.0"
}
},
"node_modules/npm-registry-fetch/node_modules/@npmcli/redact": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@npmcli/redact/-/redact-2.0.0.tgz",
"integrity": "sha512-SEjCPAVHWYUIQR+Yn03kJmrJjZDtJLYpj300m3HV9OTRZNpC5YpbMsM3eTkECyT4aWj8lDr9WeY6TWefpubtYQ==",
"inBundle": true,
"engines": {
"node": "^16.14.0 || >=18.0.0"
}
},
"node_modules/npm-run-path": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
Expand Down Expand Up @@ -14979,7 +14970,7 @@
"@npmcli/node-gyp": "^3.0.0",
"@npmcli/package-json": "^5.1.0",
"@npmcli/query": "^3.1.0",
"@npmcli/redact": "^1.1.0",
"@npmcli/redact": "^2.0.0",
"@npmcli/run-script": "^8.1.0",
"bin-links": "^4.0.1",
"cacache": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@npmcli/map-workspaces": "^3.0.6",
"@npmcli/package-json": "^5.1.0",
"@npmcli/promise-spawn": "^7.0.1",
"@npmcli/redact": "^1.1.0",
"@npmcli/redact": "^2.0.0",
"@npmcli/run-script": "^8.1.0",
"@sigstore/tuf": "^2.3.2",
"abbrev": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@npmcli/node-gyp": "^3.0.0",
"@npmcli/package-json": "^5.1.0",
"@npmcli/query": "^3.1.0",
"@npmcli/redact": "^1.1.0",
"@npmcli/redact": "^2.0.0",
"@npmcli/run-script": "^8.1.0",
"bin-links": "^4.0.1",
"cacache": "^18.0.0",
Expand Down

0 comments on commit 80eec03

Please sign in to comment.