1.3 KiB
1.3 KiB
Task: Phase 2.4 — Seed Pre-Commit Gate (Seed Grinding Elimination)
Assigned to: Antigravity
Priority: CRITICAL (fairness)
Date: 2026-08-20
Base SHA: 9927e74421223135a170de640255803ab513fd48
Scope
- Remove client-provided
seedfromexecuteDrawSchema(strict schema -> 400 on client seed). - Remove client-provided
seedfromcreateGiveawaySchemaand creation inputs. - Fix seed generation inside
createAndLockSnapshot/POST /api/giveaways/[id]/snapshotusing CSPRNG (generateCryptoSecureSeed) and persist inGiveaway.seedatomically with snapshot creation. - Update
POST /api/giveaways/[id]/drawto strictly read seed from DB (giveaway.seed). Fail with409 Conflictif seed is not pre-committed. - Hide
seedbeforeDRAWNstatus:- Compute
seedCommitment = sha256(seed). POST /api/giveaways/[id]/snapshotreturnsseedCommitment, not rawseed.GET /api/giveaways/[id]masksseedwithnull/omitted beforeDRAWN, providingseedCommitment.- Ensure
GET /api/giveawaysand other routes do not leak rawseed.
- Compute
- Update UI in
src/app/giveaways/new/page.tsxto remove manual seed input and displayseedCommitment. - Add adversarial / grinding regression tests in
tests/seed-precommit-gate.test.ts. - Ensure all existing 273 tests pass, lint passes, build passes.