Skip to content

fix(crypto): keep VRF private key material out of debug output - #2145

Merged
nullPointerEnjoyer merged 2 commits into
masterfrom
fix/vrf-key-debug-redaction
Oct 18, 2026
Merged

nullPointerEnjoyer merged 2 commits into
masterfrom
fix/vrf-key-debug-redaction

Conversation

@nullPointerEnjoyer

Copy link
Copy Markdown
Collaborator

Problem

VRFPrivateKey, VRFPrivateKeyHolder and SchnorrkelPrivateKey derived Debug, which prints the full secret key material (the schnorrkel scalar and nonce in decimal). Since these types end up in the parsed command line options (e.g. a user-supplied --chain-genesis-staking-settings VRF key), a single {:?} of the options at startup wrote the complete secret to the node log.

ZeroizeOnDrop does not address this: the schnorrkel secret already wipes itself on drop, but Debug still prints it in full beforehand.

Change

  • Remove Debug from the derives of VRFPrivateKey, VRFPrivateKeyHolder (crypto/src/vrf/mod.rs) and SchnorrkelPrivateKey (crypto/src/vrf/schnorrkel/mod.rs) and add hand-written Debug impls that render <redacted>.
  • Add tests pinning the exact redacted rendering for each type.

Testing

  • cargo test -p crypto --lib (136 passed)
  • ./do_checks.sh

@github-actions

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

@nullPointerEnjoyer
nullPointerEnjoyer merged commit fbaec68 into master Oct 18, 2026
42 checks passed
@nullPointerEnjoyer
nullPointerEnjoyer deleted the fix/vrf-key-debug-redaction branch October 18, 2026 16:04
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