bitwarden / clients

Bitwarden client apps (web, browser extension, desktop, and cli).
https://bitwarden.com
Other
8.65k stars 1.14k forks source link

[PM-7826] `NotificationsService` Refactor #9843

Open justindbaur opened 3 days ago

justindbaur commented 3 days ago

๐ŸŽŸ๏ธ Tracking

๐Ÿ“” Objective

Refactor NotificationsService so that it is less messaging based and more reactive to the details it cares about. This removes its updateConnection call that if called in the wrong place could cause us to open multiple connections. This is replaced with just a start call (that is more resilient to when it is ran). It also creates a special foreground instance just for browser that throws an immediate error if any of it's methods are called.

This also hopefully carves an extensibility point for dropping in a WebPush implementation a little bit easier.

๐Ÿ“ธ Screenshots

โฐ Reminders before review

๐Ÿฆฎ Reviewer guidelines

codecov[bot] commented 3 days ago

Codecov Report

Attention: Patch coverage is 28.76712% with 104 lines in your changes missing coverage. Please review.

Project coverage is 29.39%. Comparing base (d7bf0fe) to head (50f4196). Report is 8 commits behind head on main.

Files Patch % Lines
...atform/notifications/signalr-connection.builder.ts 0.00% 38 Missing :warning:
...orm/notifications/default-notifications.service.ts 58.57% 29 Missing :warning:
...atform/notifications/noop-notifications.service.ts 0.00% 7 Missing :warning:
apps/browser/src/background/main.background.ts 0.00% 4 Missing :warning:
.../notifications/foreground-notifications.service.ts 0.00% 4 Missing :warning:
libs/common/src/platform/notifications/internal.ts 0.00% 4 Missing :warning:
apps/browser/src/background/runtime.background.ts 0.00% 3 Missing :warning:
apps/desktop/src/app/services/init.service.ts 0.00% 3 Missing :warning:
libs/angular/src/services/jslib-services.module.ts 0.00% 3 Missing :warning:
apps/browser/src/popup/services/services.module.ts 0.00% 2 Missing :warning:
... and 6 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #9843 +/- ## ========================================== + Coverage 29.32% 29.39% +0.06% ========================================== Files 2527 2534 +7 Lines 73760 73770 +10 Branches 13770 13768 -2 ========================================== + Hits 21630 21684 +54 + Misses 50508 50463 -45 - Partials 1622 1623 +1 ```

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

github-actions[bot] commented 3 days ago

Logo Checkmarx One โ€“ Scan Summary & Details โ€“ 2b14214d-9b3f-4d73-88cb-1892264cd551

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Client_DOM_Open_Redirect /apps/browser/src/platform/popup/layout/popup-header.component.ts: 29 Attack Vector