Throttle failed static-login attempts per IP - #858
Merged
Conversation
The static username/password login had no rate limiting, so a shared credential could be guessed with unlimited online attempts. Add a per-IP failed-attempt counter: after 10 failures from one IP within 15 minutes, further attempts from that IP are rejected until the window elapses; a successful login clears the counter, so normal use never accumulates. A blocked attempt returns the same result as a wrong password, revealing nothing. The counter reuses the existing windowed-limiter pattern and is stored under the server-only /staticAuthRateLimits node; the hourly cleanup job prunes elapsed windows so it cannot grow unbounded. Only projects that configure static credentials ever touch it. This is a best-effort deterrent (the client IP comes from X-Forwarded-For); the durable defenses remain a strong shared credential and moving this login to the standard mechanisms. Also make requestHelper.getIp tolerate a missing headers/connection.
rzueger
force-pushed
the
claude/flightbox-security-audit-z16av5
branch
from
August 17, 2026 11:41
49463af to
8f9da22
Compare
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.
What
The static username/password login had no rate limiting, so a shared credential
could be guessed with unlimited online attempts. This adds a per-IP
failed-attempt throttle.
Behaviour
attempts from that IP are rejected until the window elapses.
toward a block (a couple of typos are harmless).
"rate limited" oracle.
Implementation
generateSignInCode),stored under a new server-only
/staticAuthRateLimitsnode (.read/.write= false; written via the Admin SDK).cleanupExpiredSignInCodesjob also prunes elapsedentries, so the node can't grow unbounded — no new scheduled function.
projects that use static login (i.e. the one static-credential aerodrome) ever
touch it. Purely additive: only failed attempts, only past the cap.
requestHelper.getIphardened to tolerate a missingheaders/connection.Scope / honesty
This is a best-effort deterrent: the client IP comes from
X-Forwarded-For,so it stops opportunistic guessing, not a determined attacker who rotates IPs.
The durable defenses remain (a) a strong shared credential — the operator's
choice — and (b) migrating this login to the standard mechanisms (e-mail OTP +
passkeys + guest/kiosk). No global or per-username lock is used, deliberately —
that would let an attacker lock out legitimate users of the shared credential.
Tests
functions/auth/modes/static/index.spec.js— blocks after 10 failures (holdseven for a correct password), does not block a different IP, clears on success,
auto-recovers after the window, skips cleanly when no IP; existing behaviour
retained. Plus a prune test in
cleanupExpiredSignInCodes.spec.js. Fullfunctions suite green (436).
Generated by Claude Code