Skip to content
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

[PM-12047] Remove usage of ActiveUserState from cipher.service #12814

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

gbubemismith
Copy link
Member

@gbubemismith gbubemismith commented Jan 10, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-12047

📔 Objective

ActiveUserState is being deprecated. Remove usage from Cipher Service and require userId to be passed.

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor

github-actions bot commented Jan 11, 2025

Logo
Checkmarx One – Scan Summary & Detailsdee430bb-5070-4858-bff8-ddee5cf5c9f8

New Issues (6)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/attachments/open-attachments/open-attachments.component.ts: 40
detailsMethod at line 40 of /apps/browser/src/vault/popup/components/vault-v2/attachments/open-attachments/open-attachments.component.ts sends user infor...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/attachments/open-attachments/open-attachments.component.ts: 38
detailsMethod app_open_attachments at line 38 of /apps/browser/src/vault/popup/components/vault-v2/attachments/open-attachments/open-attachments.component...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/popup/fido2/fido2.component.ts: 217
detailsMethod Lambda at line 217 of /apps/browser/src/autofill/popup/fido2/fido2.component.ts sends user information outside the application. This may con...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/popup/fido2/fido2.component.ts: 238
detailsMethod Lambda at line 238 of /apps/browser/src/autofill/popup/fido2/fido2.component.ts sends user information outside the application. This may con...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/vault-password-history-v2/vault-password-history-v2.component.ts: 50
detailsMethod Lambda at line 50 of /apps/browser/src/vault/popup/components/vault-v2/vault-password-history-v2/vault-password-history-v2.component.ts send...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 418
detailsMethod Lambda at line 418 of /apps/browser/src/autofill/background/overlay.background.ts sends user information outside the application. This may c...
Attack Vector
Fixed Issues (20)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 413
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 148
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 146
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 244
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 58
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 58
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 126
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 126
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 122
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 126
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 332
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 116
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 116
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 132
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 132
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/download.command.ts: 43
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/get.command.ts: 325
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/get.command.ts: 151
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/get.command.ts: 144
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/models/response.ts: 53

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 28.30189% with 342 lines in your changes missing coverage. Please review.

Project coverage is 35.27%. Comparing base (f630ee5) to head (1a30577).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/common/src/vault/services/cipher.service.ts 6.75% 67 Missing and 2 partials ⚠️
.../src/app/vault/individual-vault/vault.component.ts 0.00% 14 Missing ⚠️
...angular/src/vault/components/add-edit.component.ts 0.00% 13 Missing ⚠️
...ular/src/vault/components/attachments.component.ts 0.00% 11 Missing ⚠️
...ibs/angular/src/vault/components/view.component.ts 0.00% 11 Missing ⚠️
apps/cli/src/vault/delete.command.ts 0.00% 10 Missing ⚠️
...assign-collections/assign-collections.component.ts 0.00% 9 Missing ⚠️
apps/cli/src/commands/get.command.ts 0.00% 9 Missing ⚠️
.../src/services/encrypted-message-handler.service.ts 0.00% 9 Missing ⚠️
...-container/trash-list-items-container.component.ts 0.00% 8 Missing ⚠️
... and 47 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12814      +/-   ##
==========================================
+ Coverage   35.25%   35.27%   +0.02%     
==========================================
  Files        2997     2997              
  Lines       90886    91002     +116     
  Branches    16975    16989      +14     
==========================================
+ Hits        32039    32101      +62     
- Misses      56358    56412      +54     
  Partials     2489     2489              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gbubemismith gbubemismith marked this pull request as ready for review January 14, 2025 04:23
@gbubemismith gbubemismith requested review from a team as code owners January 14, 2025 04:23
mzieniukbw
mzieniukbw previously approved these changes Jan 14, 2025
Copy link
Contributor

@mzieniukbw mzieniukbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key Management changes looks good

cipherViews$: Observable<CipherView[]>;
ciphers$: Observable<Record<CipherId, CipherData>>;
localData$: Observable<Record<CipherId, LocalData>>;
cipherViews$: (userId: UserId) => Observable<CipherView[]>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨 all of the functions are declared as fields/properties, but in the CipherService implementation, all of them are methods. Should be declared as methods instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed be3bb91

mzieniukbw
mzieniukbw previously approved these changes Jan 17, 2025
r-tome
r-tome previously approved these changes Jan 20, 2025
mzieniukbw
mzieniukbw previously approved these changes Jan 20, 2025
r-tome
r-tome previously approved these changes Jan 21, 2025
jprusik
jprusik previously approved these changes Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants