-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Perform live OAuth client check only if scopes were added to the client authorization #15149
Conversation
9391de9
to
92b6707
Compare
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>
92b6707
to
bb13f12
Compare
[severity:blocker] |
xref #14999 |
LGTM |
LGTM. |
👍 |
[test] |
Evaluated for origin test up to bb13f12 |
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) |
|
||
newScopes := sets.NewString(obj...) | ||
oldScopes := sets.NewString(old...) | ||
return len(newScopes.Difference(oldScopes)) > 0 |
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'm not sure but) why not use !oldScopes.IsSuperset(newScopes)
instead? It won't collect the items that we don't need anyway.
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)
[test]
@jupierce @openshift/security
@liggitt PTAL