server icon indicating copy to clipboard operation
server copied to clipboard

[PM-5518] Sql-backed IDistributedCache

Open kspearrin opened this issue 1 year ago • 2 comments

Type of change

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

Objective

Self-hosted customers and dev environments need a Distributed Cache store. Use SQL, with the ofifical Microsoft library for SQL Server and a custom implementation for EF. EF implementation copies the official SQL Server one pretty closely.

Code changes

See inline self-review comments.

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

kspearrin avatar Feb 12 '24 22:02 kspearrin

Codecov Report

Attention: Patch coverage is 14.02214% with 233 lines in your changes missing coverage. Please review.

Project coverage is 41.16%. Comparing base (e8c5d73) to head (59529e5). Report is 5 commits behind head on main.

Files Patch % Lines
...astructure.EntityFramework/EntityFrameworkCache.cs 3.75% 204 Missing and 1 partial :warning:
...SharedWeb/Utilities/ServiceCollectionExtensions.cs 42.50% 20 Missing and 3 partials :warning:
src/Infrastructure.EntityFramework/Models/Cache.cs 0.00% 5 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3791      +/-   ##
==========================================
+ Coverage   40.90%   41.16%   +0.25%     
==========================================
  Files        1260     1265       +5     
  Lines       60106    60357     +251     
  Branches     5489     5524      +35     
==========================================
+ Hits        24589    24845     +256     
+ Misses      34382    34367      -15     
- Partials     1135     1145      +10     

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

codecov[bot] avatar Feb 12 '24 22:02 codecov[bot]

Logo Checkmarx One – Scan Summary & Details32e39ecc-b288-44ea-83a3-a95502866ec1

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Privacy_Violation /src/Core/Services/Implementations/UserService.cs: 336 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Auth/Controllers/TwoFactorController.cs: 411
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 218
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 579
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 456
LOW Log_Forging /src/Identity/Controllers/AccountsController.cs: 107
LOW Log_Forging /src/Identity/Controllers/AccountsController.cs: 107
LOW Log_Forging /src/Identity/Controllers/AccountsController.cs: 107
LOW Log_Forging /src/Identity/Controllers/AccountsController.cs: 107

bitwarden-bot avatar Feb 12 '24 23:02 bitwarden-bot

@justindbaur @rkac-bw this is ready for review again!

withinfocus avatar Jul 02 '24 14:07 withinfocus

@justindbaur awesome tests! @rkac-bw can you give a final review stamp?

withinfocus avatar Jul 03 '24 15:07 withinfocus