headscale/hscontrol/policy/v2
Kristoffer Dalby 49744cd467 policy/v2: accept RFC 3986 bracketed IPv6 in ACL destinations
Headscale rejects IPv6 addresses with square brackets in ACL policy
destinations (e.g. "[fd7a:115c:a1e0::87e1]:80,443"), while Tailscale
SaaS accepts them. The root cause is that splitDestinationAndPort uses
strings.LastIndex(":") which leaves brackets on the destination string,
and netip.ParseAddr does not accept brackets.

Add a bracket-handling branch at the top of splitDestinationAndPort that
uses net.SplitHostPort for RFC 3986 parsing when input starts with "[".
The extracted host is validated with netip.ParseAddr/ParsePrefix to
ensure brackets are only accepted around IP addresses and CIDR prefixes,
not hostnames or other alias types like tags and groups.

Fixes #2754
2026-02-20 21:49:21 +01:00
..
filter.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
filter_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
policy.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
policy_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
tailscale_compat_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
tailscale_routes_compat_test.go policy: autogroup:internet does not generate packet filters 2026-02-05 19:29:16 +01:00
types.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
types_test.go all: fix staticcheck SA4006 in types_test.go 2026-02-19 08:21:23 +01:00
utils.go policy/v2: accept RFC 3986 bracketed IPv6 in ACL destinations 2026-02-20 21:49:21 +01:00
utils_test.go policy/v2: accept RFC 3986 bracketed IPv6 in ACL destinations 2026-02-20 21:49:21 +01:00