Skip to content

fix(upgrader): reject invalid disaster recovery committee quorum - #646

Open
MRmarioruci wants to merge 3 commits into
mainfrom
fix/dr-committee-quorum
Open

fix(upgrader): reject invalid disaster recovery committee quorum#646
MRmarioruci wants to merge 3 commits into
mainfrom
fix/dr-committee-quorum

Conversation

@MRmarioruci

@MRmarioruci MRmarioruci commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Change

DisasterRecoveryService::set_committee validated that a committee is non-empty, but not that its quorum is within range. It now also rejects quorum == 0 and quorum > users.len() with a new UpgraderApiError::InvalidQuorum (code INVALID_QUORUM).

Neither is a configuration the recovery flow can act on sensibly, so both are rejected where the committee is set rather than surfacing later.

Tests

  • set_committee_rejects_invalid_quorum0 and > members rejected; == members and a valid positive quorum accepted.

set_committee now rejects quorum == 0 (would approve recovery with no
votes) and quorum greater than the number of committee members (can never
be met), alongside the existing empty-committee check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens disaster recovery committee configuration in the upgrader by rejecting quorum values that would make approvals unsafe (0) or impossible (> members), and adds coverage for the new validation.

Changes:

  • Reject quorum == 0 and quorum > committee_size in DisasterRecoveryService::set_committee via UpgraderApiError::InvalidQuorum.
  • Add INVALID_QUORUM API error mapping.
  • Add a test covering invalid and valid quorum configurations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/upgrader/impl/src/services/disaster_recovery.rs Adds quorum validation in set_committee and introduces a new test for invalid quorum values.
core/upgrader/impl/src/errors/mod.rs Adds InvalidQuorum error variant and maps it to INVALID_QUORUM API error code/message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/upgrader/impl/src/services/disaster_recovery.rs Outdated
Comment thread core/upgrader/impl/src/services/disaster_recovery.rs Outdated
@MRmarioruci
MRmarioruci requested a review from aterga July 23, 2026 09:06
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@MRmarioruci
MRmarioruci marked this pull request as ready for review July 23, 2026 09:06
@MRmarioruci
MRmarioruci requested a review from a team as a code owner July 23, 2026 09:06
Addresses review feedback: the quorum was checked against
committee.users.len(), but membership is deduplicated by user id (recovery
requests are keyed by user id and retained via a HashSet of ids). Duplicate
entries could let a quorum larger than the number of unique voters pass
validation, making it impossible to reach. Validate against the unique
member count (reusing the set already built for request retention).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@zeropath-ai

zeropath-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 9443125.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► core/upgrader/impl/src/errors/mod.rs
    + Add InvalidQuorum to UpgraderApiError enum
► core/upgrader/impl/src/services/disaster_recovery.rs
    + Validate quorum against unique committee members and return InvalidQuorum when invalid
    + Update logic to deduplicate members for quorum validation
    + Retain only recovery requests from current committee members
    + Add tests for set_committee invalid quorum scenarios

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.

2 participants