Repository navigation
Conversation
A password, private key or web wallet export password prompt panicked with a stack trace when standard input was not a terminal. The command now says which value it could not ask for and which flag supplies it, and exits 1. Behaviour on a terminal is unchanged. AI disclosure: prepared with AI assistance (OpenAI Codex and Claude by Anthropic). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on: nothing.
Problem. Every command that asks for a hidden value (the wallet password, a private key for
import-private-key, a web wallet export's password) panicked with a Go stack trace when standard input was not a terminal, for example in a script or a pipe. The trace did not say which value was missing or that a flag supplies it.Change.
keys.GetSecret(prompt, flag)checks first whether standard input is a terminal. If it is not, the command prints which value it could not ask for and the flag that supplies it (--password,--private-keyor--export-password) and exits with status 1. On a terminal the prompt behaves as before; the Ctrl-C handler that restores the terminal is now also stopped when the read fails.GetPasswordkeeps its signature and names--password.Validation.
TestHiddenPromptNamesBypassFlagrunscreate,import-private-keyandimport-web-walletas child processes with standard input from a pipe and checks the message, the flag named and exit status 1; on the base all three panic and exit with status 2.TestReadPasswordWithoutTerminalchecks the error for a pipe directly; it calls the newreadPassword, and the old code panics on the same input.gofmt -l,go vet ./cmd/htnwallet/...andgo test -race -count=1 ./cmd/htnwallet/...pass with Go 1.27.4 on linux/amd64.Compatibility and limits. Only the error path changes: exit status 1 with a one-line message instead of a panic (exit status 2). A script that passes the value by flag is unaffected. Values cannot be read from a pipe; that remains a choice of this tool.
AI disclosure: prepared with AI assistance (OpenAI Codex and Claude by Anthropic).