Skip to content

fix(policy): accept scoped IPv6 socket addresses - #190

Open
omrzk wants to merge 1 commit into
pires:mainfrom
omrzk:fix-policy-scoped-ipv6
Open

omrzk wants to merge 1 commit into
pires:mainfrom
omrzk:fix-policy-scoped-ipv6

Conversation

@omrzk

@omrzk omrzk commented Oct 25, 2026

Copy link
Copy Markdown

IP-based policies currently reject a socket address such as [fe80::1%eth0]:1234 before comparing it with the configured trusted IP or CIDR. net.SplitHostPort retains the interface zone, which net.ParseIP cannot parse. A trusted link-local proxy therefore fails policy classification, and the same problem affects local-interface and skip-CIDR policies.

Parse the socket host with netip.ParseAddr and compare its IP bytes. The zone identifies the local socket interface; these policies continue to match their configured IP addresses and networks. Regression fixtures exercise matching and nonmatching scoped TCP/UDP endpoints through all five policy paths. This concerns the underlying socket endpoints; the PROXY header parser is unchanged.

Validation on Go 1.26.10: the ten matching fixtures fail on unchanged main, and the full race/shuffle/coverage suite passes with the fix. go build ./..., go vet ./..., module tidiness, formatting, and golangci-lint v2.15.0 pass (zero lint issues). Tests use socket-address fixtures and the existing local test suite; no link-local deployment was exercised.

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.

1 participant