Skip to content

Commit 80eec03

Browse files
committed
deps: @npmcli/redact@2.0.0
1 parent a7145d4 commit 80eec03

File tree

13 files changed

+20
-159
lines changed

13 files changed

+20
-159
lines changed

node_modules/.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@
158158
!/npm-pick-manifest
159159
!/npm-profile
160160
!/npm-registry-fetch
161-
!/npm-registry-fetch/node_modules/
162-
/npm-registry-fetch/node_modules/*
163-
!/npm-registry-fetch/node_modules/@npmcli/
164-
/npm-registry-fetch/node_modules/@npmcli/*
165-
!/npm-registry-fetch/node_modules/@npmcli/redact
166161
!/npm-user-validate
167162
!/p-map
168163
!/pacote

node_modules/@npmcli/redact/lib/index.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,15 @@
1-
const { URL } = require('url')
1+
const matchers = require('./matchers')
2+
const { redactUrlPassword } = require('./utils')
23

34
const REPLACE = '***'
4-
const TOKEN_REGEX = /\bnpm_[a-zA-Z0-9]{36}\b/g
5-
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
65

76
const redact = (value) => {
87
if (typeof value !== 'string' || !value) {
98
return value
109
}
11-
12-
let urlValue
13-
try {
14-
urlValue = new URL(value)
15-
} catch {
16-
// If it's not a URL then we can ignore all errors
17-
}
18-
19-
if (urlValue?.password) {
20-
urlValue.password = REPLACE
21-
value = urlValue.toString()
22-
}
23-
24-
return value
25-
.replace(TOKEN_REGEX, `npm_${REPLACE}`)
26-
.replace(GUID_REGEX, REPLACE)
10+
return redactUrlPassword(value, REPLACE)
11+
.replace(matchers.NPM_SECRET.pattern, `npm_${REPLACE}`)
12+
.replace(matchers.UUID.pattern, REPLACE)
2713
}
2814

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

node_modules/@npmcli/redact/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"name": "@npmcli/redact",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"description": "Redact sensitive npm information from output",
55
"main": "lib/index.js",
6+
"exports": {
7+
".": "./lib/index.js",
8+
"./server": "./lib/server.js",
9+
"./package.json": "./package.json"
10+
},
611
"scripts": {
712
"test": "tap",
813
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
@@ -32,7 +37,8 @@
3237
"nyc-arg": [
3338
"--exclude",
3439
"tap-snapshots/**"
35-
]
40+
],
41+
"timeout": 120
3642
},
3743
"devDependencies": {
3844
"@npmcli/eslint-config": "^4.0.2",

node_modules/npm-registry-fetch/node_modules/@npmcli/redact/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

node_modules/npm-registry-fetch/node_modules/@npmcli/redact/lib/index.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

node_modules/npm-registry-fetch/node_modules/@npmcli/redact/package.json

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)