fix(upgrader): reject invalid disaster recovery committee quorum - #646
Open
MRmarioruci wants to merge 3 commits into
Open
fix(upgrader): reject invalid disaster recovery committee quorum#646MRmarioruci wants to merge 3 commits into
MRmarioruci wants to merge 3 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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 == 0andquorum > committee_sizeinDisasterRecoveryService::set_committeeviaUpgraderApiError::InvalidQuorum. - Add
INVALID_QUORUMAPI 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
MRmarioruci
marked this pull request as ready for review
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>
|
✅ No security or compliance issues detected. Reviewed everything up to 9443125. Security Overview
Detected Code Changes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
DisasterRecoveryService::set_committeevalidated that a committee is non-empty, but not that its quorum is within range. It now also rejectsquorum == 0andquorum > users.len()with a newUpgraderApiError::InvalidQuorum(codeINVALID_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_quorum—0and> membersrejected;== membersand a valid positive quorum accepted.