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

Perform live OAuth client check only if scopes were added to the client authorization #15149

Conversation

enj
Copy link
Contributor

@enj enj commented Jul 11, 2017

This change makes it so that OAuthClientAuthorization update validation only does a live OAuth client check to validate scopes if new scopes were added to the client authorization. If the scopes were unchanged or only removed (removal of all scopes is considered an addition since an empty slice means all scopes), than no live lookup is performed under the assumption that the create method did a successful live lookup at some earlier point. This makes it so that an update to a client authorization with identical data (for example, during storage migration) will not fail if the referenced client is no longer valid or has been deleted.

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

Fixes #15007

xref: #15007 (comment)

issue was with lookup of OAuth client in order to validate scopes. we only need to do this if scopes are being added to the authorization. @enj will make the lookup conditional

[test]

@jupierce @openshift/security

@liggitt PTAL

@enj enj force-pushed the enj/i/migrate_storage_oauthclientauthorizations/15007 branch from 9391de9 to 92b6707 Compare July 11, 2017 18:05
This change makes it so that OAuthClientAuthorization update validation
only does a live OAuth client check to validate scopes if new scopes
were added to the client authorization.  If the scopes were unchanged or
only removed (removal of all scopes is considered an addition since an
empty slice means all scopes), than no live lookup is performed under
the assumption that the create method did a successful live lookup at
some earlier point.  This makes it so that an update to a client
authorization with identical data (for example, during storage
migration) will not fail if the referenced client is no longer valid or
has been deleted.

Signed-off-by: Monis Khan <mkhan@redhat.com>
@enj enj force-pushed the enj/i/migrate_storage_oauthclientauthorizations/15007 branch from 92b6707 to bb13f12 Compare July 11, 2017 18:17
@smarterclayton
Copy link
Contributor

[severity:blocker]

@smarterclayton
Copy link
Contributor

xref #14999

@liggitt
Copy link
Contributor

liggitt commented Jul 11, 2017

LGTM

@mrogers950
Copy link
Contributor

LGTM.

@abstractj
Copy link
Contributor

👍

@smarterclayton
Copy link
Contributor

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to bb13f12

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/3061/) (Base Commit: edb53ef) (PR Branch Commit: bb13f12)

@smarterclayton smarterclayton merged commit 4c51c95 into openshift:master Jul 12, 2017

newScopes := sets.NewString(obj...)
oldScopes := sets.NewString(old...)
return len(newScopes.Difference(oldScopes)) > 0
Copy link
Contributor

@php-coder php-coder Jul 13, 2017

Choose a reason for hiding this comment

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

(I'm not sure but) why not use !oldScopes.IsSuperset(newScopes) instead? It won't collect the items that we don't need anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants