Skip to content

fix(session): zeroize enroll-path secret material (#1327) - #2

Merged
MichaelTaylor3d merged 1 commit into
mainfrom
fix/zeroize-enroll
Jul 20, 2026
Merged

fix(session): zeroize enroll-path secret material (#1327)#2
MichaelTaylor3d merged 1 commit into
mainfrom
fix/zeroize-enroll

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

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

@MichaelTaylor3d
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 MichaelTaylor3d changed the title harden(session): zeroize enroll-path secret material (#1327) fix(session): zeroize enroll-path secret material (#1327) Jul 20, 2026

@MichaelTaylor3d MichaelTaylor3d left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_bls remains (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.

@MichaelTaylor3d
MichaelTaylor3d merged commit ad588ed into main Jul 20, 2026
8 of 9 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the fix/zeroize-enroll branch July 20, 2026 19:39
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.

1 participant