1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00
Commit Graph

19756 Commits

Author SHA1 Message Date
Bernd Schoolmann
9dfc0fe14f Fix broken build on latest SDK (#17208)
* Fix broken build on latest SDK

* Fix test
2025-11-04 15:46:19 +01:00
neuronull
9803cc98b4 Desktop Native remove log deps (#17135) 2025-11-04 07:35:34 -07:00
Mick Letofsky
ff611338f9 [PM-4735] - Refactor event handling of the browser close listener (#16798) 2025-11-04 15:20:54 +01:00
Mick Letofsky
86b213aa8e [PM-25820] - Migrate cipher data model to adhere to ts-strict (#17073)
* Migrate cipher data model to adhere to ts-strict & added unit tests where applicable
2025-11-04 10:08:18 +01:00
Matt Andreko
0b65442d5e 🔧 update cargo-deny version in ci (#17174) 2025-11-03 17:54:26 -05:00
rr-bw
5c33b2dc89 (Billing) [PM-27562] Create PremiumInterestStateService (#17139)
Creates a `PremiumInterestStateService` that manages state which conveys whether or not a user intends to setup a premium subscription. Implemented in Web only. No-op for other clients.

This will apply for users who began the registration process on https://bitwarden.com/go/start-premium/, which is a marketing page designed to streamline users who intend to setup a premium subscription after registration.
2025-11-03 14:42:21 -08:00
Alex
906ac95175 [PM-26908] feature flag for empty state component (#17179) 2025-11-03 17:03:11 -05:00
Vicki League
cba47e4abd Update font to inter feature branch (#16782) 2025-11-03 15:17:07 -05:00
Daniel Riera
6265fc2d46 PM-25448 return null appropriately for subframe rects in order to reposition inline menu (#17129) 2025-11-03 13:39:25 -05:00
Bernd Schoolmann
2fb9277b65 Add comments (#17177) 2025-11-03 19:13:30 +01:00
rr-bw
2fe6cb4185 docs(authentication): (Auth) [PM-26033] Overview of Authentication at Bitwarden (#16276)
Creates a README that describes an Overview of Authentication methods at Bitwarden
2025-11-03 09:14:19 -08:00
Kyle Denney
e1e3966cc2 [PM-23713] premium badge interaction (#16911)
* feature flag

* new upgrade dialog component and moved pricing service into libs

first draft

* moved pricing service to libs/common

removed toast service from the pricing service and implemented error handling in calling components

# Conflicts:
#	apps/web/src/app/billing/individual/upgrade/upgrade-payment/upgrade-payment.component.ts

* moved new premium upgrade dialog component to libs/angular

* badge opens new dialog in browser extension

* adds new dialog to desktop and fixes tests

* updates send dropdown to use premium prompt service

* styling and copy updates

* implement in web and desktop

* unit tests

* converting premium reports to use premium badge, and some cleanup

* fixes issue after merge

* linter errors

* pr feedback

* handle async promise correctly

* full sync after the premium upgrade is complete

* fixing test

* add padding to bottom of card in new dialog

* add support for self hosting

* fixing tests

* fix test

* Update has-premium.guard.ts

* pr feedback

* fix build and pr feedback

* fix build

* prettier

* fixing stories and making badge line height consistent

* pr feedback

* updated upgrade dialog to no longer use pricing card

* fixing incorrect markup and removing unused bits

* formatting

* pr feedback

removing unused message keys and adding back in code that was erroneously removed

* change detection

* close dialog when error

* claude pr feedback
2025-11-03 10:16:01 -06:00
Robyn MacCallum
3c16547f11 Update policy wording (#17118) 2025-11-03 11:11:49 -05:00
Dave
17e14009e2 fix(recover-two-factor-component) [PM-21153]: Update error handling for SSO-required 2FA recovery scenarios. (#17016) 2025-11-03 11:04:44 -05:00
Alex
c6d759650b [PM-27619] assign tasks component (#17125)
* feat(dirt): add newApplications$ observable to orchestrator

Add reactive observable that filters applicationData for unreviewed apps
(reviewedDate === null). Observable automatically updates when report
state changes through the pipeline.

- Add newApplications$ observable with distinctUntilChanged
- Filters rawReportData$.data.applicationData
- Uses shareReplay for multi-subscriber efficiency

Related to PM-27284

* feat(dirt): add saveApplicationReviewStatus$ to orchestrator

Implement method to save application review status and critical flags.
Updates all applications where reviewedDate === null to set current date,
and marks selected applications as critical.

- Add saveApplicationReviewStatus$() method
- Add _updateReviewStatusAndCriticalFlags() helper
- Uses existing encryption and API update patterns
- Single API call for both review status and critical flags
- Follows same pattern as saveCriticalApplications$()

Related to PM-27284

* feat(dirt): expose newApplications$ in data service

Expose orchestrator's newApplications$ observable and save method
through RiskInsightsDataService facade. Maintains clean separation
between orchestrator (business logic) and components (UI).

- Expose newApplications$ observable
- Expose saveApplicationReviewStatus() delegation method
- Maintains facade pattern consistency

Related to PM-27284

* feat(dirt): make AllActivitiesService reactive to new applications

Update AllActivitiesService to subscribe to orchestrator's newApplications$
observable instead of receiving data through summary updates.

- Subscribe to dataService.newApplications$ in constructor
- Add setNewApplications() helper method
- Remove newApplications update from setAllAppsReportSummary()
- New applications now update reactively when review status changes

Related to PM-27284

* feat(dirt): connect dialog to review status save method

Update NewApplicationsDialogComponent to call the data service's
saveApplicationReviewStatus method when marking applications as critical.

- Inject RiskInsightsDataService
- Replace placeholder onMarkAsCritical() with real implementation
- Handle success/error cases with appropriate toast notifications
- Close dialog on successful save
- Show different messages based on whether apps were marked critical

Related to PM-27284

* feat(dirt): add i18n strings for application review

Add internationalization strings for the new applications review dialog
success and error messages.

- applicationReviewSaved: Success toast title
- applicationsMarkedAsCritical: Success message when apps marked critical
- newApplicationsReviewed: Success message when apps reviewed only
- errorSavingReviewStatus: Error toast title
- pleaseTryAgain: Error toast message

Related to PM-27284

* fix(dirt): add subscription cleanup to AllActivitiesService

Critical fix for production code quality and memory leak prevention.
Adds takeUntil pattern to all subscriptions to comply with ADR-0003
(Observable Data Services) requirements.

**Subscription Cleanup (ADR-0003 Compliance):**
- Add takeUntil pattern to AllActivitiesService subscriptions
- Add _destroy$ Subject and destroy() method
- Prevents memory leaks by properly unsubscribing from observables
- Follows Observable Data Services ADR requirements

Changes:
- Import Subject and takeUntil from rxjs
- Add private _destroy$ Subject for cleanup coordination
- Apply takeUntil(this._destroy$) to all 3 subscriptions:
  - enrichedReportData$ subscription
  - criticalReportResults$ subscription
  - newApplications$ subscription
- Add destroy() method for proper resource cleanup

This ensures proper resource cleanup and follows Bitwarden's
architectural decision records for observable management.

Related to PM-27284

* fix(dirt): replace manual takeUntil with takeUntilDestroyed in AllActivitiesService

Fixes critical memory leak by replacing manual subscription cleanup
with Angular's automatic DestroyRef-based cleanup pattern.

**Changes:**
- Replace `takeUntil(this._destroy$)` with `takeUntilDestroyed()` for all 3 subscriptions
- Remove unused `_destroy$` Subject and manual `destroy()` method
- Update imports to use `@angular/core/rxjs-interop`

**Why:**
- Manual `destroy()` method was never called anywhere in codebase
- Subscriptions accumulated without cleanup, causing memory leaks
- `takeUntilDestroyed()` uses Angular's DestroyRef for automatic cleanup
- Aligns with ADR-0003 and .claude/CLAUDE.md requirements

**Impact:**
- Automatic subscription cleanup when service context is destroyed
- Prevents memory leaks during hot module reloads and route changes
- Reduces code complexity (no manual lifecycle management needed)

Related to PM-27284

* refactor(dirt): remove newApplications from OrganizationReportSummary

Removes redundant newApplications field from summary type and uses
derived newApplications$ observable from orchestrator instead.

**Changes:**
- Remove newApplications from OrganizationReportSummary type definition
- Remove dummy data array from RiskInsightsReportService.getApplicationsSummary()
- Remove newApplications subscription from AllActivitiesService
- Update AllActivityComponent to subscribe directly to dataService.newApplications$

**Why:**
- Eliminates data redundancy (stored vs derived)
- newApplications$ already computes from applicationData.reviewedDate === null
- Single source of truth: applicationData is the source
- Simplifies encrypted payload (less data in summary)
- Better separation: stored data (counts) vs computed data (lists)

**Impact:**
- No functional changes - UI continues to display new applications correctly
- Cleaner architecture with computed observable pattern

* cleanup

* fix(dirt): improve dialog type safety and error logging

Addresses critical PR review issues in NewApplicationsDialogComponent:

**Type Safety:**
- Replace unsafe type casting `(this as any).dialogRef` with proper DialogRef injection
- Inject DialogRef<boolean | undefined> using Angular's inject() function
- Ensures type safety and prevents runtime errors from missing dialogRef

**Error Handling:**
- Add LogService to dialog component
- Log errors with "[NewApplicationsDialog]" for debugging
- Maintain user-facing error toast while adding server-side logging

**Impact:**
- Eliminates TypeScript safety bypasses
- Improves production debugging capabilities
- Follows Angular dependency injection best practices

* fixing mock data and test cases for new apps

* feat(dirt): create assign tasks view component

Create standalone view component for task assignment UI that can be
embedded within dialogs or other containers.

- Add AssignTasksViewComponent with signal-based inputs/outputs
- Use input.required<number>() for selectedApplicationsCount
- Use output<void>() for tasksAssigned and back events
- Implement task calculation using SecurityTasksApiService
- Add onAssignTasks() method with loading state and error handling
- Include task summary card UI matching password-change-metric style
- Add proper subscription cleanup with takeUntilDestroyed (ADR-0003)
- Buttons included in component template (not dialog footer)
- Component retrieves organizationId from route params

Related to PM-27619

* refactor(dirt): add multi-view state management to new applications dialog

Add view state const object and properties to support toggling between
application selection and embedded assign tasks component.

- Add DialogView const object with SelectApplications and AssignTasks states (ADR-0025)
- Add DialogView type for type safety
- Add currentView property to track active view
- Import AssignTasksViewComponent for embedded use
- Add isCalculatingTasks loading state
- Inject AllActivitiesService and SecurityTasksApiService for task checking
- Implement OnInit with organizationId retrieval from route params
- Add proper subscription cleanup with takeUntilDestroyed (ADR-0003)
- Expose DialogView constants to template

Related to PM-27619

* feat(dirt): integrate assign tasks view into dialog

Implement logic to embed AssignTasksViewComponent within dialog and
handle communication via event bindings.

- Update onMarkAsCritical to check for tasks before closing dialog
- Add checkForTasksToAssign() method using SecurityTasksApiService
- Conditionally transition to AssignTasks view when tasks are available
- Add onTasksAssigned() handler to close dialog after successful assignment
- Add onBack() handler to navigate back to SelectApplications view
- Add loading state guard to prevent double-click on Mark as Critical button
- Only show success toast and close dialog if no tasks to assign

Related to PM-27619

* feat(dirt): add embedded assign tasks view to dialog template

Update dialog template to conditionally render embedded
AssignTasksViewComponent using @if directive.

- Add conditional rendering for SelectApplications and AssignTasks views
- Update dialog title dynamically based on currentView
- Embed dirt-assign-tasks-view component in AssignTasks view
- Pass selectedApplicationsCount via input binding
- Listen to tasksAssigned and back output events
- Show footer buttons only for SelectApplications view
- Add loading and disabled states to Mark as Critical button
- Change Cancel button to not auto-close (user must navigate)

Related to PM-27619

* feat(dirt): add i18n keys for assign tasks view

Add localized strings for embedded assign tasks view component.

* resolve organizationId and DI issues in assign tasks flow

- Pass organizationId via dialog data to prevent async race conditions
- Pass organizationId as input to AssignTasksViewComponent (embedded components can't access route params)
- Add DefaultAdminTaskService to component providers to fix NullInjectorError
- Remove unnecessary route subscription from embedded component
- Follow password-change-metric.component.ts pattern for consistency
- Add detailed comments explaining architectural decisions and bug fixes

* cleanup styling

* refactor(dirt): remove newApplications validation from OrganizationReportSummary type guard

Removes redundant newApplications field validation from the
OrganizationReportSummary type guard and related test cases.

**Changes:**
- Remove "newApplications" from allowed keys in isOrganizationReportSummary()
- Remove newApplications array validation logic
- Remove newApplications validation from validateOrganizationReportSummary()
- Remove 2 test cases for newApplications validation
- Remove newApplications field from 8 test data objects

**Rationale:**
The newApplications field was removed from OrganizationReportSummary type
definition because it's derived data that can be calculated from
applicationData (filtering where reviewedDate === null). The data is now
accessed via the reactive newApplications$ observable instead of being
stored redundantly in the summary object.

**Impact:**
- No functional changes - UI continues to display new applications via observable
- Type guard now correctly validates the actual OrganizationReportSummary structure
- Eliminates data redundancy and maintains single source of truth
- All 43 tests passing

* improve assign tasks view display

- Remove illustration/preview section (mailbox icon and prompt text)
- Show unique member count instead of calculated task count
- Use reportSummary.totalCriticalAtRiskMemberCount from AllActivitiesService
- Remove unused SecurityTasksApiService dependency
- Follow same pattern as all-activity.component.ts for consistency

* logic to fetch totals and new styling

* Fix review applications review view and assign view flow

* Fix null type checks

* refactor assign tasks dialog: use callout component, add video, fix OnPush, improve error handling

* Add columns, description, search, and bulk select to new applications dialog

* Add count placeholder for critical applications marked message

* Address claude comments

---------

Co-authored-by: Tom <ttalty@bitwarden.com>
Co-authored-by: Leslie Tilton <23057410+Banrion@users.noreply.github.com>
Co-authored-by: maxkpower <mpower@bitwarden.com>
2025-11-03 15:25:19 +00:00
Brandon Treston
5912292680 [PM-26374] Remove emergency access when auto confirm is enabled (#17020)
* add router guard

* use real values, jsdoc

* fix route guard logic, hide UI nav item

* fix race condition

* refactor guard from org feature to policy

* update copy
2025-11-03 09:58:17 -05:00
Brandon Treston
8e1a6a3c80 mange policies custom permission edge case, copy update (#17083) 2025-11-03 09:53:28 -05:00
Brandon Treston
63c14af4f8 remove single org exemption for admins/owners when auto confirm is enabled (#17050) 2025-11-03 09:52:48 -05:00
Will Martin
7ac6a67835 [PM-26944] phishing data checksum diffing + daily patches (#16983)
* expose local db file to extension

* fetch from local db as fallback; only fetch new data on changed checksum; fetch from cdn

* check for undefined chrome runtime (for easy Storybook mocking)

* update capital letters lint

* add audit api tests

* add bash script to fetch local db info and split it to meet FF size limits

* add readme

* Rename README.md to readme.md

* remove leftover file

* remove unused methods from audit service

* remove local db logic

* wip

* revert local db build changes

* add tests; sub to updates directly; refactor teardown logic

* fix eslint crashing

* remove temp premium override

* remove unused test

* update timer value

* run prettier

* refetch all domains on app version change

* fix log statement

* harden fetching

* filter empty domains

* fix type issue

* fix typo

* fix type error

* fix cleanup
2025-11-03 08:49:33 -06:00
neuronull
2b1dbb935f Desktop native disallow log crate macros (#17163) 2025-11-03 07:36:40 -07:00
Addison Beck
c1dec4032e ci: add SDK breaking change detection workflow (#17075)
* ci: add SDK breaking change detection workflow

Introduces GitHub Actions workflow that detects TypeScript breaking changes when SDK artifacts are updated. Workflow is triggered via repository_dispatch from SDK repository and runs npm test:types with newly built SDK artifacts.

The workflow downloads SDK build artifacts, installs them locally, and executes the existing TypeScript type checking process. Exit codes determine success/failure for SDK repository monitoring via gh run watch.

Addresses issue where breaking changes in SDK are discovered only when clients attempt SDK version updates, rather than during SDK development.

* review: add input validation for client payload fields

Add validation step early in the workflow to check for required
client_payload fields and prevent failures from malformed payloads.
This improvement was requested during code review to provide better
error handling and debugging information when the SDK workflow sends
incomplete data.

Validates SOURCE_REPO, SDK_VERSION, ARTIFACTS_RUN_ID, and ARTIFACT_NAME
before proceeding with artifact download and type checking.

* review: update action versions to match repository standards

Update GitHub Actions to consistent versions used across the clients
repository for better security and compatibility. This change was
requested during code review to align with existing patterns.

- actions/checkout: v4.2.2 → v5.0.0 with specific SHA hash
- actions/setup-node: v4.2.0 → v5.0.0 with specific SHA hash
- actions/create-github-app-token: v2.1.1 → v2.0.3 with specific SHA hash

Uses specific SHA hashes for all actions following repository security standards.

* review: add timeout to type checking command for faster failure detection

Wrap npm run test:types with 10-minute timeout to provide faster feedback
when type checking hangs and more predictable workflow behavior. This
improvement was requested during code review to prevent workflows from
running until the 15-minute job timeout.

Provides clearer indication when type checking itself fails versus other
workflow issues, improving debugging experience for developers.

* review: use CLIENT_LABEL environment variable in logging and output

Add CLIENT_LABEL to log messages and GitHub Step Summary output for
better traceability and debugging. This change
 was requested during
code review to make use of the defined CLIENT_LABEL environment
variable that was previously unused.

Improves workflow output clarity by showing which client type
(typescript, mobile, etc.) is being processed.

* review: add retry logic for npm ci command to handle network issues

Implement shell-based retry logic (3 attempts with 5-second delays) for
npm ci command to handle temporary network issues without adding external
dependencies. This improvement was requested during code review to make
the workflow more resilient to transient failures.

Continues with existing npm install approach while adding robustness
for dependency installation in GitHub Actions environment.

* review: improve shell script variable quoting for better practices

Update shell script to use proper variable quoting syntax throughout
(${VARIABLE} instead of $VARIABLE) for better shell scripting practices
and consistency. This change was requested during code review to follow
shell scripting best practices.

While this won't cause problems in practice, it prevents potential
word splitting issues and improves code maintainability.

* review: add back logging out of Azure

* review: adjust logic of retries for npm ci

* review: quote some strings

* review: add error catching around npm i

* review: remove unnecessary cleanup step

* review: use npm link and bitwarden/gh-actions/download-artifacts

* review: add underscores to job level env vars

* 🎨 fix artipacked zizmor issue and improved actionlint formatting

---------

Co-authored-by: Matt Andreko <mandreko@bitwarden.com>
2025-11-03 09:30:11 -05:00
Github Actions
b4420d770e Bumped client version(s) 2025-11-03 14:27:34 +00:00
Todd Martin
cd56d01894 chore(deps): Platform: Update electron to v37
* [deps] Platform: Update electron to v37

* Updated electron-builder.json

* Updated electron-builder latest 37 minor.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-02 14:23:18 -05:00
Jordan Aasen
b102ee4bdf [PM-26653] - fix uri match strategy logic (#17142)
* fix uri match strategy logic

* fix variable name

* update logic and specs

* add test case
2025-11-02 08:14:30 -08:00
Bernd Schoolmann
e68a471655 [PM-26340] Enable linux biometrics v2 (#16661) 2025-10-31 22:47:17 +01:00
Ben Brooks
b5a7379ea9 feat(policies): PM-25570 Admin Console UI for URI Match Default Policy (#16752)
Admin Console UI for URI Match Default Policy

---------

Signed-off-by: Ben Brooks <bbrooks@bitwarden.com>
Co-authored-by: Jonathan Prusik <jprusik@users.noreply.github.com>
2025-10-31 13:50:45 -07:00
Alex
4d1c00a5bc [PM-26941] all caught up state for review card (#17164)
* add "All caught up!" state for application review card

- Display success state when all applications have been reviewed and no new applications need review
- Add iconColorClass input to activity-card component to support conditional icon colors (green checkmark for success state)
- Add i18n keys: allCaughtUp and noNewApplicationsToReviewAtThisTime
- Check if all apps have review dates via enrichedReportData$ to determine when to show the caught up state

* fix "Potential Race Condition with State Initialization" from claude issue and replace getter
2025-10-31 13:37:21 -07:00
Brandon Treston
2da0b48c3d [PM-27688] fix events page not loading (#17166)
* remove unneeded rxjs filter

* add check for canManage

* add null check

* fix provider ID, clean up
2025-10-31 20:35:59 +00:00
Brandon Treston
98622a3f73 remove unneeded rxjs filter (#17165) 2025-10-31 19:46:04 +00:00
Leslie Tilton
23cb3e092c [PM-27694] Handle empty report response (#17162)
* Consolidate loading state and handle null report from api response

* Fix jumping of page when ciphers are still loading

* Fix type errors

* Fix loading state
2025-10-31 13:59:11 -05:00
Jason Ng
4908d73804 [PM-27500] update cipher.service to align with sdk types (#17147) 2025-10-31 14:24:31 -04:00
bw-ghapp[bot]
b7759abb20 Autosync the updated translations (#17145)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
2025-10-31 17:49:04 +00:00
Shane Melton
dbe70bd51c [PM-24467] Introduce cipher risk service (#17009)
* [PM-24467] Introduce CipherRiskService

* [PM-24467] Introduce computeCipherRiskForUser() method

* [PM-24467] Refactor buildPasswordReuseMap to use user SDK client

* [PM-24467] Use switchMap instead of map

* [PM-24467] Cleanup redundant tests

* [PM-24467] Update SDK models

* [PM-24467] Update @bitwarden/sdk-internal version

* [PM-24467] Update @bitwarden/commercial-sdk-internal version
2025-10-31 10:23:18 -07:00
bw-ghapp[bot]
1476dce396 Autosync the updated translations (#17146)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
2025-10-31 17:57:55 +01:00
Oscar Hinton
8c185c9d2b [PM-27645] Check signature of helper exe (#17155) 2025-10-31 16:50:13 +01:00
Oscar Hinton
443b85a356 [PM-27641] Enable signature validation (#17150)
Enables the currently disabled signature validation. This is a blocker for release.
2025-10-31 16:13:41 +01:00
Leslie Tilton
6024e1d05f [PM-26968] Save risk insights summary and metrics (#17132)
* Update type guards

* Add metric data types. Update places saving a risk insights report summary to save metrics

* Fix types and test error

* Fix critical report members

* Update test case for null username in type-guard

* Fix report application mapped data check
2025-10-31 08:46:37 -05:00
Jason Ng
98849a5a65 [PM-27214] Update SDK to version 365 (#17130)
* update sdk version
2025-10-31 08:52:26 -04:00
Oscar Hinton
4c1eba2086 [PM-27583] Add icon to chromium import helper (#17126)
Adds an icon to the windows binary.

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2025-10-31 10:10:22 +01:00
bw-ghapp[bot]
9d2b2d1894 Autosync the updated translations (#17144)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
2025-10-31 09:57:01 +01:00
Andreas Coroiu
8aebfbeace [PM-25932] Shorten socket paths (#17093)
* feat: shorten socket paths

* fix: No such file or directory error

* feat: remove tmp folder from path

* fix: No such file or directory autofill error
2025-10-31 08:15:04 +01:00
Andreas Coroiu
1264abfb19 [PM-25569] Expose commercial sdk service to web clients (#16899)
* feat: enable commercial SDK usage on web

* feat: enable commercial SDK usage in cli

* feat: enable commercial SDK usage in browser

* feat: add lint to restrict commercial sdk imports
2025-10-31 08:13:36 +01:00
Andreas Coroiu
48fb8b2bfe [PM-25250] Prevent configuration and access of self hosted urls over http (#17095)
* feat: ban urls not using https

* feat: add exception for dev env

* feat: block fetching of insecure URLs

* feat: add exception for dev env

* feat: block notifications from using insecure URL

* fix: bug where submission was possible regardless of error

* feat: add exception for dev env

* fix: missing constructor param
2025-10-31 08:12:44 +01:00
Daniel James Smith
2dd314e992 [PM-27083] Prevent collection nesting on import into a MyItems-collection (#16937)
* Prevent collection nesting on import into a my items collection

My Items collections do not support nested collections. The import source hierarchy needs to be flattened into the My Items collection

* Introduce new types for folder and collection relationship
Makes it easier to identify which position is for the cipherIndex and which is for the folder-/collection-index

* Fix assignment of ciphers to My items collection

* Remove unneeded type cast or assertions

* Add clarifying comment

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2025-10-30 21:10:01 +00:00
Nick Krantz
326cd40628 cipher.id now defaults to an empty string rather than null/undefined - use bang to transform into a boolean (#17137) 2025-10-30 15:44:49 -05:00
Jordan Aasen
4a71503875 [PM-27642] - fix mp reprompt issue (#17131)
* fix mp reprompt issue

* fix logic. add more specs

* update vault popup autofill spec

* update jsdoc
2025-10-30 13:19:12 -07:00
Shane Melton
0d543c7059 [PM-27055] Use undefined instead of null for folder/organization filtering (#17120) 2025-10-30 13:18:32 -07:00
Alex
fdfcee4bc5 [26908] improve empty state design (#16832)
* max init

* add mp4 and organize code better

* fix lint errors

* move empty state logic into risk insights component

* replace getter logic

* sub for org name

* checkForVaultItems fix
- need to use cipherservice instead of report results from data service

* fix all critical issues mentioned by claude bot

* resolve empty state logic bug and memory leaks

- Handle zero-results case in empty state logic
- Add takeUntil cleanup to _setupUserId subscription
- Guard console.warn with isDevMode() check

* use tuple arrays for benefits to prevent XSS risk

Replace pipe-separated strings with typed tuple arrays [string, string][]
for benefits data in empty state component. This eliminates potential XSS
risk from string splitting, provides compile-time type safety, and improves
performance by removing runtime string parsing on every change detection.

* fix(dirt): hide empty states during report generation and fix memory leak

Add isGeneratingReport$ to combineLatest, update empty state conditions
to check !isGenerating, simplify run report logic, and fix memory leak
in route.queryParams subscription.

Addresses Claude bot feedback on PR #16832

* refactor(dirt): use signals and OnPush in empty state card component

Convert @Input() to readonly input signals and add OnPush change
detection strategy. Update template to call signals as functions.
Fixes ESLint compliance issues.

* refactor(dirt): remove unused shouldShowRunReportState variable

The shouldShowRunReportState variable was calculated but never used.
The template already uses @else for the run report state, making this
variable redundant.

* refactor(dirt): consolidate duplicate if statements in empty state logic

Merge 5 separate if/else blocks checking shouldShowImportDataState into
single consolidated block. Move constant benefits assignment outside
conditional. Improves readability and reduces duplication.

* remove unnecessary getOrganizationName wrapper method

* remove duplicate runReport method

Remove runReport arrow function and use generateReport consistently.
Both methods called dataService.triggerReport(), but generateReport
includes an organizationId check for defensive programming.
2025-10-30 12:16:41 -07:00
Alex
2b009778e8 [PM-27284] new applications card real data (#17088)
* feat(dirt): add newApplications$ observable to orchestrator

Add reactive observable that filters applicationData for unreviewed apps
(reviewedDate === null). Observable automatically updates when report
state changes through the pipeline.

- Add newApplications$ observable with distinctUntilChanged
- Filters rawReportData$.data.applicationData
- Uses shareReplay for multi-subscriber efficiency

Related to PM-27284

* feat(dirt): add saveApplicationReviewStatus$ to orchestrator

Implement method to save application review status and critical flags.
Updates all applications where reviewedDate === null to set current date,
and marks selected applications as critical.

- Add saveApplicationReviewStatus$() method
- Add _updateReviewStatusAndCriticalFlags() helper
- Uses existing encryption and API update patterns
- Single API call for both review status and critical flags
- Follows same pattern as saveCriticalApplications$()

Related to PM-27284

* feat(dirt): expose newApplications$ in data service

Expose orchestrator's newApplications$ observable and save method
through RiskInsightsDataService facade. Maintains clean separation
between orchestrator (business logic) and components (UI).

- Expose newApplications$ observable
- Expose saveApplicationReviewStatus() delegation method
- Maintains facade pattern consistency

Related to PM-27284

* feat(dirt): make AllActivitiesService reactive to new applications

Update AllActivitiesService to subscribe to orchestrator's newApplications$
observable instead of receiving data through summary updates.

- Subscribe to dataService.newApplications$ in constructor
- Add setNewApplications() helper method
- Remove newApplications update from setAllAppsReportSummary()
- New applications now update reactively when review status changes

Related to PM-27284

* feat(dirt): connect dialog to review status save method

Update NewApplicationsDialogComponent to call the data service's
saveApplicationReviewStatus method when marking applications as critical.

- Inject RiskInsightsDataService
- Replace placeholder onMarkAsCritical() with real implementation
- Handle success/error cases with appropriate toast notifications
- Close dialog on successful save
- Show different messages based on whether apps were marked critical

Related to PM-27284

* feat(dirt): add i18n strings for application review

Add internationalization strings for the new applications review dialog
success and error messages.

- applicationReviewSaved: Success toast title
- applicationsMarkedAsCritical: Success message when apps marked critical
- newApplicationsReviewed: Success message when apps reviewed only
- errorSavingReviewStatus: Error toast title
- pleaseTryAgain: Error toast message

Related to PM-27284

* fix(dirt): add subscription cleanup to AllActivitiesService

Critical fix for production code quality and memory leak prevention.
Adds takeUntil pattern to all subscriptions to comply with ADR-0003
(Observable Data Services) requirements.

**Subscription Cleanup (ADR-0003 Compliance):**
- Add takeUntil pattern to AllActivitiesService subscriptions
- Add _destroy$ Subject and destroy() method
- Prevents memory leaks by properly unsubscribing from observables
- Follows Observable Data Services ADR requirements

Changes:
- Import Subject and takeUntil from rxjs
- Add private _destroy$ Subject for cleanup coordination
- Apply takeUntil(this._destroy$) to all 3 subscriptions:
  - enrichedReportData$ subscription
  - criticalReportResults$ subscription
  - newApplications$ subscription
- Add destroy() method for proper resource cleanup

This ensures proper resource cleanup and follows Bitwarden's
architectural decision records for observable management.

Related to PM-27284

* fix(dirt): replace manual takeUntil with takeUntilDestroyed in AllActivitiesService

Fixes critical memory leak by replacing manual subscription cleanup
with Angular's automatic DestroyRef-based cleanup pattern.

**Changes:**
- Replace `takeUntil(this._destroy$)` with `takeUntilDestroyed()` for all 3 subscriptions
- Remove unused `_destroy$` Subject and manual `destroy()` method
- Update imports to use `@angular/core/rxjs-interop`

**Why:**
- Manual `destroy()` method was never called anywhere in codebase
- Subscriptions accumulated without cleanup, causing memory leaks
- `takeUntilDestroyed()` uses Angular's DestroyRef for automatic cleanup
- Aligns with ADR-0003 and .claude/CLAUDE.md requirements

**Impact:**
- Automatic subscription cleanup when service context is destroyed
- Prevents memory leaks during hot module reloads and route changes
- Reduces code complexity (no manual lifecycle management needed)

Related to PM-27284

* refactor(dirt): remove newApplications from OrganizationReportSummary

Removes redundant newApplications field from summary type and uses
derived newApplications$ observable from orchestrator instead.

**Changes:**
- Remove newApplications from OrganizationReportSummary type definition
- Remove dummy data array from RiskInsightsReportService.getApplicationsSummary()
- Remove newApplications subscription from AllActivitiesService
- Update AllActivityComponent to subscribe directly to dataService.newApplications$

**Why:**
- Eliminates data redundancy (stored vs derived)
- newApplications$ already computes from applicationData.reviewedDate === null
- Single source of truth: applicationData is the source
- Simplifies encrypted payload (less data in summary)
- Better separation: stored data (counts) vs computed data (lists)

**Impact:**
- No functional changes - UI continues to display new applications correctly
- Cleaner architecture with computed observable pattern

* cleanup

* fix(dirt): improve dialog type safety and error logging

Addresses critical PR review issues in NewApplicationsDialogComponent:

**Type Safety:**
- Replace unsafe type casting `(this as any).dialogRef` with proper DialogRef injection
- Inject DialogRef<boolean | undefined> using Angular's inject() function
- Ensures type safety and prevents runtime errors from missing dialogRef

**Error Handling:**
- Add LogService to dialog component
- Log errors with "[NewApplicationsDialog]" for debugging
- Maintain user-facing error toast while adding server-side logging

**Impact:**
- Eliminates TypeScript safety bypasses
- Improves production debugging capabilities
- Follows Angular dependency injection best practices

* fixing mock data and test cases for new apps

* refactor(dirt): remove newApplications validation from OrganizationReportSummary type guard

Removes redundant newApplications field validation from the
OrganizationReportSummary type guard and related test cases.

**Changes:**
- Remove "newApplications" from allowed keys in isOrganizationReportSummary()
- Remove newApplications array validation logic
- Remove newApplications validation from validateOrganizationReportSummary()
- Remove 2 test cases for newApplications validation
- Remove newApplications field from 8 test data objects

**Rationale:**
The newApplications field was removed from OrganizationReportSummary type
definition because it's derived data that can be calculated from
applicationData (filtering where reviewedDate === null). The data is now
accessed via the reactive newApplications$ observable instead of being
stored redundantly in the summary object.

**Impact:**
- No functional changes - UI continues to display new applications via observable
- Type guard now correctly validates the actual OrganizationReportSummary structure
- Eliminates data redundancy and maintains single source of truth
- All 43 tests passing

---------

Co-authored-by: Tom <ttalty@bitwarden.com>
2025-10-30 11:13:01 -07:00
Jordan Aasen
1e5c0ac41f add reprompt. fix logic (#17122) 2025-10-30 08:57:48 -07:00