Skip to content

Reject IP hosts in the captive portal URI constructor - #37

Open
omrzk wants to merge 1 commit into
mdlayher:mainfrom
omrzk:fix/captive-portal-ip-hosts
Open

omrzk wants to merge 1 commit into
mdlayher:mainfrom
omrzk:fix/captive-portal-ip-hosts

Conversation

@omrzk

@omrzk omrzk commented Nov 17, 2026

Copy link
Copy Markdown

NewCaptivePortal checks path components for IP address literals, but misses the URI host. It accepts https://192.0.2.1/portal and https://[2001:db8::1]/portal even though its documented validation rejects IP literals in line with RFC 8910 section 2.

Include the parsed hostname in the existing check. Explicit CaptivePortal construction remains available for the documented exceptions, and parsing continues to treat received URIs as opaque.

Validation: nine public constructor cases fail on current main and pass with the fix, covering IPv4/IPv6, ports, mapped and scoped IPv6, and relative authorities. Controls preserve DNS hosts, defaults/URNs, IP-looking user info and queries, plus explicit construction and complete packet parsing with a following option. Full race/gofuzz suites pass on Go 1.20.14 and Go 1.26.10; vet, Staticcheck, build and formatting pass. Packet fixtures were used; privileged socket integration and a live router deployment were not run.

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