-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Prevent escalating resource access by default #8818
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
Prevent escalating resource access by default #8818
Conversation
@@ -188,8 +209,59 @@ func (e clusterRoleEvaluator) ResolveRules(scope, namespace string, clusterPolic | |||
|
|||
rules := []authorizationapi.PolicyRule{} | |||
for _, rule := range role.Rules { | |||
// rules with unbounded access shouldn't be allowed in scopes. | |||
if rule.Verbs.Has(authorizationapi.VerbAll) || rule.Resources.Has(authorizationapi.ResourceAll) || getAPIGroupSet(rule).Has(authorizationapi.APIGroupAll) { |
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.
I think the escalating check should apply to these as well
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.
I think the escalating check should apply to these as well
ok
945081e
to
91545d2
Compare
@stevekuznetsov small. ptal. |
// escalatingScopeResources are resources that are considered escalating for scope evaluation | ||
var escalatingScopeResources = []unversioned.GroupResource{ | ||
{Group: kapi.GroupName, Resource: "secrets"}, | ||
/*imageapi.GroupName*/ {Group: "", Resource: "imagestreams/secrets"}, |
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.
I don't really understand why these are comments instead of the actual group names
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.
I don't really understand why these are comments instead of the actual group names
We don't want to introduce a dependency from this package to that one. Authorization should be a clean-ish layer, if possible.
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.
I don't really buy that, what do we gain from two fewer import statements?
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.
I don't really buy that, what do we gain from two fewer import statements?
Can be split out as a separate component. It doesn't care whether various api groups are present.
91545d2
to
4a849d2
Compare
[merge] |
4a849d2
to
25def50
Compare
Evaluated for origin merge up to 25def50 |
[Test]ing while waiting on the merge queue |
Evaluated for origin test up to 25def50 |
@danmcp mean anything to you?
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5891/) (Image: devenv-rhel7_4168) |
@deads2k Yes. It should be fixed shortly. |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3768/) |
This prevents scopes from having access to escalating resource by default, but also provides a means to request a role based scope that is escalating by adding
:!
to the end of the "normal" definitionrole:<role name>:<effective namespace[:!]
.@sgallagher ptal I think this is the last bit required to unblock useful scopes.