Repository navigation
Conversation
…xy (#34) A Playwright spec on the compose stack drives password sign-in, sign-up and recovery through /auth/v1 until Supabase Auth answers 429 over_request_rate_limit. Each allows a burst of 30 requests per client address; client-supplied forwarding headers do not reach a fresh bucket, and another client address (inside the kernel container) is unaffected. The spec restarts the auth service before and after, since the limits live in its memory and every spec shares the runner's address. The proxy now also drops Sb-Forwarded-For, which Supabase Auth uses as the rate-limit key ahead of X-Real-IP when GOTRUE_SECURITY_SB_FORWARDED_FOR_ENABLED is on. The email budget turned out to be one bucket per deployment; that is #190. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013LrvuThKGaPX1uDwUiwmGQ
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request secures Supabase Auth rate limits by dropping the client-supplied sb-forwarded-for header at the kernel proxy level, updating documentation, and adding an end-to-end test suite to verify rate-limiting behavior. Feedback on the changes points out a bug in the test suite's inline Node.js script, where incorrect argument indexing (process.argv[1] and process.argv[2]) causes the test assertion to be incorrect.
Closes #34
Stacked on #101 (which is stacked on #91): it uses the e2e package from #91 and the e2e compose override from #101. Once those merge, this PR is rebased onto
mainand retargeted.What it shows
A Playwright API spec,
e2e/tests/auth-rate-limits.spec.ts, runs on the compose stack and sends requests through the kernel's/auth/v1proxy:POST /token?grant_type=password(sign-in, also token refresh)invalid_credentialsPOST /signupPOST /recoverFor each endpoint the spec checks that:
over_request_rate_limit. Attempts count too, so wrong passwords and unknown addresses use up the bucket.X-Forwarded-For,X-Real-IP,X-Client-IP,ForwardedandSb-Forwarded-Forstill gets 429. The proxy drops these headers, so they never reach a fresh bucket.The limits live in Supabase Auth's memory, and every spec shares the runner's address. So the spec restarts the
authservice before it runs (fresh buckets) and after (other specs and the next local run start clean).e2e/lib/compose.tsis the shareddocker composehelper, andlib/db.tsnow uses it.Proxy change (protected path)
apps/kernel/src/http.tsnow also dropsSb-Forwarded-For. Supabase Auth v2.197 uses that header as the rate-limit key ahead ofX-Real-IPwhenGOTRUE_SECURITY_SB_FORWARDED_FOR_ENABLEDis on (off by default). If an operator turned it on, the header would let a client choose its own bucket on every request. The unit test sends the header and checks that it does not reach the upstream; without the change it fails withexpected '1.2.3.4' to be undefined.Checked by hand (not in the spec)
X-Real-IP. With the runner's bucket used up, a direct request carrying the runner's address got 429, and one carrying a made-up address got 400. So the proxy settingX-Real-IPis what the limits rely on, and Supabase Auth's port is not published (docker portis empty; noports:in compose).GOTRUE_RATE_LIMIT_EMAIL_SENT=2, two sign-ups from the runner made a sign-up from another client fail with 429over_email_send_rate_limit. With the default of 30 per hour and confirmations on, one client can block confirmation and recovery emails for everyone for an hour. Opened as Supabase Auth email budget is one bucket per deployment: one client can block confirmation and recovery emails for an hour #190 (a decision on the budget and CAPTCHA), not fixed here.Docs
The plan's
/auth/v1/*row records the verified limits and links #190..env.examplenow saysTRUSTED_PROXY_HOPSfeeds sign-in, sign-up and recovery limits.Verification
pnpm lint,pnpm typecheck,pnpm docs:check, unit tests (309 passed) on Node 26🤖 Generated with Claude Code
https://claude.ai/code/session_013LrvuThKGaPX1uDwUiwmGQ
Generated by Claude Code