Skip to content

fix(drive): handle malicious quorum_type without panicking#3288

Merged
QuantumExplorer merged 3 commits into
v3.1-devfrom
test/prove-quorum-type-panic
Mar 15, 2026
Merged

fix(drive): handle malicious quorum_type without panicking#3288
QuantumExplorer merged 3 commits into
v3.1-devfrom
test/prove-quorum-type-panic

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Mar 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix client-side panic when a malicious node returns an out-of-range quorum_type in proof responses
  • Replace expect() on untrusted input with proper error propagation

Issue

verify_tenderdash_proof used .expect() on the result of quorum_type.try_into(), where quorum_type is a u32 from an untrusted gRPC response. Any node could crash any client by serving quorum_type = u32::MAX.

Test plan

  • Test verifies error is returned (not panic) for out-of-range quorum_type
  • cargo test passes
  • cargo clippy clean

🤖 Generated with Claude Code

Add a test that demonstrates a security finding: `verify_tenderdash_proof`
uses `.expect()` on `quorum_type.try_into()` where `quorum_type` is a `u32`
from an untrusted gRPC response. Any value > 255 (e.g. `u32::MAX`) causes
the client to panic instead of returning an error.

A malicious node can exploit this to crash any SDK client by serving a
proof response with an out-of-range `quorum_type` value.

The test uses `#[should_panic]` to prove the bug exists. Once fixed, the
test should be updated to assert `Err` is returned instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v3.1.0 milestone Mar 15, 2026
@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f31094c5-5b01-436f-95c9-d0d10b7a93f4

📥 Commits

Reviewing files that changed from the base of the PR and between d82ca97 and 7d86c47.

📒 Files selected for processing (1)
  • packages/rs-drive-proof-verifier/src/verify.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/prove-quorum-type-panic
📝 Coding Plan
  • Generate coding plan for human review comments

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

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

…sted quorum_type

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer changed the title test(proof-verifier): prove client panic on malicious quorum_type fix(proof-verifier): handle malicious quorum_type without panicking Mar 15, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer changed the title fix(proof-verifier): handle malicious quorum_type without panicking fix(drive): handle malicious quorum_type without panicking Mar 15, 2026
@codecov

codecov Bot commented Mar 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.28%. Comparing base (d82ca97) to head (7d86c47).
⚠️ Report is 18 commits behind head on v3.1-dev.

Additional details and impacted files
@@             Coverage Diff              @@
##           v3.1-dev    #3288      +/-   ##
============================================
- Coverage     70.42%   68.28%   -2.15%     
============================================
  Files          3293     3293              
  Lines        262598   262598              
============================================
- Hits         184935   179314    -5621     
- Misses        77663    83284    +5621     
Components Coverage Δ
dpp 56.61% <ø> (-1.82%) ⬇️
drive 74.76% <ø> (-3.44%) ⬇️
drive-abci 81.44% <ø> (-1.49%) ⬇️
sdk 30.34% <ø> (-0.91%) ⬇️
dapi-client 39.08% <ø> (ø)
platform-version ∅ <ø> (∅)
platform-value 39.35% <ø> (ø)
platform-wallet 60.40% <ø> (ø)
drive-proof-verifier ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch

@QuantumExplorer QuantumExplorer merged commit 0d0e02e into v3.1-dev Mar 15, 2026
27 of 28 checks passed
@QuantumExplorer QuantumExplorer deleted the test/prove-quorum-type-panic branch March 15, 2026 15:29
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