Skip to content
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

[AC-2604] Fix aggregation of CollectionGroup permissions #4097

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented May 17, 2024

Type of change

- [x] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Fix the following bug: when a user is in multiple groups, and those groups have varying levels of access to the same collection (including at least 1 group with Can Manage access), the user does not always receive Can Manage access to that collection.

This is a bug that @shane-melton picked up earlier when implementing #3793. For the CollectionGroup permissions HidePasswords and ReadOnly, we resolve multiple groups by taking the MIN value - representing the most generous permissions for the user (i.e. 0, indicating that they can view passwords and edit). However, we also applied this to Manage, which gives them the least generous permissions (0, indicating that they cannot manage).

Change MIN([Manage]) to MAX([Manage]) so that if the user has Manage permissions from 1 group, that will override the others.

Code changes

  • file.ext: Description of what was changed and why

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • If making database changes - make sure you also update Entity Framework queries and/or migrations
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@eliykat eliykat requested a review from shane-melton May 17, 2024 03:58
@eliykat eliykat requested a review from a team as a code owner May 17, 2024 03:58
@eliykat eliykat added the hold Hold this PR or item until later; DO NOT MERGE label May 17, 2024
@eliykat
Copy link
Member Author

eliykat commented May 17, 2024

As this is a db change, let's merge after rc is cut on Monday. (But please review in the meantime!)

EDIT: rc cut has apparently been moved so that's OK

Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 39.07%. Comparing base (98b7866) to head (ab33fb9).

Files Patch % Lines
...tityFramework/Repositories/CollectionRepository.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4097   +/-   ##
=======================================
  Coverage   39.07%   39.07%           
=======================================
  Files        1201     1201           
  Lines       58021    58021           
  Branches     5339     5339           
=======================================
  Hits        22670    22670           
- Misses      34294    34295    +1     
+ Partials     1057     1056    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented May 17, 2024

Logo
Checkmarx One – Scan Summary & Details24f9f193-ea7a-477e-87c2-389ad69193bf

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Privacy_Violation /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 396 Attack Vector
MEDIUM Privacy_Violation /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 343 Attack Vector
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 371 Attack Vector
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 308 Attack Vector

@eliykat eliykat removed the hold Hold this PR or item until later; DO NOT MERGE label May 19, 2024
Copy link
Member

@shane-melton shane-melton left a comment

Choose a reason for hiding this comment

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

Thanks for fixing these!

Copy link
Contributor

@rkac-bw rkac-bw left a comment

Choose a reason for hiding this comment

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

lgtm

@eliykat eliykat merged commit 53ed608 into main May 21, 2024
52 checks passed
@eliykat eliykat deleted the ac/ac-2604/defect-collection-permissions-inherited-from-groups-are-inconsistent branch May 21, 2024 04:40
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.

None yet

3 participants