Skip to content

Commit 17d97d2

Browse files
committed
fix: use @npmcli/redact for log redactions
Closes #7314
1 parent 5469614 commit 17d97d2

File tree

16 files changed

+149
-155
lines changed

16 files changed

+149
-155
lines changed

DEPENDENCIES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ graph LR;
127127
npm-->npmcli-mock-registry["@npmcli/mock-registry"];
128128
npm-->npmcli-package-json["@npmcli/package-json"];
129129
npm-->npmcli-promise-spawn["@npmcli/promise-spawn"];
130+
npm-->npmcli-redact["@npmcli/redact"];
130131
npm-->npmcli-run-script["@npmcli/run-script"];
131132
npm-->npmcli-smoke-tests["@npmcli/smoke-tests"];
132133
npm-->npmcli-template-oss["@npmcli/template-oss"];
@@ -541,6 +542,7 @@ graph LR;
541542
npm-->npmcli-mock-registry["@npmcli/mock-registry"];
542543
npm-->npmcli-package-json["@npmcli/package-json"];
543544
npm-->npmcli-promise-spawn["@npmcli/promise-spawn"];
545+
npm-->npmcli-redact["@npmcli/redact"];
544546
npm-->npmcli-run-script["@npmcli/run-script"];
545547
npm-->npmcli-smoke-tests["@npmcli/smoke-tests"];
546548
npm-->npmcli-template-oss["@npmcli/template-oss"];
@@ -831,4 +833,4 @@ packages higher up the chain.
831833
- @npmcli/git, make-fetch-happen, @npmcli/config
832834
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, read-package-json, promzard
833835
- @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, normalize-package-data, npm-packlist, bin-links, nopt, npmlog, parse-conflict-json, @npmcli/mock-globals, read
834-
- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, minify-registry-metadata, ini, @npmcli/disparity-colors, mute-stream, npm-audit-report, npm-user-validate
836+
- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, minify-registry-metadata, ini, @npmcli/disparity-colors, mute-stream, @npmcli/redact, npm-audit-report, npm-user-validate

lib/commands/adduser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const log = require('../utils/log-shim.js')
2-
const replaceInfo = require('../utils/replace-info.js')
2+
const { redactLog: replaceInfo } = require('@npmcli/redact')
33
const auth = require('../utils/auth.js')
44

55
const BaseCommand = require('../base-command.js')

lib/commands/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const log = require('../utils/log-shim.js')
2-
const replaceInfo = require('../utils/replace-info.js')
2+
const { redactLog: replaceInfo } = require('@npmcli/redact')
33
const auth = require('../utils/auth.js')
44

55
const BaseCommand = require('../base-command.js')

lib/commands/publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const runScript = require('@npmcli/run-script')
66
const pacote = require('pacote')
77
const npa = require('npm-package-arg')
88
const npmFetch = require('npm-registry-fetch')
9-
const replaceInfo = require('../utils/replace-info.js')
9+
const { redactLog: replaceInfo } = require('@npmcli/redact')
1010

1111
const otplease = require('../utils/otplease.js')
1212
const { getContents, logTar } = require('../utils/tar.js')

lib/npm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const LogFile = require('./utils/log-file.js')
1212
const Timers = require('./utils/timers.js')
1313
const Display = require('./utils/display.js')
1414
const log = require('./utils/log-shim')
15-
const replaceInfo = require('./utils/replace-info.js')
15+
const { redactLog: replaceInfo } = require('@npmcli/redact')
1616
const updateNotifier = require('./utils/update-notifier.js')
1717
const pkg = require('../package.json')
1818
const { deref } = require('./utils/cmd-list.js')

lib/utils/audit-error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const log = require('./log-shim')
2-
const replaceInfo = require('./replace-info.js')
2+
const { redactLog: replaceInfo } = require('@npmcli/redact')
33

44
// print an error or just nothing if the audit report has an error
55
// this is called by the audit command, and by the reify-output util

lib/utils/error-message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { format } = require('util')
22
const { resolve } = require('path')
33
const nameValidator = require('validate-npm-package-name')
4-
const replaceInfo = require('./replace-info.js')
4+
const { redactLog: replaceInfo } = require('@npmcli/redact')
55
const { report } = require('./explain-eresolve.js')
66
const log = require('./log-shim')
77

lib/utils/exit-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require('fs')
33

44
const log = require('./log-shim.js')
55
const errorMessage = require('./error-message.js')
6-
const replaceInfo = require('./replace-info.js')
6+
const { redactLog: replaceInfo } = require('@npmcli/redact')
77

88
let npm = null // set by the cli
99
let exitHandlerCalled = false

lib/utils/replace-info.js

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

node_modules/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
!/@npmcli/package-json
3434
!/@npmcli/promise-spawn
3535
!/@npmcli/query
36+
!/@npmcli/redact
3637
!/@npmcli/run-script
3738
!/@pkgjs/
3839
/@pkgjs/*

0 commit comments

Comments
 (0)