Skip to content

Conversation

KingAlex1985
Copy link
Contributor

Same as pull request #11610 but also including the Copilot's recommendations regarding null pointer checks.

@inodb and @haynescd
Because the user "akulyakhtin" is not answering and not changing the code at his own pull request 11610, I have created a pull request on my on now.

Description is still the same:
Closes #11609

This request fixes the following issue:
if we have set authorities=true in app properties
and if we have a group value in cancer_study table sample_group
and if we have authority sample_group (or cbioportal:sample_group, depending on the filtering option) in authorities 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 method caseInsensitiveDisjoint.

@inodb inodb requested a review from Copilot August 28, 2025 22:44
Copy link

@Copilot Copilot AI left a 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 the group-based authentication system where cancer study access was incorrectly denied due to case mismatches between authorities and cancer study groups. The fix replaces the case-sensitive Collections.disjoint with a new case-insensitive utility method that also includes null pointer safety checks.

  • Replaces case-sensitive group comparison with case-insensitive logic
  • Adds null safety checks for both collections and individual elements
  • Maintains the same logical behavior while fixing the case-sensitivity bug

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

if (c1 == null || c2 == null) {
return true; // If either collection is null, they are considered disjoint.
}
Set<String> upperC1 = c1.stream().filter(Objects::nonNull).map(String::toUpperCase).collect(Collectors.toSet());
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import for Objects class. Add import java.util.Objects; to the imports section to resolve the compilation error.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot statement incorrect. The import is contained in “import java.util.*;”.

@KingAlex1985
Copy link
Contributor Author

@inodb
See my previous comment:
Copilot statement incorrect. The import is contained in “import java.util.*;”.

Can you review this PR please. (A reveiw of PR #11610 was done and changes accepted.)

Thank you in advance.

@KingAlex1985
Copy link
Contributor Author

@inodb and @haynescd

Can you please have a look at this again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Authorization is broken when cancer study groups are not in uppercase

1 participant