Skip to content

fix trusted client IP in HTTP authentication - #2353

Merged
Eugeny merged 3 commits into
warp-tech:mainfrom
PokAhonTAS911:fix-trusted-client-ip-auth
Aug 4, 2026
Merged

fix trusted client IP in HTTP authentication#2353
Eugeny merged 3 commits into
warp-tech:mainfrom
PokAhonTAS911:fix-trusted-client-ip-auth

Conversation

@PokAhonTAS911

Copy link
Copy Markdown
Contributor

Description

Fixes #2327.

HTTP request logging and login protection already resolve the client address through get_client_ip(), which honors trusted X-Forwarded-For headers and cluster forwarding. HTTP auth-state creation still passed req.remote_addr() directly, so per-user allowed IP ranges were evaluated against the reverse proxy address even while the network status page showed the forwarded client address.

This change:

  • resolves the trusted client IP before creating an HTTP auth state
  • uses the same resolved IP in password and SSO authentication-failure audit events
  • keeps the existing safe fallback: when forwarded headers are not trusted, get_client_ip() returns the socket peer address

The existing warpgate-common-http::request tests cover both trusted forwarded headers and the untrusted fallback.

Validation

  • cargo check -p warpgate-protocol-http --tests
  • cargo test -p warpgate-common-http request::tests
  • cargo test -p warpgate-protocol-http --lib
  • cargo clippy -p warpgate-protocol-http --tests -- -D warnings
  • rustfmt check for all changed files

AI Usage

Choose the level of AI involvement for this PR.

  • Fully vibe coded
  • AI-designed, AI-coded, manually checked
  • Human-designed, AI-coded
  • Human-designed, human-coded (includes AI autocompletions and boilerplate gen)

This is not to block AI contributions but rather to speed up PR review (saves time on trying to deduce the logic behind AI hallucinations).

Replaced usage of remote_ip with client_ip in authentication error handling.
Replace remote address retrieval with client IP extraction for authentication failure logging.
@Eugeny
Eugeny merged commit 5e968ea into warp-tech:main Aug 4, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allowed IP range checks ignore trusted X-Forwarded-For during HTTP/SSO login

2 participants