Skip to content

fix: resolve client IP from the rightmost untrusted X-Forwarded-For entry (backport 2.34) - #27236

Merged
mtojek merged 1 commit into
release/2.34from
cherry-pick/26646/release/2.34
Jul 16, 2026
Merged

fix: resolve client IP from the rightmost untrusted X-Forwarded-For entry (backport 2.34)#27236
mtojek merged 1 commit into
release/2.34from
cherry-pick/26646/release/2.34

Conversation

@BobbyHo

@BobbyHo BobbyHo commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Backports #26646 to release/2.34 (Stable/ESR).

A client could spoof its X-Forwarded-For value by prepending a fake IP; getRemoteAddress took the leftmost comma-delimited token, so appending proxies (nginx, ALB, Cloudflare) never overrode the spoofed value. This fed httpmw.RateLimit (per-IP login throttling) and audit log IPAddress fields, enabling rate-limit bypass and audit falsification.

This is the security fix tracked in PLAT-258 / coder/security-disclosures#9 (SEC-FC61DF2BF7). It already shipped in mainline (v2.35.0); this PR brings it to the Stable/ESR line.

Clean cherry-pick, no conflicts. coderd/httpmw/realip_test.go covers the spoofing scenario.

@BobbyHo
BobbyHo requested a review from Emyrk July 14, 2026 15:47
@BobbyHo
BobbyHo marked this pull request as ready for review July 14, 2026 15:47
@BobbyHo
BobbyHo requested a review from jdomeracki-coder July 14, 2026 19:31
@mtojek
mtojek self-requested a review July 16, 2026 07:05
@mtojek
mtojek merged commit eda3747 into release/2.34 Jul 16, 2026
75 of 77 checks passed
@mtojek
mtojek deleted the cherry-pick/26646/release/2.34 branch July 16, 2026 07:05
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants