security: suppress mnemonic display in non-TTY contexts
Mnemonic was printed unconditionally to stderr, leaking into CI logs, piped output, and terminal scroll buffers.
New behaviour mirrors GPG / ssh-keygen: - stderr is a TTY → show full mnemonic box (user is watching, can write it down) - stderr is not a TTY → suppress mnemonic; print word count + hint to re-run interactively in a terminal
Add _stderr_isatty() module hook for test monkeypatching. Add 9 tests in test_auth_mnemonic_display.py covering both paths and the JSON boundary (mnemonic_word_count preserved, plaintext never in stdout). Update test_hd_keygen_unified.py to patch _stderr_isatty when asserting the mnemonic appears in output.
sha256:5e946ca6a85d4bbd868aa9e0e9789b9714596c93ac80a468deb871d834212485
sha
+28
~3
symbols
sha256:17c0c1d83636bef7a356409324b69e63a9a7692796002f9154b54d71dfca1fd6
snapshot
+28
symbols added
~3
symbols modified
0
dead code introduced
Semantic Changes
31 symbols
+
test_III1_mnemonic_absent_json_plus_non_tty
method
method test_III1_mnemonic_absent_json_plus_non_tty L184–191
+
test_III2_mnemonic_never_in_json_payload
method
method test_III2_mnemonic_never_in_json_payload L193–205
+
test_I3_output_hints_to_run_interactively
method
method test_I3_output_hints_to_run_interactively L110–119
+
test_I4_json_has_word_count_not_plaintext
method
method test_I4_json_has_word_count_not_plaintext L121–131
+
test_II2_displayed_mnemonic_is_valid_bip39
method
method test_II2_displayed_mnemonic_is_valid_bip39 L150–164
+
test_II3_json_word_count_correct_on_tty
method
method test_II3_json_word_count_correct_on_tty L166–175
0 comments
To add a comment, use the Muse CLI:
muse hub commit comment sha256:5e946ca6a85d4bbd868aa9e0e9789b9714596c93ac80a468deb871d834212485 --body "your comment"
No comments yet. Be the first to start the discussion.