Skip to content
Snippets Groups Projects
Verified Commit a152704a authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Reject access if there are no allowed_scopes set (ClientProtectedResourceMixin)

parent 14262ec4
No related branches found
No related tags found
1 merge request!1011Resolve "ClientProtectedResourceMixin allows access if no allowed_scopes are set"
Pipeline #66189 passed with warnings
......@@ -26,6 +26,8 @@ Fixed
* Due to a merge error, the once removed account menu in the sidenav appeared again.
* Scheduled notifications were shown on dashboard before time.
* Remove broken notifications menu item in favor of item next to account menu.
* [OAuth2] Resources which are protected with client credentials
allowed access even if there were not allowed scopes set.
Changed
~~~~~~~
......
......@@ -134,6 +134,10 @@ class ClientProtectedResourceMixin(_ClientProtectedResourceMixin):
# Verify scopes of configured application
# The OAuth request was enriched with a reference to the Application when using the
# validator above.
if not oauth_request.client.allowed_scopes:
# If there are no allowed scopes, the client is not allowed to access this resource
return False
required_scopes = set(self.get_scopes() or [])
allowed_scopes = set(AppScopes().get_available_scopes(oauth_request.client) or [])
return required_scopes.issubset(allowed_scopes)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment