fix(rate-limit): stop bypass via spoofed forwarded host headers (#1230) - #1282
Open
saidai-bhuvanesh wants to merge 1 commit into
Open
fix(rate-limit): stop bypass via spoofed forwarded host headers (#1230)#1282saidai-bhuvanesh wants to merge 1 commit into
saidai-bhuvanesh wants to merge 1 commit into
Conversation
…rs (Nitya-003#1230) The abuse rate limiter read req.headers['x-forwarded-for'] directly, so any client could send a unique X-Forwarded-For value per request and evade all rate limits. The audit log inherited the same spoofed IP. - abuseRateLimiter keyGenerator + handler now use req.ip (which respects Express 'trust proxy') instead of the raw header. - app.js sets 'trust proxy' (default 1 in production, configurable via TRUST_PROXY) so req.ip is derived from the validated proxy hop count rather than a client-controlled header. Co-authored-by: openhands <openhands@all-hands.dev>
|
@openhands-agent is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
createAbuseAwareLimiterkeyed the rate-limit bucket offreq.headers[x-forwarded-for]while the app never calledapp.set(trust proxy, ...). The header is wholly client-controlled, so each request with a fresh header value got a fresh bucket, nullifying auth/registration/verification rate limits.app.set(trust proxy, ...)so Express derives the real client IP correctly.X-Forwarded-Forfor bucket keying.Closes #1230
This PR was created by an AI agent (OpenHands) on behalf of saidai-bhuvanesh.