Skip to content

feat: add password masking for API auth token input - #21

Closed
kaichen wants to merge 1 commit into
mainfrom
feature/cli-updates
Closed

feat: add password masking for API auth token input#21
kaichen wants to merge 1 commit into
mainfrom
feature/cli-updates

Conversation

@kaichen

@kaichen kaichen commented Oct 16, 2025

Copy link
Copy Markdown
Owner

Summary

  • Add password masking functionality to hide API auth tokens during CLI input
  • Prevent token exposure by displaying asterisks instead of actual characters
  • Support backspace, Ctrl+C for better user experience during token entry

Changes

  • Add promptForPassword utility function with masking and key handling
  • Update promptForTokenForProvider to use masked input
  • Refactor promptForAuthToken to use new password masking utility
  • Improve security by preventing token visibility during CLI authentication

Test plan

  • Test CLI token input with masking (asterisks displayed)
  • Test backspace functionality during token entry
  • Test Ctrl+C to cancel token entry
  • Verify token is properly captured and stored
  • Test with different providers requiring auth tokens

🤖 Generated with Claude Code

- Add promptForPassword function to hide auth token input with asterisks
- Update promptForTokenForProvider to use masked input
- Refactor promptForAuthToken to use new password masking utility
- Improve security by preventing token exposure during CLI input

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment thread lib/utils.js
Comment on lines +167 to +183
async function promptForPassword(promptText = 'Please enter your API Auth Token: ') {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
output: null // Hide input
});

return new Promise((resolve) => {
rl.question('Please enter your API Auth Token: ', (authToken) => {
rl.close();
resolve(authToken.trim());
let password = '';
let asterisks = '';

// Write the prompt
process.stdout.write(promptText);

// Handle keypress events for password masking
process.stdin.on('keypress', (char, key) => {
if (key && key.name === 'return') {
// Enter key pressed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Password prompt never captures input

The new promptForPassword adds a process.stdin.on('keypress') handler but never enables keypress events on the stream. Because the readline interface is constructed with output: null, it is not in terminal mode and readline.emitKeypressEvents(process.stdin) is never invoked, so no keypress events fire and the promise is never resolved when the user hits Enter. As a result, any code path that requests an auth token (e.g., creating a provider profile) will hang indefinitely waiting for input.

Useful? React with 👍 / 👎.

@kaichen kaichen closed this Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant