-
Notifications
You must be signed in to change notification settings - Fork 222
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
fix: remove default namespace as a requirement to list namespaces v2 #3716
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
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.
im confused about what the difference is between using this and what you did previously by setting
WithNamespace("")
in theListNamespaceRequest
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.
@markphelps It would be nice if you double check it with me. Burned once already...
WithNamespace
doesn't allow to set empty string for some reasonflipt/rpc/flipt/request.go
Lines 52 to 58 in 2ca2273
As
WithNamespace
is a public func, I can't remove condition without breaking changes for others. So I've created a new optionWithNoNamespace
.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 think we are the only ones who use this function as its only used internally to enforce authz, so I think its fine to remove the check for empty string in the function body
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.
@markphelps Could you please help me how to move forward? The integration tests has a case where the empty namespace should fallback to default namespace. Should I skip this case for authz integration tests or should I continue with
WithNoNamespace
option and keep all the integration test cases?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 guess ideally we should continue again with the
WithNoNamespace
option to keep the integration tests. we should likely add one to make sure that they can list namespaces still ifWithNoNamespace
is usedThere 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 am stuck. Integration tests for authz don't have calls with ListNamespaceRequest as I see. What is going on? Where is my blind spot? Why namespaced viewer could be affected by this change?
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.
@erka I will take a look this evening
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.
so the policy for the IT is coming from here: https://github.com/flipt-io/flipt/blob/main/build/testing/integration.go#L704-L839
and the failing test is here: https://github.com/flipt-io/flipt/blob/main/build/testing/integration/authn/auth.go#L145
so there is some reason that the policy is matching, but that doesn't make sense because we are not passing in a role in the request, so
has_rules
should be returning the empty set, but it must be returning some rules which makes me think the""
role is being matched somewhere in the policyI think our rego policy for the authz test is not compatible with the change of allowing no namespace in the request
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.
A wild guess... if tests are using rest api and
getNamespace
with empty namespace, the url probably will be/api/v1/namespaces/
and grpc-gateway could remove the last flash and interpret that as call to list namespaces.flipt/sdk/go/http/flipt.sdk.gen.go
Lines 87 to 95 in 729a965