fix trusted client IP in HTTP authentication - #2353
Merged
Merged
Conversation
Replaced usage of remote_ip with client_ip in authentication error handling.
Replace remote address retrieval with client IP extraction for authentication failure logging.
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.
Description
Fixes #2327.
HTTP request logging and login protection already resolve the client address through
get_client_ip(), which honors trustedX-Forwarded-Forheaders and cluster forwarding. HTTP auth-state creation still passedreq.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:
get_client_ip()returns the socket peer addressThe existing
warpgate-common-http::requesttests cover both trusted forwarded headers and the untrusted fallback.Validation
cargo check -p warpgate-protocol-http --testscargo test -p warpgate-common-http request::testscargo test -p warpgate-protocol-http --libcargo clippy -p warpgate-protocol-http --tests -- -D warningsrustfmtcheck for all changed filesAI Usage
Choose the level of AI involvement for this PR.
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).