Skip to content

Minor security hardening: nonce scrub - #21

Merged
nadimkobeissi merged 5 commits into
symbolicsoft:mainfrom
10d9e:security/minor-hardening
Jul 28, 2026
Merged

Minor security hardening: nonce scrub#21
nadimkobeissi merged 5 commits into
symbolicsoft:mainfrom
10d9e:security/minor-hardening

Conversation

@10d9e

@10d9e 10d9e commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Per-message nonce scrubbing. Context::seal/open computed the nonce (derived from the secret base_nonce) into a plain stack array. It's now wrapped in Zeroizing. Pure defense-in-depth: nonce knowledge without the key doesn't endanger the AEAD, but the crate scrubs everything else it derives, and this closes the one exception.

Testing

cargo test --features pq,kat-internals — all suites pass, including the new small-order-decap test. cargo clippy --all-targets clean.

🤖 Generated with Claude Code

… unused serde feature

Three small items from a security review of v0.1.0:

- DHKEM decap/auth_decap now report the RFC 9180 §7.1.4 all-zeros
  shared-secret rejection as DecapError instead of leaking the
  encap-side EncapError label through the receiver path. Adds a
  regression test.
- Context::seal/open wrap the per-message nonce in Zeroizing so the
  stack copy derived from the secret base_nonce is scrubbed after the
  AEAD call (defense-in-depth; the nonce alone does not endanger the
  AEAD).
- Remove the 'serde' optional dependency and feature: nothing in the
  crate uses it, and its presence invites accidental serialization of
  key material in a future change. Reintroduce deliberately if wire
  serialization is ever designed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nadimkobeissi

Copy link
Copy Markdown
Member

Please don't spam AI-generated PRs.

@10d9e

10d9e commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

hi @nadimkobeissi - could you suggest a preferred alternative method? just trying to close security gaps here in order to get this into our stack. (flagged by Mythos, confirmed by humans)

is there something pragmatically wrong with the PR itself?

@nadimkobeissi

Copy link
Copy Markdown
Member

None of your PRs address "security gaps." They're a small avalanche of minor nits.

@10d9e

10d9e commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

ok, unfortunately i'll have to run a patched fork instead to get these issues resolved. thank you for your feedback.

@nadimkobeissi nadimkobeissi reopened this Jul 24, 2026
@nadimkobeissi

Copy link
Copy Markdown
Member

@10d9e If you can fix the merge conflict and remove the useless Claude comments everywhere, I'll take another look at this. I merged your other PRs.

@10d9e 10d9e changed the title Minor security hardening: decap error labeling, nonce scrubbing, unused serde feature Minor security hardening: nonce scrub Jul 28, 2026
@10d9e

10d9e commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@10d9e If you can fix the merge conflict and remove the useless Claude comments everywhere, I'll take another look at this. I merged your other PRs.

should be gtg now. thanks for your review! (and especially thanks for this wonderful library)

@nadimkobeissi
nadimkobeissi merged commit 778849c into symbolicsoft:main Jul 28, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants