headscale/hscontrol/policy/v2
Kristoffer Dalby 2e1a716a9a policy/v2: fix empty grants/acls returning FilterAllowAll
compileFilterRules, compileGrants, and updateLocked guarded the
"no rules so allow all" fallback with len(pol.Grants) == 0, which
matches both an absent grants field and an explicit empty array.
JSON {"grants": []} unmarshals to a non-nil empty slice; it should
compile to zero filter rules (deny all) to match Tailscale SaaS,
but the length check sent it down the FilterAllowAll path.

Distinguish absent (nil) from explicit-empty by switching the guard
to pol.Grants == nil, the same asymmetry already used for ACLs.
{} keeps allowing all; {"acls": []} and {"grants": []} now both
deny all.

Fixes #3211
2026-04-29 08:55:07 +01:00
..
testdata testdata: add SaaS captures for compat tests 2026-04-17 16:31:49 +01:00
compiled.go policy/v2: fix empty grants/acls returning FilterAllowAll 2026-04-29 08:55:07 +01:00
filter.go policy/v2: fix empty grants/acls returning FilterAllowAll 2026-04-29 08:55:07 +01:00
filter_test.go policy/v2: fix empty grants/acls returning FilterAllowAll 2026-04-29 08:55:07 +01:00
main_test.go all: fix test flakiness and improve test infrastructure 2026-03-14 02:52:28 -07:00
policy.go policy/v2: fix empty grants/acls returning FilterAllowAll 2026-04-29 08:55:07 +01:00
policy_test.go policy/v2: fix empty grants/acls returning FilterAllowAll 2026-04-29 08:55:07 +01:00
tailscale_acl_data_compat_test.go policy/v2: overhaul compat test infrastructure 2026-04-17 16:31:49 +01:00
tailscale_grants_compat_test.go policy/v2: overhaul compat test infrastructure 2026-04-17 16:31:49 +01:00
tailscale_routes_data_compat_test.go policy/v2: overhaul compat test infrastructure 2026-04-17 16:31:49 +01:00
tailscale_ssh_data_compat_test.go policy/v2: overhaul compat test infrastructure 2026-04-17 16:31:49 +01:00
types.go Update links to Tailscale documentation 2026-04-18 09:33:41 +02:00
types_test.go policy/v2: fix empty grants/acls returning FilterAllowAll 2026-04-29 08:55:07 +01:00
utils.go policy/v2: exclude exit routes from ReduceFilterRules 2026-04-01 14:10:42 +01:00
utils_test.go policy/v2: exclude exit routes from ReduceFilterRules 2026-04-01 14:10:42 +01:00