policy: add test to confirm group cant approve tag

Confirms #2891 is implemented correctly.

Signed-off-by: Kristoffer Dalby <kristoffer@dalby.cc>
This commit is contained in:
Kristoffer Dalby
2025-12-16 12:19:59 +00:00
parent 2c3c943acf
commit f0e464dc36

View File

@@ -748,6 +748,32 @@ func TestNodeCanApproveRoute(t *testing.T) {
}`, }`,
canApprove: true, canApprove: true,
}, },
{
// Tags-as-identity: Tagged nodes are identified by their tags, not by the
// user who created them. Group membership of the creator is irrelevant.
// A tagged node can only be auto-approved via tag-based autoApprovers,
// not group-based ones (even if the creator is in the group).
name: "tagged-node-with-group-autoapprover-not-approved",
node: taggedNode, // Has tag:router, owned by user3
route: p("10.30.0.0/16"),
policy: `{
"tagOwners": {
"tag:router": ["user3@"]
},
"groups": {
"group:ops": ["user3@"]
},
"acls": [
{"action": "accept", "src": ["*"], "dst": ["*:*"]}
],
"autoApprovers": {
"routes": {
"10.30.0.0/16": ["group:ops"]
}
}
}`,
canApprove: false, // Tagged nodes don't inherit group membership for auto-approval
},
{ {
name: "small-subnet-with-exitnode-only-approval", name: "small-subnet-with-exitnode-only-approval",
node: normalNode, node: normalNode,