Skip to content

Review 11 — Hardening: DB-enforced cert uniqueness, race-safe issuance, token validation - #35

Draft
ArneeMe wants to merge 1 commit into
claude/review-10-designer-englishfrom
claude/review-11-hardening
Draft

Review 11 — Hardening: DB-enforced cert uniqueness, race-safe issuance, token validation#35
ArneeMe wants to merge 1 commit into
claude/review-10-designer-englishfrom
claude/review-11-hardening

Conversation

@ArneeMe

@ArneeMe ArneeMe commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Stacked on #34 (part 11, the top of the review stack). Small, security-relevant — review alongside #29/#32.

Outcome of an inline security pass over every new attack surface (auth guards, invites, platform admin, feedback, branding, issuance, retention, rate limiting). Two things warranted code; the rest checked out clean — full notes posted on #29.

  • DB-enforced idempotency: unique index on certificates(organization_id, submission_id) (2026-07-cert-unique.sql + baseline). The cert POST's check-then-insert had a small race window under concurrent double-clicks; now the database rejects the second insert and the API catches it and returns the winning row (alreadyIssued: true) instead of erroring. Before running the migration: the file includes a query to check for pre-idempotency duplicate rows; dedupe first if it returns anything.
  • Invite token shape validation: a malformed (non-UUID) token now returns a clean 404 instead of a Hasura type error surfacing as a 500.
  • Baseline schema comments updated to the 24h-TTL model (they still described delete-at-issuance); ROADMAP drops the completed designer-translation item.

Verification: typecheck, lint, 110 unit tests, production build pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB


Generated by Claude Code

…idation

Findings from an inline security pass over the new attack surfaces:

- Unique index on certificates(organization_id, submission_id)
  (migration + baseline) turns the API's check-then-insert idempotency
  into a DB guarantee; the cert POST catches the violation from a
  concurrent double-click and returns the winning row instead of 500.
- Invite redemption validates the token's UUID shape before querying,
  so a malformed token is a clean 404 instead of a Hasura type error
  surfacing as 500.
- Baseline schema comments updated to the 24h-TTL retention model
  (they still described delete-at-issuance); ROADMAP drops the now-
  completed designer-translation item.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying inf319-certificate with  Cloudflare Pages  Cloudflare Pages

Latest commit: 25ae32b
Status: ✅  Deploy successful!
Preview URL: https://908652f3.inf319-certificate.pages.dev
Branch Preview URL: https://claude-review-11-hardening.inf319-certificate.pages.dev

View logs

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.

2 participants