Skip to content
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

Merged
merged 16 commits into from
Apr 10, 2019

Conversation

jefferai
Copy link
Member

@jefferai jefferai commented Apr 4, 2019

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

@jefferai jefferai added this to the 1.1.1 milestone Apr 4, 2019
michelvocks
michelvocks previously approved these changes Apr 4, 2019
Copy link
Contributor

@michelvocks michelvocks left a 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 Show resolved Hide resolved
vault/acl.go Outdated Show resolved Hide resolved
vault/acl.go Outdated
// isn't; use that
continue
}
// Carry on checking
Copy link
Contributor

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?

vault/acl.go Outdated Show resolved Hide resolved
vault/acl.go Outdated Show resolved Hide resolved
@ncabatoff
Copy link
Collaborator

BTW, for those who've been looking at this PR, I've pushed #6535 to (I hope) simplify it.

vishalnayak and others added 5 commits April 5, 2019 14:17
…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.
@jefferai
Copy link
Member Author

jefferai commented Apr 9, 2019

@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/+/+.
to see a policy prevent mount access, then modify the policy so it
allows it.
@ncabatoff ncabatoff merged commit 9fb146f into master Apr 10, 2019
@ncabatoff ncabatoff deleted the path-segment-prio branch April 10, 2019 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preflight check fails with ACL wildcard in path for kv get command
5 participants