Skip to content

Commit

Permalink
Format redacted arg lines
Browse files Browse the repository at this point in the history
Pushing straight to main again.
  • Loading branch information
code-asher committed May 5, 2023
1 parent 3f7db15 commit 5708e6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
15 changes: 6 additions & 9 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,7 @@ export const parse = (
throw new Error("--cert-key is missing")
}

logger.debug(() => [
`parsed ${opts?.configFile ? "config" : "command line"}`,
field("args", redactArgs(args)),
])
logger.debug(() => [`parsed ${opts?.configFile ? "config" : "command line"}`, field("args", redactArgs(args))])

return args
}
Expand All @@ -446,11 +443,11 @@ export const parse = (
*/
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,
}
...args,
password: args.password ? "<redacted>" : undefined,
"hashed-password": args["hashed-password"] ? "<redacted>" : undefined,
"github-auth": args["github-auth"] ? "<redacted>" : undefined,
}
}

/**
Expand Down
11 changes: 7 additions & 4 deletions src/node/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ export class ChildProcess extends Process {
},
this.logger,
)
this.logger.debug("got message", field("message", {
type: message.type,
args: redactArgs(message.args),
}))
this.logger.debug(
"got message",
field("message", {
type: message.type,
args: redactArgs(message.args),
}),
)
return message.args
}

Expand Down

0 comments on commit 5708e6c

Please sign in to comment.