-
Notifications
You must be signed in to change notification settings - Fork 16
Fix bug in client with no scopes #830
Changes from all commits
2b050f4
478d554
dfce2b0
9d36edb
fc346de
c57ddde
dc79c2e
faa83a7
6110b11
f5820e5
dd457da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
from starlette.status import HTTP_404_NOT_FOUND | ||
|
||
from fidesops.api.deps import get_db | ||
from fidesops.api.v1.scope_registry import SCOPE_REGISTRY | ||
from fidesops.api.v1.urn_registry import TOKEN, V1_URL_PREFIX | ||
from fidesops.core.config import config | ||
from fidesops.models.policy import PolicyPreWebhook | ||
|
@@ -138,8 +139,9 @@ async def verify_oauth_client( | |
if not client_id: | ||
raise AuthorizationError(detail="Not Authorized for this action") | ||
|
||
# scopes param is only used if client is root client, otherwise we use the client's associated scopes | ||
client = ClientDetail.get( | ||
db, object_id=client_id, config=config, scopes=security_scopes.scopes | ||
db, object_id=client_id, config=config, scopes=SCOPE_REGISTRY | ||
Comment on lines
-142
to
+144
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there already a ticket to cut over to using the fideslib version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're bumping version in this PR here- https://github.com/ethyca/fidesops/pull/830/files#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552L13 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean fideslib scops? We weren't able to put the scopes in fideslib and had to do it this way because the different libraries have different scopes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant using the fideslib verify_oauth_client! |
||
) | ||
|
||
if not client: | ||
|
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.
From an organizational perspective, this is confusing, in that these scopes are only used if the client is the root client, otherwise, we use their actual associated scopes, but just looking at this line, that is not necessarily obvious. I'd at least add a code comment here explaining that.
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.
good point, I'd love to rename
scopes
toroot_scopes
orall_scopes
or something in future, though that'll require more fideslib changes. For now, let's get this working, and I'll update with a commentThere 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.
thank you for adding!