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-12049] Remove usage of ActiveUserState from folder service #11880

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

Conversation

gbubemismith
Copy link
Member

@gbubemismith gbubemismith commented Nov 6, 2024

🎟️ Tracking

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

📔 Objective

ActiveUserState is being deprecated. Remove usage from folderService 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

…tate

Added extra test cases for encrypted folder and decrypted folders

Updated derived state to use decrypt with key
Copy link
Contributor

github-actions bot commented Nov 6, 2024

Logo
Checkmarx One – Scan Summary & Detailsf2570805-91d2-4ac3-bbd6-b551ea5161cb

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 120 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 108 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 108 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 103 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 113 Attack Vector
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 506 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 179 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 200 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /build-browser.yml: 407 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 186 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 81 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 296 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 358 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /build-browser.yml: 366 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 161 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 47 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 522 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 246 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 193 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 514 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-auto-bump.yml: 20 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 498 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 161 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 200 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 296 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 81 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 366 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 47 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 358 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 514 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 246 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 193 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-auto-bump.yml: 20 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 186 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 179 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 522 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 498 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /version-bump.yml: 506 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 407 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/risk-insights/password-health-members.component.html: 55
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/risk-insights/password-health-members.component.html: 50
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/risk-insights/password-health-members.component.html: 45
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/risk-insights/password-health-members.component.html: 50
MEDIUM Client_Privacy_Violation /apps/cli/src/commands/get.command.ts: 121
MEDIUM Unpinned Actions Full Length Commit SHA /version-auto-bump.yml: 40
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 167
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 254
MEDIUM Unpinned Actions Full Length Commit SHA /build-browser.yml: 355
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 194
MEDIUM Unpinned Actions Full Length Commit SHA /build-browser.yml: 396
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 114
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 208
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 201
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 306
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 372
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 187
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 254
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 372
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 167
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 306
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 208
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 187
LOW Unpinned Actions Full Length Commit SHA /version-auto-bump.yml: 40
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 201
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 355
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 396
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 114
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 194

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 78 lines in your changes missing coverage. Please review.

Project coverage is 33.42%. Comparing base (5592d64) to head (faba3d0).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/common/src/platform/sync/core-sync.service.ts 0.00% 8 Missing ⚠️
...common/src/vault/services/folder/folder.service.ts 73.07% 7 Missing ⚠️
apps/cli/src/commands/get.command.ts 0.00% 6 Missing ⚠️
...on/src/vault/services/folder/folder-api.service.ts 0.00% 6 Missing ⚠️
...ogs/bulk-move-dialog/bulk-move-dialog.component.ts 0.00% 5 Missing ⚠️
...ault/vault-filter/services/vault-filter.service.ts 0.00% 5 Missing ⚠️
...wser/src/vault/popup/settings/folders.component.ts 0.00% 4 Missing ⚠️
apps/cli/src/commands/list.command.ts 0.00% 4 Missing ⚠️
apps/cli/src/vault/delete.command.ts 0.00% 4 Missing ⚠️
libs/importer/src/components/import.component.ts 0.00% 4 Missing ⚠️
... and 14 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11880   +/-   ##
=======================================
  Coverage   33.41%   33.42%           
=======================================
  Files        2841     2841           
  Lines       89008    89048   +40     
  Branches    16979    16990   +11     
=======================================
+ Hits        29744    29762   +18     
- Misses      56927    56947   +20     
- Partials     2337     2339    +2     

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

return [];
}

const decryptFolderPromises = folders.map((f) => f.decryptWithKey(userKey, encryptService));
Copy link
Member Author

Choose a reason for hiding this comment

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

ℹ️ @bitwarden/team-platform-dev changed folder decryption to use decryptWithKey instead of the decrypt method.


folders$(userId$: Observable<UserId>): Observable<Folder[]> {
return userId$.pipe(
takeWhile((userId) => userId != null),
Copy link
Member Author

@gbubemismith gbubemismith Nov 8, 2024

Choose a reason for hiding this comment

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

ℹ️ takeWhile operator to stop folder state observations when userId becomes invalid (during logout)

@gbubemismith gbubemismith marked this pull request as ready for review November 8, 2024 17:52
@gbubemismith gbubemismith requested review from a team as code owners November 8, 2024 17:52
this.folderViews$ = this.decryptedFoldersState.state$;
folderViews$(userId$: Observable<UserId>): Observable<FolderView[]> {
return userId$.pipe(
takeWhile((userId) => userId != null),
Copy link
Member Author

@gbubemismith gbubemismith Nov 8, 2024

Choose a reason for hiding this comment

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

ℹ️ takeWhile operator to stop folder state observations when userId becomes invalid (during logout)

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.

3 participants