Skip to content

Update Covers to handle AttributeRestrictions#13415

Merged
openshift-bot merged 1 commit intoopenshift:masterfrom
enj:enj/i/covers_attribute_restrictions
Mar 18, 2017
Merged

Update Covers to handle AttributeRestrictions#13415
openshift-bot merged 1 commit intoopenshift:masterfrom
enj:enj/i/covers_attribute_restrictions

Conversation

@enj
Copy link
Contributor

@enj enj commented Mar 16, 2017

Fixes #13312

Needed to finish #13334

cc @liggitt

[test]

Signed-off-by: Monis Khan mkhan@redhat.com

@enj enj requested a review from deads2k March 16, 2017 18:05
@deads2k
Copy link
Contributor

deads2k commented Mar 16, 2017

looks reasonable.

@liggitt
Copy link
Contributor

liggitt commented Mar 16, 2017

did we remove all rules with attribute restrictions from bootstrap policy already?

@deads2k
Copy link
Contributor

deads2k commented Mar 16, 2017

did we remove all rules with attribute restrictions from bootstrap policy already?

There was a todo somewhere. @enj this is a reasonable pull to do it in.

@liggitt
Copy link
Contributor

liggitt commented Mar 16, 2017

it has to be done here, otherwise reconciliation will keep re-adding those rules, since they'll show up as uncovered

@enj
Copy link
Contributor Author

enj commented Mar 16, 2017

it has to be done here, otherwise reconciliation will keep re-adding those rules, since they'll show up as uncovered

The unit tests I wrote should fail if that was the case =\

@deads2k
Copy link
Contributor

deads2k commented Mar 16, 2017

it has to be done here, otherwise reconciliation will keep re-adding those rules, since they'll show up as uncovered

The rule doesn't do anything. It's always covered because it's a rule that grants no permissions. A rule with attributerestrictions is completely ignored by the authorizer.

@liggitt
Copy link
Contributor

liggitt commented Mar 16, 2017

ah, do we breakdown both existing and expected rules?

@deads2k
Copy link
Contributor

deads2k commented Mar 16, 2017

ah, do we breakdown both existing and expected rules?

His update here doesn't allow a rule with attributerestrictions to cover anything and when it breaks down a rule with attributestrictions, it returns an empty slice of rules.

@enj enj force-pushed the enj/i/covers_attribute_restrictions branch from 6eeac4e to 607e970 Compare March 16, 2017 18:26
@enj
Copy link
Contributor Author

enj commented Mar 16, 2017

@deads2k I removed all the rules with AttributeRestrictions that are not in test files.

@deads2k
Copy link
Contributor

deads2k commented Mar 16, 2017

lgtm[merge]

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 17, 2017
Signed-off-by: Monis Khan <mkhan@redhat.com>
@enj enj force-pushed the enj/i/covers_attribute_restrictions branch from 607e970 to 8c66c8d Compare March 17, 2017 17:28
@enj enj removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 17, 2017
@deads2k
Copy link
Contributor

deads2k commented Mar 17, 2017

[merge]

@enj
Copy link
Contributor Author

enj commented Mar 17, 2017

Flake #13426

@deads2k
Copy link
Contributor

deads2k commented Mar 17, 2017

re[merge]

@deads2k
Copy link
Contributor

deads2k commented Mar 17, 2017

re[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 8c66c8d

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/292/) (Base Commit: 9e19032)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 8c66c8d

@openshift-bot
Copy link
Contributor

openshift-bot commented Mar 18, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/133/) (Base Commit: bd0bf10) (Image: devenv-rhel7_6086)

@openshift-bot openshift-bot merged commit 52c9149 into openshift:master Mar 18, 2017
case UserAccessCheck:
return []authorizationapi.PolicyRule{
authorizationapi.NewRule("create").Groups(kauthorizationapi.GroupName).Resources("selfsubjectaccessreviews").RuleOrDie(),
{Verbs: sets.NewString("create"), APIGroups: []string{authorizationapi.GroupName, authorizationapi.LegacyGroupName}, Resources: sets.NewString("subjectaccessreviews", "localsubjectaccessreviews"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change broke the ability of a client to request a subject access review without scopes. Scopes aren't in upstream Kube, and as a result, you can no longer use a token that only has "user:info user:check-access" scopes to do a SAR that tells you what the user can do. Which breaks the ability to use this as a proxy.

If I can't do SAR and take scopes into account, then we are regressing functionality and shouldn't remove this until we have an equivalent behavior in Kube. If there's a workaround I don't see it - couldn't find anything that allowed a separate channel for passing scopes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to use as a proxy, without granting a token that gives you the ability to act as the full user.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream has a dedicated resource for SelfSubjectAccessReview… no attribute restrictions needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't pass empty scopes to check permissions on it like i can today.

@liggitt
Copy link
Contributor

liggitt commented Apr 11, 2017

Ah. All the existing openshift APIs should still be usable and work identically. If they don't, that's a bug we have to fix.

The goal of this was not to change that but to remove dependence on AttributeRestrictions. The special case of IsPersonalSubjectAccessReview got shifted from being embedded in the role attribute restrictions to being treated by the authorizer as a SelfSubjectAccessReview resource for authorization purposes. That should all be internal impl details… if anything leaked or broke, we'll need to resolve it.

@smarterclayton
Copy link
Contributor

smarterclayton commented Apr 11, 2017 via email

@deads2k
Copy link
Contributor

deads2k commented Apr 11, 2017

This changed the way the permission is expressed, but did not change the way the API works. The openshift self-SAR endpoint is still available and accessible. The permission used for the check is the kube self-sar, not the openshift self-sar, but the old endpoint is still there.

@deads2k
Copy link
Contributor

deads2k commented Apr 11, 2017

I think the gap is that a user:check-access user should be able to do the
equivalent of

This is something that the upstream self-SAR can't do, but this pull did not remove the ability to use the old openshift API endpoint (or it wasn't intended to at any rate). The openshift endpoint checks the kube self-SAR permission.

@smarterclayton
Copy link
Contributor

smarterclayton commented Apr 11, 2017 via email

@smarterclayton
Copy link
Contributor

Fixed in #13715

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.

5 participants