-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Multiple policies compose in a surprising way #5988
Comments
Hi there, Vault is default-deny and uses a capability based model. Capabilities are additive. One such capability that can be added is We recommend explicitly denying only in very specific circumstances, because it's quite easy to make a mistake and give priveleges you didn't intend to. The example you gave about creating a child token with a subset of policies, one of which does not contain a Your example is also exactly why creating child tokens is not in our |
That is a good argument, and I agree with the principle. I still have a concern about this specific part of the permissions model, however. You'll notice that the keyword "deny" never appears in my example. The behavior of "deny" isn't related to this. Instead, look at the two policies for the path |
allowed and denied parameters compose too. By puting all of those statements in policies affecting the parent token, the parent token is inhering denied parameters of Even though it's the parameters, not capabilities, that you're denying, it's the same concept, and why using policies to deny instead of to grant is not generally recommended. It may be helpful for you to check out the command |
Closing for now as this seems like it's not a bug. |
Describe the bug
When a token is associated with multiple policies, it would be expected that those policies each add more permissions, not take them away. However, the actual behavior is that additional policies might be able to remove permissions.
Suppose that a policy grants the capability to access the path
/foo/*
but denies access to/bar/*
. A separate policy grants access to/bar/*
but denies access to/foo/*
. Combining these policies leads to a token that has fewer permissions than a token that doesn't have those policies.When policies are combined, it's expected that the permissions are cumulative. That's because that's the security model that seems to be supported. When a parent token creates a child token, it is allowed to selectively pass policies down to the child. If some policies were meant for denying permissions, then the parent would be able to circumvent those restrictions when creating a child token.
Or alternatively, the security model should clarify that it is supported to use policies to remove permissions. To go that route, it would make sense for parent tokens to only be allowed to create child tokens that had exactly their same policies. It would be unsafe to allow parents to specify a subset of policies if policies are indeed supposed to be able to restrict permissions.
To Reproduce
This issue affects a wide variety of paths throughout Vault. This particular example shows the difficulty in creating a policy that allows creating an AppRole and getting its secret. These are the configuration steps to create the token:
Then, you can verify that the parent token is denied access to the AppRole endpoints:
The command reports
permission denied
.Strangely, the parent token is allowed to create child tokens that are given access to the AppRole endpoints:
Expected behavior
The parent token should not get a
permission denied
error for operations that its child tokens are allowed to perform.Environment:
Additional context
This is similar to #3892, except that ticket is referring to longest-path matching, while this ticket also covers paths of the same length.
The text was updated successfully, but these errors were encountered: