fix(session): zeroize enroll-path secret material (#1327) - #2
Merged
Conversation
MichaelTaylor3d
force-pushed
the
fix/zeroize-enroll
branch
from
July 20, 2026 19:27
1f0bd43 to
677eb94
Compare
MichaelTaylor3d
marked this pull request as ready for review
July 20, 2026 19:27
Confine the transient chia_bls::SecretKey master/identity_sk scalars to the narrowest scope in enroll_identity and drop them immediately after extracting the canonical bytes; wrap the 32-byte to_bytes() stack temporary in Zeroizing so every secret byte buffer the crate owns is wiped on drop. The foreign chia_bls::SecretKey type has no Zeroize/Drop impl (true even at chia-bls 0.46), so its scalar cannot be wiped in place; narrow the Cargo.toml + SPEC.md zeroize claim to what is honestly delivered (owned byte buffers are zeroized; foreign scalar wipe relied upon from upstream). Drop the unused direct chia-bls dependency. Bump to v0.1.1 (patch, custody hardening, no API change). Co-Authored-By: Claude <noreply@anthropic.com>
MichaelTaylor3d
force-pushed
the
fix/zeroize-enroll
branch
from
July 20, 2026 19:28
677eb94 to
ccd9505
Compare
MichaelTaylor3d
commented
Jul 20, 2026
MichaelTaylor3d
left a comment
Contributor
Author
There was a problem hiding this comment.
PASS (correctness gate, diff-scoped — v0.1.1 zeroize hardening for #1327).
Reviewed ONLY the fix diff (0.1.0 crate correctness already cleared).
- Behaviour-preserving: enroll_identity now derives inside an inner block that drops the transient chia_bls::SecretKey scalars (master/identity_sk) immediately after byte extraction; the returned Zeroizing<Vec> carries the same canonical bytes, so no parity regression. unlock/sign/public_key/inject_into untouched. Block-scope drop is reached on all paths and compiles.
- to_bytes() 32-byte temp wrapped in Zeroizing before the copy into the returned Vec; returned buffer stays Zeroizing. Owned secret buffers are wiped on drop.
- Dropping the direct chia-bls dep is safe: no live
use chia_blsremains (only doc/WHY comments); rust build + Test Suite green confirm transitive resolution. - Version 0.1.0->0.1.1 (patch, no-API-change hardening) correct; Cargo.toml + Cargo.lock consistent; version-increment gate green.
- SPEC 'Enrollment-derivation hygiene' invariant, CHANGELOG 0.1.1 entry, and the narrowed zeroize comment are accurate to the code (owned buffers zeroized; foreign scalars confined+dropped, full wipe relied-upon upstream + tracked) and read cleanly (§2.5).
- New test enroll_then_drop_leaves_key_reproducible_without_panic is meaningful: asserts canonical-key reproducibility + unlock-after-drop, not merely no-panic. Coverage gate 98.25% >= 80%.
- Commitlint green (fix(session): — repo type-enum lacks 'harden', fix used correctly). All 8 required checks green; zero unresolved threads.
Verdict: PASS. Orchestrator owns merge.
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.
WIP. Fixes the dig-session zeroize custody gap (#1327): in enroll_identity the transient chia_bls::SecretKey master/identity_sk scalars drop un-wiped. Minimizing their lifetime, routing every byte buffer we control through Zeroizing, and narrowing the zeroize claim to what is honestly delivered. Bumps to v0.1.1.
Blast radius: session.rs enroll_identity only; public API of Session/UnlockedIdentity unchanged (additive/patch).
Closes DIG-Network/dig_ecosystem#1327