-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fix/issue #286 #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/issue #286 #365
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,6 +166,24 @@ if (isCli) { | |
password = buffer.toString("hex"); | ||
} | ||
|
||
// If CLI password was provided, obsfucate password from process title | ||
if (options.password) { | ||
const parts = [process.title]; | ||
for (let i = 2; i < process.argv.length; i++) { | ||
if (process.argv[i].startsWith("--password=")) { | ||
parts.push(process.argv[i].replace(/=.*/, "=****")); | ||
} else if (process.argv[i] === "--password") { | ||
parts.push(process.argv[i++], "****") | ||
} else if (process.argv[i] === "--") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another unfortunate edge case comes to mind:
That is, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's possible we should use an environment variable and/or configuration file instead of a command line argument for the password. Or possibly a prompt, although I'm not really keen on that solution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we have another issue for that #349 |
||
parts.push(...process.argv.slice(i)); | ||
break; | ||
} else { | ||
parts.push(process.argv[i]); | ||
} | ||
} | ||
process.title = parts.join(" "); | ||
} | ||
|
||
const hasCustomHttps = certData && certKeyData; | ||
const app = await createApp({ | ||
allowHttp: options.allowHttp, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I didn't include
-P
in my example but we'll need that as well. No need to check for-P=
though since=
isn't used with short options.