Repository navigation
Conversation
POST /login/password accepted unlimited password attempts. Failed attempts are now limited to 10 per email every 15 minutes. Successful logins don't count. The browser form is redirected to /login?err=tooManyAttempts and JSON clients get a 429. Addresses the second half of ClickHouse#2775.
🦋 Changeset detectedLatest commit: 1b165bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@Aryainguz is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
PR Review
1 finding(s): 🔴 1 P0/P1 · 🟡 0 P2 · 🔵 0 P3 Already reported on an earlier push — no new comments. 1 unchanged from an earlier push (already inline above). Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
P1 here is the trade-off. An (email, IP) key can be bypassed here: req.ip comes from X-Forwarded-For, which the client sets, and the default docker-compose.yml publishes the API port, so the app proxy can be skipped too. The test "limits an email sent in the query string" sends a new X-Forwarded-For on every attempt; the email key still blocks it, but an IP key wouldn't. A higher per-email backstop would allow the same lockout, just after more attempts, while giving more guesses. A temporary lockout seemed better than unlimited guessing. Better options would be a trusted client IP (proxy settings plus not exposing the API port), or a CAPTCHA or email unlock link. @pulpdrew happy to make the limits configurable or take on any of these as a follow-up, let me know what you think. |
Deep ReviewScope: The middleware ordering and 🔴 P0/P1 — must fix
🔵 P3 nitpicks (4)
Reviewers (7): correctness, security, adversarial, testing, reliability, maintainability, previous-comments. Testing gaps:
Coverage notes: A P2 memory-pressure concern (one store entry per distinct attacker-supplied email key; No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
Summary
Addresses the second half of #2775.
POST /login/passwordhad no rate limit, so password guessing was unlimited. #2781 fixed the first half.429./apiproxy,req.ipcomes fromX-Forwarded-For, which the client can set.Known trade-offs
/apiproxy to key on. Restarting the API clears the counters./api/v2and/mcplimiters.Screenshots or video
/login?err=tooManyAttemptsHow to reproduce
Starting point:
yarn dev. SetAPIto the API URL it prints. Any email works, no user needed.On
main:for i in $(seq 11); do curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' -X POST $API/login/password -d 'email=a@example.com&password=wrong'; done/login?err=authFail.On this branch:
/login?err=authFail, and the 11th to/login?err=tooManyAttempts.make dev-int FILE=login.intruns the new integration tests.References