-
Notifications
You must be signed in to change notification settings - Fork 1.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
[SM-1256] Add BulkSecretAuthorizationHandler #4099
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4099 +/- ##
==========================================
+ Coverage 39.31% 39.34% +0.03%
==========================================
Files 1201 1203 +2
Lines 57994 58030 +36
Branches 5336 5338 +2
==========================================
+ Hits 22799 22832 +33
- Misses 34139 34142 +3
Partials 1056 1056 ☔ View full report in Codecov by Sentry. |
No New Or Fixed Issues Found |
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.
One small comment
_ => secrets.Select(s => new SecretAccess(s.Id, false, false)) | ||
}; | ||
|
||
private record SecretAccess(Guid Id, bool Read, bool Write); |
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.
Nit: Any reason this is at the bottom of the file instead of the top? There are a few other records we have in the middle of files, I'm used to type defs and fields at the top of a file or class. No big deal though.
Type of change
Objective
The purpose of this PR is to add a
BulkSecretAuthorizationHandler
and use it for theGetSecretsByIdsAsync
endpoint.Code changes
file.ext: Description of what was changed and why
bitwarden_license/src/Commercial.Core/SecretsManager/AuthorizationHandlers/Secrets/BulkSecretAuthorizationHandler.cs:
src/Core/SecretsManager/AuthorizationRequirements/BulkSecretOperationRequirement.cs:
Add new bulk authz handler.
bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerCollectionExtensions.cs:
Add handler to DI.
bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs:
src/Core/SecretsManager/Repositories/ISecretRepository.cs:
src/Core/SecretsManager/Repositories/Noop/NoopSecretRepository.cs:
Add
AccessToSecretsAsync
to the repository.bitwarden_license/test/Commercial.Core.Test/SecretsManager/AuthorizationHandlers/Secrets/BulkSecretAuthorizationHandlerTests.cs:
Add authz handler unit tests.
src/Api/SecretsManager/Controllers/SecretsController.cs:
Use the new bulk authz handler for the
GetSecretsByIdsAsync
endpoint.test/Api.Test/SecretsManager/Controllers/SecretsControllerTests.cs:
Update unit tests
Before you submit
dotnet format --verify-no-changes
) (required)