AUTH4D-442 Console sign-in start limits and sign-in attempt recording
Two abuse limits from the security review of the AUTH4D-364 and AUTH4D-71 work. Neither changes a success response.
Console POST /api/auth/start
The console worker starts sign-in for the developer console. The route is public, so it now has these limits:
- Per-address budget. At most 20 starts per client address in a 10-minute window. Over it, the
answer is
429withRetry-After(seconds) and no sign-in state is created:{"error":"rate_limited","message":"Too many sign-in attempts. Try again later."}. Only a hash of the address names the counter; the address is not stored. - Bounded body. The optional invitation form (
application/x-www-form-urlencoded, fieldinvitation_token, from the AUTH4D-71 invitation page) is read through a reader that stops after 1,024 bytes. Refusals, each{"error":"invalid_request"}:411a form post without aContent-Lengthheader,413a declared or actual body over 1,024 bytes (the rest of the stream is not read),415a body of any other content type.
- A request with no body is unchanged.
Sign-in attempt recording
sign_in_attempts rows (AUTH4D-364 (repository file docs/api-spec/auth4d-364.md)) are now written only for projects that have
the sign_in_report feature (the add-on or an operator override). Attempts made before a project
gets the feature are not recorded and are not back-filled.
Each project can add at most 50,000 attempt rows per UTC start date
(SIGN_IN_ATTEMPTS_DAILY_CAP). Past that, new attempts for that day are not counted, so the report
undercounts that day; sign-in itself is unaffected. Recording stays quiet and never fails
authentication.
The daily cap is counted by tenant and start date. The existing index is on tenant, application and start date, so the count reads that project’s rows for the day across its applications (at most the cap). A tenant and start date index can be added in a later additive migration if authorize latency needs it.
Source: docs/api-spec/auth4d-442.md