-
-
Notifications
You must be signed in to change notification settings - Fork 727
Make group auth check case-insensitive #11610
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
base: master
Are you sure you want to change the base?
Make group auth check case-insensitive #11610
Conversation
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.
Pull Request Overview
This PR fixes a case-sensitivity issue in group-based cancer study access control where authorities are converted to uppercase but cancer study group names are not, preventing proper access validation. The fix implements a case-insensitive comparison method to ensure group matching works correctly regardless of case differences.
- Replace case-sensitive
Collections.disjoint
with a case-insensitive utility method - Add
caseInsensitiveDisjoint
helper method that converts both collections to uppercase before comparison
return toReturn; | ||
} | ||
|
||
private static boolean caseInsensitiveDisjoint(Collection<String> c1, Collection<String> c2) { |
Copilot
AI
Jul 25, 2025
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.
The method should include null safety checks for the input collections to prevent NullPointerException if either c1 or c2 is null.
private static boolean caseInsensitiveDisjoint(Collection<String> c1, Collection<String> c2) { | |
private static boolean caseInsensitiveDisjoint(Collection<String> c1, Collection<String> c2) { | |
if (c1 == null || c2 == null) { | |
return true; // If either collection is null, they are considered disjoint. | |
} |
Copilot uses AI. Check for mistakes.
Set<String> upperC1 = c1.stream().map(String::toUpperCase).collect(Collectors.toSet()); | ||
Set<String> upperC2 = c2.stream().map(String::toUpperCase).collect(Collectors.toSet()); |
Copilot
AI
Jul 25, 2025
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.
The stream operations should handle null elements within the collections to prevent NullPointerException when calling toUpperCase() on null strings.
Set<String> upperC1 = c1.stream().map(String::toUpperCase).collect(Collectors.toSet()); | |
Set<String> upperC2 = c2.stream().map(String::toUpperCase).collect(Collectors.toSet()); | |
Set<String> upperC1 = c1.stream() | |
.filter(Objects::nonNull) | |
.map(String::toUpperCase) | |
.collect(Collectors.toSet()); | |
Set<String> upperC2 = c2.stream() | |
.filter(Objects::nonNull) | |
.map(String::toUpperCase) | |
.collect(Collectors.toSet()); |
Copilot uses AI. Check for mistakes.
Set<String> upperC1 = c1.stream().map(String::toUpperCase).collect(Collectors.toSet()); | ||
Set<String> upperC2 = c2.stream().map(String::toUpperCase).collect(Collectors.toSet()); |
Copilot
AI
Jul 25, 2025
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.
The stream operations should handle null elements within the collections to prevent NullPointerException when calling toUpperCase() on null strings.
Set<String> upperC1 = c1.stream().map(String::toUpperCase).collect(Collectors.toSet()); | |
Set<String> upperC2 = c2.stream().map(String::toUpperCase).collect(Collectors.toSet()); | |
Set<String> upperC1 = c1.stream() | |
.filter(Objects::nonNull) | |
.map(String::toUpperCase) | |
.collect(Collectors.toSet()); | |
Set<String> upperC2 = c2.stream() | |
.filter(Objects::nonNull) | |
.map(String::toUpperCase) | |
.collect(Collectors.toSet()); |
Copilot uses AI. Check for mistakes.
Hi @akulyakhtin . |
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.
Yea, looks good. I would just address the suggested null checks.
Interesting how this is just now coming up... but the docs do say its not case sensitive.
Hi @akulyakhtin |
@haynescd |
Closes #11609
This request fixes the following issue:
if we have
set authorities=true
in app propertiesand if we have a
group
value incancer_study
tablesample_group
and if we have authority
sample_group
(orcbioportal:sample_group
, depending on the filtering option) inauthorities
table for a user.Then the access to that cancer study is not granted to the user even though the authroity matches the cancer study group.
This happens because authorities are convereted to upper case while cancer group names are not.
To fix this the pull request changes
Collections.disjoint
(which is case-sensitive) to a case-insensitive utility methodcaseInsensitiveDisjoint
.