You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1634374
Browse filesBrowse the repository at this point in the historyBrowse files
fix: key login backoff on the declared proxy header only and cap total failures
Security audit follow-up, batch 3. `clientKey` (the identity the admin login
and approval-link backoffs bucket on) used to believe CF-Connecting-IP and
the FIRST X-Forwarded-For hop for any request on a loopback socket — which is
every request behind nginx, caddy, cloudflared or ssh -L. A caller could mint
a fresh bucket per request by writing its own header: unlimited online
password guessing plus a free scrypt per attempt.
- New setting `trustProxy` (Settings → Connection → "Behind a reverse proxy";
env CG_TRUST_PROXY; the setting wins): "" trusts nothing (the socket is the
client), "cloudflare" reads CF-Connecting-IP only, "xff" reads the LAST
X-Forwarded-For hop (the proxy's, never the client's first one). Legacy
CG_TRUST_PROXY=1 maps to "xff"; unknown values trust nothing and the admin
API refuses them with 400.
- createLoginLimiter gains a key-independent global cap (default 50 failures
per 10 minutes → every attempt waits the maximum delay until the window
drains), injectable for tests and switchable off.
- The /approve limiter inherits both through the shared helper. Nothing else
authorizes on forwarded headers; the Secure-cookie decision still reads
x-forwarded-proto (it only ever makes the cookie stricter).
- docs/OPERATIONS.md and INSTALL.md: declare the proxy, or all remote logins
share one backoff bucket.
Tests: web-security (clientKey per mode, settings/env precedence, global
cap), settings-save-version (route validation + UI wiring),
approval-links (end-to-end through the approve router with and without a
declared proxy). FEATURES, TEST-PLAN, CHANGELOG updated.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Tiberiu Socaci <tsocaci@makeitfuture.com>
<optionvalue="xff">nginx / caddy / other (last X-Forwarded-For hop)</option>
548
+
</select>
549
+
</label>
550
+
<pclass="desc">Without this, every remote login shares one backoff bucket behind the proxy; with it, each real client gets its own. Only declare a proxy you control: it must set the header on every request.</p>
0 commit comments