-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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-1150] Add secret sync endpoint #3906
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3906 +/- ##
==========================================
+ Coverage 37.86% 38.01% +0.14%
==========================================
Files 1192 1195 +3
Lines 57988 58134 +146
Branches 5549 5567 +18
==========================================
+ Hits 21960 22102 +142
+ Misses 34995 34993 -2
- Partials 1033 1039 +6 ☔ View full report in Codecov by Sentry. |
New Issues
Fixed Issues
|
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.
@Thomas-Avery this looks good, thanks for the hard work on this!
Nice uses of ExecuteDeleteAsync
and using declarations 😄
test/Api.Test/SecretsManager/Controllers/SecretsControllerTests.cs
Outdated
Show resolved
Hide resolved
## Type of change <!-- (mark with an `X`) --> ``` - [ ] Bug fix - [X] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ``` ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Expose the new secrets sync endpoint. Server PR bitwarden/server#3906 ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> ran the command `./support/build-api.sh` ## Before you submit - Please add **unit tests** where it makes sense to do so
## Type of change <!-- (mark with an `X`) --> ``` - [ ] Bug fix - [X] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ``` ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> The purpose of this PR is to expose the ability to preform secrets syncs via the Secrets Manager SDK. Requires API bindings in #674 This should not be merged into main prior to: - The server PR bitwarden/server#3906 being merged and released - The API bindings PR #674 being merged into main ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> - **crates/bitwarden/src/secrets_manager/client_secrets.rs:** Add the `sync` method to the client secrets. - **crates/bitwarden/src/secrets_manager/secrets/mod.rs:** Expose `sync` `SecretsSyncRequest`, and `SecretsSyncResponse` - **crates/bitwarden/src/secrets_manager/secrets/sync.rs:** Implement `sync` `SecretsSyncRequest`, and `SecretsSyncResponse` ## Before you submit - Please add **unit tests** where it makes sense to do so
Type of change
Objective
The purpose of this PR is to add a new secrets sync endpoint for Secrets Manager.
This also includes repository code updates to update a service account's
RevisionDate
when an event occurs that would require a new secrets sync for the given service account.Code changes
bitwarden_license/src/Commercial.Core/SecretsManager/Queries/Secrets/SecretsSyncQuery.cs:
src/Core/SecretsManager/Queries/Secrets/Interfaces/ISecretsSyncQuery.cs:
A new query for determining if a secrets sync is needed and if so returns all secrets the service account has access to.
bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerCollectionExtensions.cs:
Adding the new query into DI.
bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/AccessPolicyRepository.cs:
Update affected service account's revision date on creation and deletion of access policies.
bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs:
Update affected service account's revision date on deletion of a project.
bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs:
src/Core/SecretsManager/Repositories/ISecretRepository.cs:
src/Core/SecretsManager/Repositories/Noop/NoopSecretRepository.cs:
Update affected service account's revision date on secret creation, update, soft delete, restore, and hard delete
Rename
GetManyByOrganizationIdInTrashAsync
,GetManyByProjectIdAsync
, andGetManyByOrganizationIdAsync
to make it clear they returnSecretPermissionDetails
not just secret entities.bitwarden_license/test/Commercial.Core.Test/SecretsManager/Queries/Secrets/SecretsSyncQueryTests.cs:
Unit tests.
src/Api/SecretsManager/Controllers/SecretsController.cs:
Add new endpoint
Secret repository renames
src/Api/SecretsManager/Controllers/SecretsManagerPortingController.cs:
Secret repository renames
src/Api/SecretsManager/Controllers/SecretsTrashController.cs:
Secret repository renames
src/Api/SecretsManager/Models/Response/SecretsSyncResponseModel.cs:
Response model for new secrets sync endpoint.
src/Core/SecretsManager/Models/Data/SecretsSyncRequest.cs:
Data model for all the properties required for a
SecretsSyncQuery
.test/Api.IntegrationTest/SecretsManager/Controllers/SecretsControllerTests.cs:
Integration tests
test/Api.Test/SecretsManager/Controllers/SecretsControllerTests.cs:
Unit tests
Before you submit
dotnet format --verify-no-changes
) (required)