Redact sensitive args from handshake debug log

This commit is contained in:
Asher
2023-05-04 10:54:41 -08:00
parent 8c99f41b90
commit 3f7db15fde
2 changed files with 21 additions and 8 deletions

View File

@@ -435,15 +435,22 @@ export const parse = (
logger.debug(() => [
`parsed ${opts?.configFile ? "config" : "command line"}`,
field("args", {
field("args", redactArgs(args)),
])
return args
}
/**
* Redact sensitive information from arguments for logging.
*/
export const redactArgs = (args: UserProvidedArgs): UserProvidedArgs => {
return {
...args,
password: args.password ? "<redacted>" : undefined,
"hashed-password": args["hashed-password"] ? "<redacted>" : undefined,
"github-auth": args["github-auth"] ? "<redacted>" : undefined,
}),
])
return args
}
}
/**