mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
fix(logs): err serializer strip secrets
This commit is contained in:
parent
7be889e315
commit
3da629247e
1 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
const is = require('@sindresorhus/is');
|
||||
|
||||
module.exports = errSerializer;
|
||||
|
||||
function errSerializer(err) {
|
||||
|
@ -22,5 +24,14 @@ function errSerializer(err) {
|
|||
) {
|
||||
response.gotOptions.headers.authorization = '** redacted **';
|
||||
}
|
||||
const redactedFields = ['message', 'stack', 'stdout', 'stderr'];
|
||||
for (const field of redactedFields) {
|
||||
if (is.string(response[field])) {
|
||||
response[field] = response[field].replace(
|
||||
/https:\/\/[^@]*@/g,
|
||||
'https://**redacted**@'
|
||||
);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue