fix: prevent sybil bypass via delete then re claim and fix status code mismatch - #25
fix: prevent sybil bypass via delete then re claim and fix status code mismatch#25Sertug17 wants to merge 1 commit into
Conversation
…e mismatch Bug 1 (Critical): delete-airdrop removes user record but does not track the verification token. A user can claim multiple times with different wallets using the same verified social account. Fixed by adding a DeletedToken model that tracks tokens from deleted claims, checked on re-verification. Bug 2 (Minor): Frontend checks HTTP 400 but backend returns HTTP 412 for traits-not-satisfied. Fixed frontend to match backend status code. Closes base#24
|
@Sertug17 is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
|
Would appreciate a review on this when either of you gets a chance. Fixes a sybil bypass in the claim flow (delete + re-claim reuses the same verification token) and corrects a status code mismatch between frontend and backend for the traits-not-satisfied path. |
|
Reviewed the diff (context: cross-posted an assessment of the underlying bug on #24). The fix closes the reported bypass on the X verification path and the 412 frontend fix is the right direction. Three things worth addressing before merge — the first two are correctness, the third is scope: 1. The await prisma.deletedToken.create({ data: { token: existingUser.baseVerifyToken } })
.catch(() => { /* Token may already be in deleted_tokens (idempotent) */ });If .catch((e) => {
if (e?.code !== 'P2002') throw e; // P2002 = Prisma unique constraint violation
});2. Tombstone + delete should be atomic If the process dies between await prisma.$transaction([
prisma.deletedToken.create({ data: { token: existingUser.baseVerifyToken } }),
prisma.verifiedUser.delete({ where: { address: walletAddress } }),
]);(with the P2002 handling moved to a pre-check or upsert inside the transaction). 3. Does the Coinbase verification path have the same bypass? The schema has a parallel Minor: the new frontend check matches the exact backend error string ( With #1 and #2 addressed this looks mergeable to me; #3 can be a follow-up if the coinbase route is confirmed unaffected. |
Uh oh!
There was an error while loading. Please reload this page.