Repository navigation
fix(auth): limit sign-ups per client IP (unconfirmed per day, once a minute) - #727
Merged
Merged
Conversation
A bot has been using the public sign-up form to make the server email third-party addresses. A client IP may now have at most `auth.registration_max_pending_per_ip` sign-ups waiting for email confirmation, counting those submitted in the last 24 hours (default 3, 0 turns the limit off). Past it, sign-up answers 429 and sends nothing. - The pending registration keeps the client IP, taken with the trusted-proxy rules (`SP_SERVER_RATE_LIMITING_TRUSTED_PROXIES`), so a forged X-Forwarded-For does not get a fresh budget. - Confirming a sign-up frees its slot. Signing up again for an address already pending replaces its entry and is not counted against itself. - The check runs before the taken-email branch, so an IP over its limit gets 429 for every address and cannot use it to find which ones have an account. - Count and write are serialized, so a parallel burst cannot all pass. - Setting: `SP_AUTH_REGISTRATION_MAX_PENDING_PER_IP`, the `auth.registration_max_pending_per_ip` config key and system parameter. Off in test run mode unless the variable is set. - dash0 shows a translated message on 429 (en, fr, de, es). OpenAPI documents the 429; pkg/client regenerated. Replaces #718. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fclairamb
enabled auto-merge (squash)
October 31, 2026 06:23
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #727 +/- ##
==========================================
- Coverage 89.79% 89.76% -0.03%
==========================================
Files 1302 1304 +2
Lines 132534 132584 +50
==========================================
+ Hits 119003 119019 +16
- Misses 13522 13556 +34
Partials 9 9
🚀 New features to boost your workflow:
|
- `auth.registration_max_pending_per_ip` now defaults to 10 in SaaS mode and is off otherwise (still off in test run mode unless set). An env variable or config-file value wins over the mode default. - While the limit is on, one client IP may sign up at most once a minute: a second request answers 429 with `Retry-After: 60` and sends nothing. This also caps re-sends to an address already pending. A taken email spends the minute like a real sign-up, so the limit is not an enumeration oracle. - The minute counter is bumped atomically by the database before the pending count, so a parallel burst lets one request through on any replica; the in-process mutex is gone. - dash0 tells the two 429s apart by Retry-After (new string in en, fr, de, es). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-per-ip # Conflicts: # web/docs/docs/configuration/index.md
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Merged
fclairamb
added a commit
that referenced
this pull request
Oct 31, 2026
🤖 I have created a release *beep* *boop* --- ## [0.43.0](v0.42.1...v0.43.0) (2026-10-31) ### Features * auto-create a personal org for new users, resume OAuth after org creation ([#716](#716)) ([2ae5575](2ae5575)) ### Bug Fixes * **auth:** limit sign-ups per client IP (unconfirmed per day, once a minute) ([#727](#727)) ([b2eb48f](b2eb48f)) * **deps:** update github.com/dop251/goja digest to 032d024 ([#724](#724)) ([025e97a](025e97a)) * **deps:** update go dependencies (non-major) ([#725](#725)) ([5796b1f](5796b1f)) * **deps:** update module github.com/prometheus/common to v0.73.1 ([#720](#720)) ([9bef875](9bef875)) * **deps:** update module github.com/slack-go/slack to v0.33.0 ([#722](#722)) ([ad19df4](ad19df4)) * **security:** bug-report budget for non-members, retention sparing crawl reports ([#715](#715)) ([d929999](d929999)) * **security:** JS check memory budget, re-authentication for new sign-in factors ([#728](#728)) ([a78f954](a78f954)) ### Performance Improvements * **dash0:** load only the active language's translations ([#729](#729)) ([406f211](406f211)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #718 with the minimal version: per-IP limits on sign-ups, as one server setting, on by default in SaaS mode only.
Cause
A bot uses the public sign-up form to make the server email third-party addresses (about 200 pending registrations since 2026-10-12, while real sign-ups stay around 8 a week).
Fix
auth.registration_max_pending_per_ip(envSP_AUTH_REGISTRATION_MAX_PENDING_PER_IP, also a system parameter applied at startup).SP_DEPLOYMENT_MODE=saas), 0 (off) otherwise. An env or config-file value wins over the mode default.TRUSTED_PROXIES=1, so both get it with no extra setting.429 RATE_LIMITEDwithRetry-After: 60and sends nothing. This also caps re-sends to an address that is already pending.registration_ip_rl:<ip>) is bumped atomically by the database, so a parallel burst lets one request through on any replica.429 RATE_LIMITED, withoutRetry-After.ExtractTrustedClientIPandSP_SERVER_RATE_LIMITING_TRUSTED_PROXIES, so a forgedX-Forwarded-Fordoes not get a fresh budget.Retry-Afterand shows a translated message for each (en, fr, de, es).register;pkg/clientregenerated.configuration/authentication.md, a row inconfiguration/index.md, andwiki/api-specification/auth.md.Verification
internal/handlers/auth/registration_ip_limit_test.go:0or no client IP: back-to-back sign-ups all pass.429withRetry-After: 60within the minute,429without it for the pending cap, a forgedX-Forwarded-Forignored, the port stripped, another client sent.internal/config/registration_limit_test.go, throughLoad: self-hosted off, SaaS 10, test mode off even in SaaS, explicit value wins (also in test mode), garbage and negative values ignored, a config-file value kept over the mode default.internal/systemconfig:ApplyFunccoercion andTestAuthEnvVarsDocumented.go test -short ./...: green.golangci-lint run ./...: 0 issues.tsc -p tsconfig.app.jsonclean, locale parity tests green.make test-postgresand Playwright (CI). No e2e spec for the 429s: the CI server runs in test mode with the limits off.Notes
make dev-saas(SaaS mode, not test run mode) now has the limits on: a developer trying sign-ups in a loop there hits the once-a-minute limit.SP_AUTH_REGISTRATION_MAX_PENDING_PER_IP=0indev.priv.envturns it off.🤖 Generated with Claude Code