Skip to content

fix(billing): do not grant unlimited access from spoofed Firestore email - #79

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-d398
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-d398

Conversation

@cursor

@cursor cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown

What changed

  • Billing no-charge / unlimited checks now use Firebase Auth email only. A client write to users/{uid}.email no longer skips Seer or regen credits.
  • firestore.rules treats email as a protected field so profile saves cannot change it.
  • Edit-quota / record-edit use the ID token email for the same allowlist.

Why this change is safe

Verification

  • pnpm exec eslint on touched TS files (0 errors)
  • pnpm run lint:security (0 errors; pre-existing warning in lib/firebase.ts)
  • pnpm test — 75 suites / 403 tests
  • tests/unit/billingCredits.test.ts fails the spoofed-email path without withTrustedBillingEmail
  • Playwright smoke not run (no UI/routing change)

Regression prevention

  • Added unit coverage that a Firestore-only allowlisted email does not grant unlimited access; Auth email wins.
  • Existing generate / quota tests still pass.

Release checklist (solo-friendly)

  • CI is green
  • Deploy updated firestore.rules with the app (rules are not applied by this PR alone)
  • Post-merge: confirm a PAYG Seer send still debits after a crafted users.email write, and a real no-charge Auth account still skips debit
Open in Web View Automation 

PAYG users could write an allowlisted email onto users/{uid} because email
was client-writable. consumeBillingAction and generate-mystical then treated
them as no-charge. Trust Firebase Auth email only and protect email in rules.

Co-authored-by: Andy Oliver Rozario <andyrozario7@gmail.com>
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
future-seer Ready Ready Preview Sep 12, 2026 11:17am UTC

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.

1 participant