fix(bounty): prevent cross-store payout and coupon reuse in claim flow (#37)#40
Open
chenlinxi890-spec wants to merge 1 commit into
Open
Conversation
profullstack#37) Add two critical validations to POST /api/bounties/[id]/claim: 1. Validate coupon store matches bounty store (prevents cross-store exploitation) 2. Prevent coupon reuse (a coupon can only claim one bounty) This fixes a security vulnerability where any user could claim any bounty with any coupon, potentially draining the merchant wallet.
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.
Summary
Fixes a security vulnerability in the bounty claim flow where any user could:
Fix
Added two validations in �pps/web/app/api/bounties/[id]/claim/route.ts:
Tests