Skip to content

fix(security): reject zero guardian threshold when guardian set is non-empty - #700

Merged
nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
aniokedianne:fix/608-609-610-611
Oct 19, 2026
Merged

nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
aniokedianne:fix/608-609-610-611

Conversation

@aniokedianne

Copy link
Copy Markdown

Closes #608
Closes #609
Closes #610
Closes #611

Changes

#608 — ClaimsProcessor zero guardian threshold

contracts/claims-processor/src/lib.rs — set_guardians

Previously threshold=0 was accepted even when guardians was non-empty. This silently disabled the multisig requirement while leaving the guardian set populated, making require_upgrade_guardian_approvals unreachable in practice because threshold=0 causes the guard to short-circuit before any approval is checked.

Fix: added a check immediately before the existing threshold > guardians.len() guard:

if !guardians.is_empty() && threshold == 0 {
    panic_with_error!(&env, Error::InvalidThreshold);
}

Clearing the guardian set (guardians = [], threshold = 0) remains allowed — that is the documented way to revert to single-admin mode.

Tests added (contracts/claims-processor/src/test.rs):

  • set_guardians_with_positive_threshold_succeeds — happy path
  • clear_guardians_with_zero_threshold_succeeds — clearing is still valid
  • set_guardians_rejects_zero_threshold_with_nonempty_set — must panic #15
  • set_guardians_rejects_threshold_exceeding_guardian_count — existing invariant still holds

…n-empty (Parashield-Protocol#608)

set_guardians previously accepted threshold=0 even with guardians configured,
silently bypassing the multisig requirement while leaving the guardian set
populated. Add a guard: if guardians.len() > 0, threshold must be >= 1.
Clearing the guardian set (empty vec, threshold=0) remains allowed.

Added four tests: valid positive threshold, clear-guardians path, zero
threshold with non-empty set (must panic), and threshold > len (must panic).

Closes Parashield-Protocol#608
Closes Parashield-Protocol#609
Closes Parashield-Protocol#610
Closes Parashield-Protocol#611
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@aniokedianne Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nonsobethel0-dev
nonsobethel0-dev merged commit eff0e96 into Parashield-Protocol:main Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants