-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat: filter sso groups based on regex #11774
feat: filter sso groups based on regex #11774
Conversation
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
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.
Would an allowlist of groups suffice as well? Or is a regex necessary for the amount of relevant groups?
Reason for regex is to be able to add groups dynamically. And be able to filter our groups which will be relevant for argo SSO rbac. And reduce number of groups to bring the cookie size below 4kb with |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
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 idea. So, for a given cluster there would be only one particular regex that can be matched, right? I wonder if we should make it an array of regex?
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.
LGTM
@basanthjenuhb Can you add the document for this? |
yeah |
|
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, for a given cluster there would be only one particular regex that can be matched, right? I wonder if we should make it an array of regex?
Julie brings up a good point here
we could make it an array
but wanted to keep it simple and see how it works out for us
we can take it up as an enhancement after we see this one’s usage
Adding a feature afterward is a bit easier said than done -- there would then be two features that need to be maintained for backward-compatibility.
If we can get ahead of a problem now, it would certainly aid maintainability
correct. that is not necessarily a bad thing though. I'm not opposed to regex but there is a security trade-off.
there is a separate issue to improve that: #10970 |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Wait a minute, maybe I spoke too soon. This is a regex after all, you can do "or" conditions within a regex. Would that suffice? That would actually be simpler than having to tell users whether the array is "or" vs. "and" Sorry I haven't been home all day, responded from my phone. Apologies if this results in rework 🙇 |
You're right. Just looked that up. It's more doable than I thought it was. |
yes, I had looked it up filterGroupsRegex:
- ".*patternA.*"
- ".*patternB.*" I would prefer list over single regex if the idea is to support multiple patterns. |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
I agree if you’re open to changing it. Thanks |
already did |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
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.
there's some stylistic issues in the code (it was spliced in between another block of related code), see below
I don't have too strong an opinion on this so long as the documentation makes clear that the list is "OR"'d together. Otherwise it may be ambiguous to users. I mentioned this in my docs review A singular regex does not have any ambiguity; that would be the main benefit (also simpler code) |
@@ -280,6 +293,18 @@ func (s *sso) HandleCallback(w http.ResponseWriter, r *http.Request) { | |||
return | |||
} | |||
} | |||
if s.filterGroupsRegex != nil && len(s.filterGroupsRegex) > 0 { | |||
var filteredGroups []string |
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.
it would be great if the provider could do this logic so that the response from it is not so large, but it does not seem there is a uniform provider interface for that.
- Azure AD implements group filtering per app
- LDAP more generally has group search
There is a related Dex issue on this (dexidp/dex#1476) and generalizing it was basically closed out due to provider-specific nuances.
So I think there may be no way around filtering in the Server code unfortunately.
If a user has an IdP proxy like Dex though, they can do this group filter logic within Dex. As we get into more complex scenarios like these, we may want to consider limiting the scope of the internal implementation and forwarding users to Dex et al instead.
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
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.
LGTM. Thanks for iterating on this!
@sarabala1979 Sorry just saw it. Let's discuss this in the next contributors meeting on v3.5 release strategy. #11381 |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com> Co-authored-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com> Co-authored-by: bjenuhb <Basanth_JenuHB@intuit.com> Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Fixes #10153
Fixes #9530
Motivation
Modifications
filterGroupsRegex
in SSO configVerification
filterGroupsRegex
Example usage: