mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
VAULT-3825: Wildcard ACL policies without a trailing slash should match LIST operations (#23874)
* allow lists to match without trailing slash * changelog
This commit is contained in:
parent
40e9fcde49
commit
fb97a459ec
2 changed files with 13 additions and 0 deletions
3
changelog/23874.txt
Normal file
3
changelog/23874.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
core: fix policies with wildcards not matching list operations due to the policy path not having a trailing slash
|
||||
```
|
||||
10
vault/acl.go
10
vault/acl.go
|
|
@ -409,6 +409,16 @@ func (a *ACL) AllowOperation(ctx context.Context, req *logical.Request, capCheck
|
|||
}
|
||||
}
|
||||
|
||||
// List operations need to check without the trailing slash first, because
|
||||
// there could be other rules with trailing wildcards that will match the
|
||||
// path
|
||||
if op == logical.ListOperation && strings.HasSuffix(path, "/") {
|
||||
permissions = a.CheckAllowedFromNonExactPaths(strings.TrimSuffix(path, "/"), false)
|
||||
if permissions != nil {
|
||||
capabilities = permissions.CapabilitiesBitmap
|
||||
goto CHECK
|
||||
}
|
||||
}
|
||||
permissions = a.CheckAllowedFromNonExactPaths(path, false)
|
||||
if permissions != nil {
|
||||
capabilities = permissions.CapabilitiesBitmap
|
||||
|
|
|
|||
Loading…
Reference in a new issue