Skip to content

Commit 321e370

Browse files
kadarbashaGar
authored andcommitted
fix: url logging npm credentials
1 parent 5eba860 commit 321e370

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/remote.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const fetch = require('minipass-fetch')
33
const { promiseRetry } = require('@gar/promise-retry')
44
const ssri = require('ssri')
55
const { log } = require('proc-log')
6+
const { redact: cleanUrl } = require('@npmcli/redact')
67

78
const CachingMinipassPipeline = require('./pipeline.js')
89
const { getAgent } = require('@npmcli/agent')
@@ -55,6 +56,7 @@ const remoteFetch = (request, options) => {
5556

5657
return promiseRetry(async (retryHandler, attemptNum) => {
5758
const req = new fetch.Request(request, _opts)
59+
const url = cleanUrl(req.url)
5860
try {
5961
let res = await fetch(req, _opts)
6062
if (_opts.integrity && res.status === 200) {
@@ -92,7 +94,7 @@ const remoteFetch = (request, options) => {
9294
}
9395

9496
/* eslint-disable-next-line max-len */
95-
log.http('fetch', `${req.method} ${req.url} attempt ${attemptNum} failed with ${res.status}`)
97+
log.http('fetch', `${req.method} ${url} attempt ${attemptNum} failed with ${res.status}`)
9698
return retryHandler(res)
9799
}
98100

@@ -116,7 +118,7 @@ const remoteFetch = (request, options) => {
116118
options.onRetry(err)
117119
}
118120

119-
log.http('fetch', `${req.method} ${req.url} attempt ${attemptNum} failed with ${err.code}`)
121+
log.http('fetch', `${req.method} ${url} attempt ${attemptNum} failed with ${err.code}`)
120122
return retryHandler(err)
121123
}
122124
}, options.retry).catch((err) => {

0 commit comments

Comments
 (0)