state: resolve changed peers through adjacency

ListPeers now filters named peers against the recipient's adjacency, so
a node the policy hides is never delivered.

Updates #3417
This commit is contained in:
Kristoffer Dalby
2026-09-09 14:43:35 +00:00
parent e3c4c81b18
commit 4c6a2dff52
3 changed files with 19 additions and 32 deletions
+7 -7
View File
@@ -485,12 +485,12 @@ func TestBuildFromChangeVisibilityMatchesFullMap(t *testing.T) {
return false
}
// wantFull pins the actual peer-visibility semantics so the invariant below
// cannot pass vacuously (e.g. if every path broke to zero identically).
// Note deny_all: an empty ACL set compiles to zero matchers, which headscale
// treats as "no visibility restriction" — all peers are visible on every
// path (the packet filter denies traffic separately). user_isolation and
// autogroup_self are the discriminating cases that prove filtering works.
// wantFull pins the actual peer-visibility semantics so the cross-path
// check below cannot pass vacuously (e.g. if every path broke to zero
// identically).
// Note deny_all: an empty ACL set yields no peer adjacency, so nothing is
// visible on any path. user_isolation and autogroup_self remain the
// discriminating cases that prove filtering works.
tests := []struct {
name string
policy string
@@ -505,7 +505,7 @@ func TestBuildFromChangeVisibilityMatchesFullMap(t *testing.T) {
]}`,
1,
},
{"deny_all", `{"acls":[]}`, 2},
{"deny_all", `{"acls":[]}`, 0},
{
"autogroup_self",
`{"acls":[{"action":"accept","src":["autogroup:member"],"dst":["autogroup:self:*"]}]}`,