Resolve VNC authorized users on the components path and fix uinput, X11 and macOS input gaps

This commit is contained in:
Viktor Liu
2026-08-29 09:04:02 +02:00
parent 84e88e0371
commit 8b719f0b4e
6 changed files with 194 additions and 36 deletions
@@ -968,6 +968,39 @@ func TestGetPeerNetworkMapComponents_SSHRequirements(t *testing.T) {
},
targetInSrc: true,
},
// VNC resolves authorized users exactly the way SSH does, so it needs
// the same inputs carried into the components. Leaving it out strips
// them and the rule reaches the resolver with nobody authorized.
{
name: "netbird-vnc with authorized groups",
mutateRule: func(r *nmdata.PolicyRule) {
r.Protocol = string(nbtypes.PolicyRuleProtocolNetbirdVNC)
r.AuthorizedGroups = map[string][]string{"g-auth": nil}
},
wantGroupsMap: map[string][]string{"g-auth": {"user-a"}},
},
{
name: "netbird-vnc default needs allowed users",
mutateRule: func(r *nmdata.PolicyRule) {
r.Protocol = string(nbtypes.PolicyRuleProtocolNetbirdVNC)
},
wantAllowed: true,
},
{
name: "netbird-vnc with authorized user carries its own",
mutateRule: func(r *nmdata.PolicyRule) {
r.Protocol = string(nbtypes.PolicyRuleProtocolNetbirdVNC)
r.AuthorizedUser = "user-1"
},
},
{
name: "netbird-vnc only counts on the destination side",
mutateRule: func(r *nmdata.PolicyRule) {
r.Protocol = string(nbtypes.PolicyRuleProtocolNetbirdVNC)
},
targetInSrc: true,
},
}
for _, tc := range cases {