oauth2-proxy/pkg/validation
Georgi Georgiev 08ce94d1c0 security: harden X-Forwarded-For parsing against spoofing
The real-client-IP lookup used by the --trusted-ip auth-bypass allowlist
blindly trusted the leftmost value in X-Forwarded-For (or other
configured --real-client-ip-header). When trusting X-Forwarded-For (which
is the only header set by AWS ALB for example) the connecting peer's
address is appended to X-Forwarded-For rather than replacing the header,
and a client could set X-Forwarded-For to an allowlisted IP and have it
trusted regardless of who actually connected to the proxy.

The parser now walks the hop chain from the newest (rightmost) entry
inward, skipping hops that are themselves trusted proxies, and returns
the first entry that isn't. If the direct connecting peer isn't itself a
trusted proxy, the header is ignored entirely. This reuses the existing
--trusted-proxy-ip configuration, so behavior for deployments that leave
it unset (today's documented trust-all default) is unchanged.

Signed-off-by: Georgi Georgiev <310867+chutzimir@users.noreply.github.com>
2026-07-21 03:53:36 +09:00
..
allowlist.go Merge commit from fork 2026-04-13 18:22:56 +02:00
allowlist_test.go Merge commit from fork 2026-04-13 18:22:56 +02:00
common.go SecretSource.Value should be plain text in memory 2020-12-01 08:56:46 +00:00
common_test.go revert: secrets as []byte instead of string 2025-11-16 22:38:42 +01:00
cookie.go feat(cookie): add feature support for cookie-secret-file (#3104) 2025-07-22 18:59:55 +02:00
cookie_test.go feat(cookie): add feature support for cookie-secret-file (#3104) 2025-07-22 18:59:55 +02:00
header.go ci: fix linter warnings for preallocation 2026-01-17 16:01:14 +01:00
header_test.go revert: secrets as []byte instead of string 2025-11-16 22:38:42 +01:00
logging.go Fix import path for v7 (#800) 2020-09-29 17:44:42 +01:00
options.go security: harden X-Forwarded-For parsing against spoofing 2026-07-21 03:53:36 +09:00
options_test.go refactor: ptr.Ptr to ptr.To 2025-11-16 22:38:59 +01:00
providers.go chore(deps): update gomod and golangci/golangci-lint to v2.11.4 (#3382) 2026-03-23 09:38:12 +01:00
providers_test.go feat: add support for specifying allowed OIDC JWT signing algorithms (#2753) (#2851) 2026-03-18 22:24:27 +08:00
sessions.go PKCE Support (#1541) 2022-03-13 10:08:33 +00:00
sessions_test.go chore(deps): bump Go to 1.26 and migrate upstream reverse proxies to Rewrite 2026-06-08 14:12:56 +02:00
upstreams.go ci: fix linter warnings for preallocation 2026-01-17 16:01:14 +01:00
upstreams_test.go fix: static upstreams failing validation due to `passHostHeader` and `proxyWebSockets` defaults being set incorrectly (#3302) 2026-01-17 15:15:19 +01:00
utils.go Add validation for Headers struct 2020-11-07 17:16:54 +00:00
validation_suite_test.go chore(deps): Updated to ginkgo v2 (#2459) 2024-07-18 22:41:02 +02:00