Skip to content

Cap reputation_bump per award (events) and delta per call (profile) #133

Description

@0xdevcollins

Source: docs/threat-model.md v1.0, EoP.15 (Priority 2, Open).

Problem

WinnerSpec.reputation_bump (contracts/events/src/types.rs:150) and the reputation_bump argument of claim_milestone are u32 values chosen by the manager or owner and forwarded unchecked to profile.bump_reputation, which does saturating_add(delta as u64) (contracts/profile/src/reputation.rs:22). The profile contract only checks that the caller is the events contract. Nothing relates the bump to the award or bounds it, so the reputation score has no integrity guarantee.

Change

  • Events side: MAX_REPUTATION_BUMP constant (or per-event config on EventRecord at the next migration, per the per-event-configuration rule) enforced in select_winners and claim_milestone
  • Profile side: MAX_DELTA_PER_CALL enforced in bump_reputation / slash_reputation as defence in depth
  • Tests: over-cap bump rejected on both sides

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions