fix(control-plane): overlong login emails skip the throttle; a transient store error keeps the session - #131
Merged
Merged
Conversation
…re it keys the throttle The throttle kept client IP plus the normalized email for five minutes, and the body limit is 1 MiB, so unauthenticated logins with unique megabyte emails held a megabyte each (64 such logins retained 65 MiB). An address longer than the SMTP limit cannot belong to an account, so it gets the usual 401 without a throttle entry.
…s the session requireAuth deleted the session on any ByID error, so a Postgres restart or failover logged every active admin out for good. Only a missing, disabled or password-reset user drops the session now; any other store error is logged and answered 503.
…open with an identifier
…w scope, the live-matrix group argument, login and session responses in the OpenAPI
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.
Summary
Two control-plane fixes, each with a regression test that fails on the old code:
requireAuthdeleted the session on anyByIDerror, so a Postgres restart or failover logged every active admin out for good.Plus a review commit: own-line comments start uppercase unless they open with an identifier.
Evidence
Real Postgres 17 (container),
CP_STORE=postgres, main vs this branch. Steps: log in, stop Postgres, request, start Postgres, request again.authentication requiredauthentication is temporarily unavailableThe email cap is not visible from outside (both arms answer 401 to a 312-byte email). The difference is the throttle entry, which
TestLoginRejectsAnOverlongEmailBeforeTheThrottlepins.Gates (control-plane):
make fmt-checkandmake lint: 0 issues.go test -race ./...: pass.aslon darwin and linux: clean.Size: prod +12/-2, tests +57.