Description
The API-key setup prompt is implemented with the normal text() prompt rather than masked/password input. The prompt therefore echoes the secret as it is typed into the terminal.
The warning text says the key will be stored in config, but it does not warn that the interactive input itself is visible on screen.
Location
src/commands/init.ts:148-157 — promptApiKey()
src/commands/init.ts:126-133 — buildApiKeyPrompt()
Relevant code
const existingKey = existingConfig?.apiKey ?? process.env[provider.apiKeyEnv] ?? '';
const keyResult = await text(buildApiKeyPrompt(existingKey, provider.apiKeyEnv));
buildApiKeyPrompt() only supplies the message and placeholder; the returned options do not configure masked input.
Steps to Reproduce
- Run
commit-echo init.
- Select a provider that requires an API key.
- Type an API key into the prompt.
- Observe that the entered characters are rendered in the terminal like ordinary text input.
Expected Behavior
Secret input should be masked while typing, consistent with password/credential prompts.
Actual Behavior
The API key is echoed to the terminal as it is entered, exposing it to anyone viewing or recording the terminal session.
Suggested Fix
Use the prompt library's password/masked input mode for API keys. Keep the non-secret placeholder and existing-key messaging, but never display the credential characters themselves.
Impact
Users can disclose provider credentials to people looking at the terminal or to terminal/session recordings.
Reviewed against current main at 6c01ad0a853501e9617a3af0a5db3b515dd8ed53.
Description
The API-key setup prompt is implemented with the normal
text()prompt rather than masked/password input. The prompt therefore echoes the secret as it is typed into the terminal.The warning text says the key will be stored in config, but it does not warn that the interactive input itself is visible on screen.
Location
src/commands/init.ts:148-157—promptApiKey()src/commands/init.ts:126-133—buildApiKeyPrompt()Relevant code
buildApiKeyPrompt()only supplies the message and placeholder; the returned options do not configure masked input.Steps to Reproduce
commit-echo init.Expected Behavior
Secret input should be masked while typing, consistent with password/credential prompts.
Actual Behavior
The API key is echoed to the terminal as it is entered, exposing it to anyone viewing or recording the terminal session.
Suggested Fix
Use the prompt library's password/masked input mode for API keys. Keep the non-secret placeholder and existing-key messaging, but never display the credential characters themselves.
Impact
Users can disclose provider credentials to people looking at the terminal or to terminal/session recordings.
Reviewed against current
mainat6c01ad0a853501e9617a3af0a5db3b515dd8ed53.