Skip to content

Refuse an enclave FROST nonce drawn from a degraded source - #1113

Merged
kwsantiago merged 1 commit into
mainfrom
check-the-enclave-frost-nonce
Oct 22, 2026
Merged

kwsantiago merged 1 commit into
mainfrom
check-the-enclave-frost-nonce

Conversation

@kwsantiago

@kwsantiago kwsantiago commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The enclave's FROST round 1 draws its nonce through the same checked RNG as every other FROST nonce. A stuck or low-entropy source is refused, and the refusal does not open a signing session.
  • That check is one file, compiled into both keep-core and the enclave binary, so the enclave does not link the rest of the vault.

Test plan

  • keep-core checked-RNG tests, including a stuck source through round 1, plus the ed25519 variants
  • Entropy health tests
  • Enclave tests: a stuck source is refused, two round-1 commitments differ, and a 2-of-2 signature built from the enclave's round 1 verifies
  • CI

Summary by CodeRabbit

  • Security
    • Signing now checks the quality of generated randomness before creating a signing session. If the randomness is degraded or unavailable, the signing attempt is rejected rather than proceeding.
    • Entropy health checks now also account for repeated byte positions across samples, helping detect frozen output.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3eea65cf-6b3f-4e5d-aaa0-940ecd86e5b8
📥 Commits

Reviewing files that changed from the base of the PR and between 234ab98 and a68546c.

📒 Files selected for processing: 4
  • keep-core/src/entropy.rs
  • keep-core/src/frost/checked_rng.rs
  • keep-core/src/frost/mod.rs
  • keep-enclave/enclave/src/signer.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The change centralizes entropy health errors and draw checks in frost. Entropy sample validation uses those checks. FROST round one now checks nonce and commitment generation before storing a session, with tests for rejected draws and successful signing.

Changes

FROST entropy checks and signing

Layer / File(s) Summary
Shared entropy checks and error contract
keep-core/src/frost/checked_rng.rs, keep-core/src/frost/mod.rs
Defines EntropyHealthError and helpers that check nonzero, distinct draws, minimum Hamming distance, and frozen byte positions. Exports the error type and helpers.
Entropy sample validation
keep-core/src/entropy.rs
Requires all sample pairs to pass the shared checks and the frozen-position count to be within the configured limit.
Checked FROST round one
keep-enclave/enclave/src/signer.rs
Uses commit_checked for round-one nonce and commitment generation. A failed check returns before session creation. Tests cover refused draws, distinct commitments, and verifiable signatures.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Signer as EnclaveSigner
  participant CheckedRng as checked_rng::commit_checked
  participant SessionStore as store_round1
  Signer->>CheckedRng: Request checked nonce and commitment
  CheckedRng-->>Signer: Return commitment or entropy error
  alt Check succeeds
    Signer->>SessionStore: Store commitment and create session
    SessionStore-->>Signer: Return round-one result
  else Check fails
    Signer-->>Signer: Propagate error without creating session
  end
Loading

Suggested reviewers: wksantiago

Merge Risk: ⚪ Minimal · up to a6854

The enclave refuses a stuck nonce source without opening a signing session. No identified issue prevents merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 52.94% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: rejecting enclave FROST nonces from a degraded entropy source.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 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.

❤️ Share

A rabbit checks each draw with care,
For frozen bytes that linger there.
The signer waits for checks to pass,
Then stores the round, secure and fast.
A bright new signature hops through grass.

Comment @coderabbitai help to get the list of available commands.

@kwsantiago
kwsantiago merged commit 94f2e4a into main Oct 22, 2026
13 checks passed
@kwsantiago
kwsantiago deleted the check-the-enclave-frost-nonce branch October 22, 2026 22:35
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