Skip to content

fix(htnwallet): name the flag when a hidden prompt has no terminal - #132

Merged
MattF42 merged 1 commit into
HoosatNetwork:2.19.2from
Evern00b-fi:fix/htnwallet-hidden-prompt-no-terminal
Nov 30, 2026
Merged

MattF42 merged 1 commit into
HoosatNetwork:2.19.2from
Evern00b-fi:fix/htnwallet-hidden-prompt-no-terminal

Conversation

@Evern00b-fi

Copy link
Copy Markdown

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-key or --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. GetPassword keeps its signature and names --password.

Validation. TestHiddenPromptNamesBypassFlag runs create, import-private-key and import-web-wallet as 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. TestReadPasswordWithoutTerminal checks the error for a pipe directly; it calls the new readPassword, and the old code panics on the same input. gofmt -l, go vet ./cmd/htnwallet/... and go 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).

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>
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8e7c8998-fa53-4366-a7d3-82fe44f8b9f9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@MattF42
MattF42 merged commit 550d28b into HoosatNetwork:2.19.2 Nov 30, 2026
5 checks passed
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.

2 participants