server icon indicating copy to clipboard operation
server copied to clipboard

[SM-923] Project Service Account Access policy server side changes

Open cd-bitwarden opened this issue 1 year ago • 4 comments

Type of change

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

Objective

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

cd-bitwarden avatar Dec 05 '23 21:12 cd-bitwarden

I plan on writing the tests after the initial PR review

cd-bitwarden avatar Dec 05 '23 21:12 cd-bitwarden

Logo Checkmarx One – Scan Summary & Detailsb46c59e5-07a1-42c9-8141-7a7cd850352e

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 745 Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 321 Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 250 Attack Vector
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 203 Attack Vector
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 80 Attack Vector
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 51 Attack Vector
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 147 Attack Vector
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 215 Attack Vector
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 211 Attack Vector
MEDIUM Privacy_Violation /src/Core/Services/Implementations/UserService.cs: 656 Attack Vector
MEDIUM Privacy_Violation /src/Core/Services/Implementations/UserService.cs: 656 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 34 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 31 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 21 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 18 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Users/Edit.cshtml: 66 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Users/Edit.cshtml: 63 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Users/Edit.cshtml: 51 Attack Vector
LOW Client_DOM_Open_Redirect /src/Admin/Views/Users/Edit.cshtml: 48 Attack Vector
LOW Log_Forging /src/Api/Controllers/AccountsController.cs: 104 Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 102 Attack Vector
LOW Log_Forging /src/Api/Controllers/OrganizationSponsorshipsController.cs: 68 Attack Vector
LOW Log_Forging /src/Identity/Controllers/AccountsController.cs: 39 Attack Vector
LOW Log_Forging /src/Api/Controllers/OrganizationSponsorshipsController.cs: 97 Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 116 Attack Vector
LOW Log_Forging /src/Api/Controllers/OrganizationSponsorshipsController.cs: 97 Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 116 Attack Vector
LOW Log_Forging /src/Api/Controllers/OrganizationSponsorshipsController.cs: 97 Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 116 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 288
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 278
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 237
MEDIUM CSRF /src/Api/Auth/Controllers/WebAuthnController.cs: 97
MEDIUM CSRF /src/Api/Auth/Controllers/WebAuthnController.cs: 68
MEDIUM CSRF /src/Api/Auth/Controllers/WebAuthnController.cs: 42
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 369
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 745
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 324
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 255
MEDIUM CSRF /src/Api/Controllers/ConfigController.cs: 28
MEDIUM Healthcheck Not Set /docker-compose.yml: 26
MEDIUM Healthcheck Not Set /docker-compose.override.yml: 4
MEDIUM Healthcheck Not Set /docker-compose.yml: 4
MEDIUM Healthcheck Not Set /docker-compose.yml: 11
MEDIUM Host Namespace is Shared /docker-compose.yml: 4
MEDIUM Host Namespace is Shared /docker-compose.override.yml: 4
MEDIUM Host Namespace is Shared /docker-compose.yml: 11
MEDIUM Host Namespace is Shared /docker-compose.yml: 26
MEDIUM Memory Not Limited /docker-compose.yml: 26
MEDIUM Memory Not Limited /docker-compose.yml: 11
MEDIUM Memory Not Limited /docker-compose.override.yml: 4
MEDIUM Memory Not Limited /docker-compose.yml: 4
MEDIUM Networks Not Set /docker-compose.yml: 11
MEDIUM Networks Not Set /docker-compose.yml: 4
MEDIUM Networks Not Set /docker-compose.override.yml: 4
MEDIUM Networks Not Set /docker-compose.yml: 26
MEDIUM Privacy_Violation /src/Core/Auth/UserFeatures/UserMasterPassword/SetInitialMasterPasswordCommand.cs: 59
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 147
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 215
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 211
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 188
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 187
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 178
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 173
MEDIUM Privacy_Violation /src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs: 157
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 147
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 215
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 211
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 188
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 187
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 178
MEDIUM Privacy_Violation /src/Core/Services/Implementations/RelayPushNotificationService.cs: 173
MEDIUM Privacy_Violation /src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs: 157
MEDIUM Privacy_Violation /src/Core/Services/Implementations/UserService.cs: 549
MEDIUM Privacy_Violation /src/Core/Auth/UserFeatures/UserMasterPassword/SetInitialMasterPasswordCommand.cs: 59
MEDIUM Security Opt Not Set /docker-compose.yml: 11
MEDIUM Security Opt Not Set /docker-compose.override.yml: 4
MEDIUM Security Opt Not Set /docker-compose.yml: 4
MEDIUM Security Opt Not Set /docker-compose.yml: 26
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 538
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 613
MEDIUM Unpinned Actions Full Length Commit SHA /container-registry-purge.yml: 95
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 280
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 47
MEDIUM Unpinned Actions Full Length Commit SHA /release.yml: 92
MEDIUM Unpinned Actions Full Length Commit SHA /release.yml: 44
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 26
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 37
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 34
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 23
LOW Client_DOM_Open_Redirect /src/Admin/Views/Shared/_OrganizationFormScripts.cshtml: 20
LOW Container Capabilities Unrestricted /docker-compose.override.yml: 4
LOW Container Capabilities Unrestricted /docker-compose.yml: 4
LOW Container Capabilities Unrestricted /docker-compose.yml: 26
LOW Container Capabilities Unrestricted /docker-compose.yml: 11
LOW Cpus Not Limited /docker-compose.yml: 4
LOW Cpus Not Limited /docker-compose.yml: 26
LOW Cpus Not Limited /docker-compose.yml: 11
LOW Cpus Not Limited /docker-compose.override.yml: 4
LOW Heap_Inspection /src/Core/Constants.cs: 87
LOW Log_Forging /src/Billing/Controllers/StripeController.cs: 117
LOW Log_Forging /src/Billing/Controllers/StripeController.cs: 114
LOW Log_Forging /src/Billing/Controllers/PayPalController.cs: 64
LOW Log_Forging /src/Api/Auth/Controllers/WebAuthnController.cs: 68
LOW Log_Forging /src/Api/Auth/Controllers/WebAuthnController.cs: 68
LOW Log_Forging /src/Api/Controllers/PushController.cs: 53
LOW Log_Forging /src/Api/Controllers/DevicesController.cs: 88
LOW Log_Forging /src/Api/Controllers/DevicesController.cs: 169
LOW Log_Forging /src/Api/Controllers/PushController.cs: 38
LOW Log_Forging /src/Api/Controllers/PushController.cs: 61
LOW Log_Forging /src/Api/Controllers/DevicesController.cs: 88
LOW Log_Forging /src/Api/Controllers/DevicesController.cs: 169
LOW Log_Forging /src/Api/Controllers/PushController.cs: 38
LOW Log_Forging /src/Api/Controllers/PushController.cs: 61
LOW Log_Forging /src/Api/Controllers/PushController.cs: 53
LOW Use_Of_Hardcoded_Password /src/Core/Constants.cs: 87
LOW Use_Of_Hardcoded_Password /test/Core.Test/Auth/UserFeatures/UserMasterPassword/SetInitialMasterPasswordCommandTests.cs: 62

bitwarden-bot avatar Dec 08 '23 01:12 bitwarden-bot

@Thomas-Avery other than any changes you request to my most recent push, I just need a little help knowing which tests to add/remove/update :)

cd-bitwarden avatar Dec 13 '23 21:12 cd-bitwarden

Codecov Report

Attention: 34 lines in your changes are missing coverage. Please review.

Comparison is base (6fbb790) 32.04% compared to head (8b0eca4) 32.24%. Report is 2 commits behind head on main.

Files Patch % Lines
...retsManager/Repositories/AccessPolicyRepository.cs 70.37% 11 Missing and 5 partials :warning:
...tsManager/Repositories/ServiceAccountRepository.cs 81.25% 4 Missing and 2 partials :warning:
...pi/SecretsManager/Utilities/AccessPolicyHelpers.cs 80.00% 4 Missing and 1 partial :warning:
...ojectServiceAccountsAccessPoliciesResponseModel.cs 81.25% 2 Missing and 1 partial :warning:
...rviceAccountsAccessPoliciesAuthorizationHandler.cs 97.82% 0 Missing and 1 partial :warning:
...ager/Models/Request/AccessPoliciesCreateRequest.cs 50.00% 1 Missing :warning:
...odels/Data/ProjectServiceAccountsAccessPolicies.cs 90.90% 0 Missing and 1 partial :warning:
.../Repositories/Noop/NoopServiceAccountRepository.cs 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3524      +/-   ##
==========================================
+ Coverage   32.04%   32.24%   +0.19%     
==========================================
  Files        1211     1217       +6     
  Lines       63252    63448     +196     
  Branches     4816     4840      +24     
==========================================
+ Hits        20272    20460     +188     
- Misses      41935    41937       +2     
- Partials     1045     1051       +6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 10 '24 19:01 codecov[bot]

Closing this work moved to https://github.com/bitwarden/server/pull/3993

Thomas-Avery avatar Apr 23 '24 14:04 Thomas-Avery