Repository navigation
fix(key-wallet): keep chain codes and mnemonic words out of Debug output - #1265
Conversation
The Debug of ExtendedPrivKey, ExtendedBLSPrivKey and
ExtendedEd25519PrivKey printed the chain code, and RootExtendedPrivKey's
derived Debug printed its chain code. Mnemonic's derived Debug went
through bip39::Mnemonic, which with bip39 2.2.0 (still allowed by the
version requirement) lists the word indices that spell out the phrase.
A logged `{:?}` of any of them, or of a Wallet holding them, showed that
data. The extended private keys now omit the chain code,
RootExtendedPrivKey prints `RootExtendedPrivKey { .. }`, and Mnemonic
prints its language and word count whatever bip39 version is resolved.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Redact secret material from debug output key-wallet/src/bip32.rs, key-wallet/src/derivation_bls_bip32.rs, key-wallet/src/derivation_slip10.rs, key-wallet/src/mnemonic.rs, key-wallet/src/wallet/root_extended_keys.rs, key-wallet/tests/key_debug_tests.rs, CHANGELOG.md |
Extended private-key debug output omits chain codes. Mnemonic output shows the language and word count, and root extended private-key output uses a fixed redacted representation. Tests check that secret representations do not appear in debug output. The changelog records these changes. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to aa254
-
The change provides the intended secret-safe Debug output, with no concrete merge-blocking issue identified.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 6 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- 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.
|
Bots are done — your move: post |
|
/self-reviewed |
|
Policy satisfied — this can merge. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1265 +/- ##
==========================================
+ Coverage 80.50% 80.69% +0.18%
==========================================
Files 291 291
Lines 77463 77743 +280
==========================================
+ Hits 62364 62736 +372
+ Misses 15099 15007 -92
|
Debugoutput of somekey-walletprivate key types prints what they hold. TheDebugofExtendedPrivKey,ExtendedBLSPrivKeyandExtendedEd25519PrivKeyprints the chain code.RootExtendedPrivKeyderivesDebug, so it prints its chain code too (its private key already shows asEcdsaSecretKey(..)).MnemonicderivesDebugthroughbip39::Mnemonic. With bip39 2.2.0, whichbip39 = "2.2.0"still allows, that lists the word indices, and those spell out the phrase (later bip39 versions print only the language). A logged{:?}of any of them, or of aWalletthat holds them, exposes that data.This change:
DebugofExtendedPrivKey,ExtendedBLSPrivKeyandExtendedEd25519PrivKey; they keep network, depth, parent fingerprint and child number;RootExtendedPrivKeyaDebugthat printsRootExtendedPrivKey { .. };Mnemonicits ownDebugthat prints only the language and word count, whichever bip39 version is resolved.SeedandEcdsaSecretKeyalready redact theirs.Tested by new tests in
key-wallet/tests/key_debug_tests.rs. They check that{:?}and{:#?}show neither the chain code nor the private key (as hex or as a byte array) and no phrase word or word index. All five fail without the change. With bip39 2.2.1 or later, theMnemonictest fails only on its exact-output assertion, since that bip39 already omits the indices.🤖 Generated with Claude Code
PR Hygiene ·
aa254ccCHANGELOG.md) — approved by xdustinfacekey-wallet(key-wallet/src/bip32.rs,key-wallet/src/derivation_bls_bip32.rs,key-wallet/src/derivation_slip10.rsand 3 more) — approved by xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit