Skip to content

fix(teams): guard assignToBounty against invalid status and claimed bounties (#41) - #50

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/41-teams-assign-to-bounty-guards
Open

fix(teams): guard assignToBounty against invalid status and claimed bounties (#41)#50
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/41-teams-assign-to-bounty-guards

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Fixes #41.

Problem

TeamsService.assignToBounty allowed attaching a team to a bounty regardless of its current state (CLAIMED, IN_REVIEW, MERGED, etc.) and even after an individual contributor had already claimed it. Because markMergedAndRelease prioritizes bounty.teamId over bounty.claimedById, an attacker could assign a malicious team before merge and hijack the bounty payout.

Changes

  1. Added status validations in TeamsService.assignToBounty:
    • Only allow assignment when bounty status is OPEN or FUNDED.
    • Reject assignment with BadRequestException if the bounty status is not OPEN or FUNDED.
    • Reject assignment with BadRequestException if bounty.claimedById is already set.
  2. Added comprehensive unit tests in src/teams/teams.service.spec.ts covering:
    • Successful assignment on OPEN and FUNDED states without a claim.
    • Rejection when bounty is in CLAIMED status.
    • Rejection when bounty is in IN_REVIEW status.
    • Rejection when bounty has claimedById set.

Validation

  • npm run test passes unit tests (18 test suites, 118 tests passed).
  • npm run lint and Prettier format pass cleanly.
  • npm run build succeeds with zero errors.

…ounties (MergeFi#41)

- Enforce bounty status check in TeamsService.assignToBounty: allow assignment only in OPEN or FUNDED states
- Prevent assignment if the bounty has already been claimed by a contributor (bounty.claimedById)
- Add comprehensive unit tests in src/teams/teams.service.spec.ts covering status guards and claim protections
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

TeamsService.assignToBounty has no bounty-status or ownership guard, allowing payout hijack via last-second team assignment

1 participant