-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix hasMountPath for segment wildcard mounts; introduce priority order #6532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
vault/acl.go
Outdated
// isn't; use that | ||
continue | ||
} | ||
// Carry on checking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the checks currently in the else
block be run here?
BTW, for those who've been looking at this PR, I've pushed #6535 to (I hope) simplify it. |
…6535) Readability rewrite. It should have exactly the same behaviour, at least, that's the intent. Add some test cases. Removed a rule (total # of segments) from priority ordering because I couldn't come up with a case where it would apply and the two that followed it wouldn't. Also add support for policy paths '+' and '+*' which until now haven't been properly handled as wildcard segment paths.
@ncabatoff I can't approve since I initially opened the PR, but looks great! Thanks for picking this up! |
use case: path "pki/kubernetes-clusters-ca/*" { capabilities = ["read", "list"] } path "pki/kubernetes-clusters-ca/+/api/issue/sre-role" { capabilities = ["update"] } Now a glob is treated as a wildcard for the purpose of prioritizing "first wildcard", and the "number of wildcards" case swallows the "is/isn't prefix" case.
and wc segments (+), but went too far. We still treat them the same in terms of prioritizing based on the first position of + or *. But trying to lump them together and counting the number of +/*s doesn't make sense in some cases: foo/* should be lower priority than foo/+/+.
foo/+ outranks foo/*.
to see a policy prevent mount access, then modify the policy so it allows it.
This fixes
hasMountPath
when operating on segment wildcards, fixing the kv preflight check. As a part of this, I also introduce a longest-prefix priority ordering for cases where you have path segment wildcards in multiple paths. This will need some explanation in docs but for now it's well-commented.Fixes #6525