Skip to content

Commit fb97a45

Browse files
authored
VAULT-3825: Wildcard ACL policies without a trailing slash should match LIST operations (#23874)
* allow lists to match without trailing slash * changelog
1 parent 40e9fcd commit fb97a45

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

changelog/23874.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
core: fix policies with wildcards not matching list operations due to the policy path not having a trailing slash
3+
```

vault/acl.go

+10
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,16 @@ func (a *ACL) AllowOperation(ctx context.Context, req *logical.Request, capCheck
409409
}
410410
}
411411

412+
// List operations need to check without the trailing slash first, because
413+
// there could be other rules with trailing wildcards that will match the
414+
// path
415+
if op == logical.ListOperation && strings.HasSuffix(path, "/") {
416+
permissions = a.CheckAllowedFromNonExactPaths(strings.TrimSuffix(path, "/"), false)
417+
if permissions != nil {
418+
capabilities = permissions.CapabilitiesBitmap
419+
goto CHECK
420+
}
421+
}
412422
permissions = a.CheckAllowedFromNonExactPaths(path, false)
413423
if permissions != nil {
414424
capabilities = permissions.CapabilitiesBitmap

0 commit comments

Comments
 (0)