-
Notifications
You must be signed in to change notification settings - Fork 933
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
Auth: Add project query parameter to URLs in authorizer #13317
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
markylaing
force-pushed
the
authorizer-add-project
branch
from
April 24, 2024 12:29
ad1d4e6
to
a4fa4d3
Compare
markylaing
force-pushed
the
authorizer-add-project
branch
from
July 5, 2024 15:15
a4fa4d3
to
eb099b5
Compare
@tomponline This is ready for review when you have time. Thanks. |
markylaing
changed the title
Auth: Add project query parameter to URLs in authorizer.
Auth: Add project query parameter to URLs in authorizer
Jul 5, 2024
markylaing
force-pushed
the
authorizer-add-project
branch
from
July 9, 2024 09:21
685eb8f
to
e030027
Compare
tomponline
reviewed
Jul 18, 2024
tomponline
reviewed
Jul 18, 2024
tomponline
reviewed
Jul 18, 2024
tomponline
reviewed
Jul 18, 2024
tomponline
reviewed
Jul 18, 2024
tomponline
reviewed
Jul 18, 2024
tomponline
reviewed
Jul 18, 2024
tomponline
requested changes
Jul 18, 2024
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.
One question on tests and a few nits around "err" in logging.
Previously this was just returned in the path arguments. Signed-off-by: Mark Laing <[email protected]>
So that `URL` is the inverse of `ParseURL`, we should explicitly ignore the `projectName` argument when creating the URL of a project. Signed-off-by: Mark Laing <[email protected]>
We now expect the project name to be returned from ParseURL. Additionally, we now test that the normalised URL is what we expect. Signed-off-by: Mark Laing <[email protected]>
…ents. We can now use the value of `projectName` returned from ParseURL. Signed-off-by: Mark Laing <[email protected]>
…uments. We can now use the value of `projectName` returned from ParseURL. Signed-off-by: Mark Laing <[email protected]>
This commit regenerates the entity URLs that are passed into `CheckPermission` and the `PermissionChecker` returned by `GetPermissionChecker` to enforce that the project parameter is added to the URL even if it is "default". This is expected by the underlying `storage.OpenFGADatastore` implementation. Signed-off-by: Mark Laing <[email protected]>
The entity URLs returned by `projectUsedBy` included the project query parameter even when the project was "default". Signed-off-by: Mark Laing <[email protected]>
We no longer need to enforce that the project query parameter is set in the URLs that are passed into Authorizer methods, nor do we need to strip the project query parameter from the URL. Signed-off-by: Mark Laing <[email protected]>
All LXD entity URLs are parsed into a project, a location, and a slice of path arguments. Previously when parsing a project URL, the project name was empty because it is present in the path arguments. Now that the project name is being returned, we need our entity SQL queries to match. Signed-off-by: Mark Laing <[email protected]>
markylaing
force-pushed
the
authorizer-add-project
branch
from
July 25, 2024 13:08
e030027
to
2443da2
Compare
tomponline
approved these changes
Jul 26, 2024
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.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In our implementation of
(github.com/openfga/openfga/pkg/storage).OpenFGADatastore
, entity URLs are expected to include the project query parameter even if it is the default project. However, LXD typically displays URLs without the project query parameter when a resource is in the default project (with the exception of permissions, where we have been explicit).This PR ensures that the project query parameter is added to URLs inside the Authorizer so that this doesn't need to be done elsewhere in the codebase (such as in
project.FilterUsedBy
which has now been simplified).Closes #13072