mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
additional ACL Policy tests (#13464)
This changeset includes some additional unit tests for secure variables ACL policies, so that we have explicit coverage of edge cases we're discussing with the UI folks.
This commit is contained in:
@@ -486,6 +486,52 @@ func TestSecureVariablesMatching(t *testing.T) {
|
||||
op: "read",
|
||||
allow: true,
|
||||
},
|
||||
{
|
||||
name: "concrete namespace with non-prefix wildcard path matches",
|
||||
policy: `namespace "ns" {
|
||||
secure_variables { path "*/bar" { capabilities = ["read"] }}}`,
|
||||
ns: "ns",
|
||||
path: "foo/bar",
|
||||
op: "read",
|
||||
allow: true,
|
||||
},
|
||||
{
|
||||
name: "concrete namespace with overlapping wildcard path prefix over suffix matches",
|
||||
policy: `namespace "ns" {
|
||||
secure_variables {
|
||||
path "*/bar" { capabilities = ["list"] }
|
||||
path "foo/*" { capabilities = ["write"] }
|
||||
}}`,
|
||||
ns: "ns",
|
||||
path: "foo/bar",
|
||||
op: "write",
|
||||
allow: true,
|
||||
},
|
||||
{
|
||||
name: "concrete namespace with overlapping wildcard path prefix over suffix denied",
|
||||
policy: `namespace "ns" {
|
||||
secure_variables {
|
||||
path "*/bar" { capabilities = ["list"] }
|
||||
path "foo/*" { capabilities = ["write"] }
|
||||
}}`,
|
||||
ns: "ns",
|
||||
path: "foo/bar",
|
||||
op: "list",
|
||||
allow: false,
|
||||
},
|
||||
{
|
||||
name: "concrete namespace with wildcard path matches most specific only",
|
||||
policy: `namespace "ns" {
|
||||
secure_variables {
|
||||
path "*" { capabilities = ["read"] }
|
||||
path "foo/*" { capabilities = ["read"] }
|
||||
path "foo/bar" { capabilities = ["list"] }
|
||||
}}`,
|
||||
ns: "ns",
|
||||
path: "foo/bar",
|
||||
op: "read",
|
||||
allow: false,
|
||||
},
|
||||
{
|
||||
name: "concrete namespace with invalid concrete path fails",
|
||||
policy: `namespace "ns" {
|
||||
|
||||
Reference in New Issue
Block a user