Repository navigation
fix(ip): handle zoned IPv6 proxy peers - #3222
Merged
Merged
Conversation
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.
Summary
Fixes #3179.
Normalize the direct peer's IPv6 zone once in
extractIP, before validating a portless address. A smallstripIPv6Zonehelper handles the shared normalization, so direct, XFF, X-Real-IP, and legacy extraction use the same peer representation.No zone handling is added to forwarded-header parsing. Forwarded values containing zones remain invalid.
Related: #3180 and #3195.
Evidence
fe80::1%eth0peer returns an empty IP. A zoned peer with a port prevents the header extractors from honoring a trusted proxy's client address on master.After: portless and host:port cases return
fe80::1directly, or client203.0.113.5when trust permits. Tests include multiple XFF hops, disabled link-local trust, missing headers, and rejected zones in forwarded values.GOTOOLCHAIN=go1.27.4 go test -race ./...,go vet ./...,golint -set_exit_status ./..., and current staticcheck pass.Merge Danger
Door: two-way
Blast Radius: proxies
Direct-peer results omit the local IPv6 zone. Trusted zoned peers can supply forwarded client addresses; untrusted peers still cannot. Forwarded-header validation remains strict.