Skip to content

Credit codes (Pro days), scarce invites and ?ref= attribution - #15

Merged
ralyodio merged 1 commit into
mainfrom
feat/credits-invites
Oct 26, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/credits-invites

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

  • Credit codes (@profullstack/redeem-credits 0.2.0): a code grants pro_days. One grant path: plan_grants (idempotent on user + source) extends users.pro_until. Redeem on Settings > Plan ("Have a code?"), POST /api/v1/credits/redeem, submitfleet redeem CODE, MCP submitfleet_redeem_code; GET /api/v1/plan, submitfleet plan. Admin mint: submitfleet credits mint --days N [--max] [--expires-days] [--label] against the local DB (docker exec on dev2).
  • Invites (@profullstack/affiliates 0.3.0): 3 per account at /invites -> /app/invites; /i/<code> landing sets sf_invite and is in the crawl gate's openPaths; the code also rides on the emailed sign-in link. Accepted on sign-in (link, password, passkey) or on the Invites page, for accounts <= 7 days old, one per account. Both sides get 14 Pro days (SUBMITFLEET_INVITE_BONUS_DAYS), denied for same mailbox (+tag / Gmail dots), throwaway inbox (mailchecker), same network (X-Real-IP hash), a ?ref= sign-up, or > 5 bonuses per inviter per 30 days (SUBMITFLEET_INVITE_MONTHLY_CAP).
  • ?ref= first-touch attribution (referral_code cookie) recorded when an account is created; there is no existing referral program here.
  • Module tables (credit_*, aff_*) live in the same SQLite file through node:sqlite (the module stores are synchronous); migration 4 adds users.pro_until, plan_grants, invite_origins, invite_acceptances.
  • Security fix: the sign-in page's client-side ?next= check accepted /\evil.com, which browsers follow off-site.

Checks

  • Migration dry-run on a copy of the prod DB: OK (backup volumes/submitfleet.pre-credits-20261026T221642.db on dev2).
  • pnpm typecheck, vitest run 83/83 (74 on main + 9 new), pnpm build.
  • No payment webhook is rate-limited: the only one is the x402 gateway's /crawl/checkout/webhook, answered before any quota, no denyCidrs, no nginx limit_req.

🤖 Generated with Claude Code

- Credit codes via @profullstack/redeem-credits 0.2.0 grant unit pro_days. Every grant
  goes through one path: plan_grants (idempotent on user + source) and users.pro_until.
  Redeem: Settings > Plan "Have a code?", POST /api/v1/credits/redeem, `submitfleet
  redeem`, MCP submitfleet_redeem_code. Mint: `submitfleet credits mint --days N`.
- Invites via @profullstack/affiliates 0.3.0: 3 per account at /invites (/app/invites),
  /i/<code> landing outside the crawl gate, code carried on the emailed link so another
  device still counts it. New accounts (<= 7 days) accept one invite; both sides get
  14 Pro days unless same mailbox, throwaway inbox, same network, ?ref= sign-up or the
  inviter's 30-day cap; paid at most once.
- ?ref= first-touch attribution (referral_code cookie) recorded at account creation.
- Fix: the sign-in page's ?next= accepted /\host, which browsers follow off-site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​profullstack/​redeem-credits@​0.2.07610010090100
Added@​profullstack/​affiliates@​0.3.07610010092100
Addedmailchecker@​6.0.2110010010088100

View full report

@ralyodio
ralyodio merged commit f7f2c2d into main Oct 26, 2026
3 checks passed
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