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

65 Commits

Author SHA1 Message Date
Bernd Schoolmann
8b5e6adc37 [PM-21378] Switch encrypt service to use SDK functions (#14538)
* Add new encrypt service functions

* Undo changes

* Cleanup

* Fix build

* Fix comments

* Switch encrypt service to use SDK functions

* Move remaining functions to PureCrypto

* Tests

* Increase test coverage

* Enforce sdk.ready and drop unused codepaths

* Delete unused code

* Add forgotten sdk init logic

* Fix build error

* Fix browser extension failing to unlock after process reload due to outdated usage of decryptString

* Fix send encryption

* Fix client key half decryption being stuck

* Attempt to fix sharereplay

* Fix build

* Fix type / add filter / add distinctuntilchange

* Fix capitalization
2025-07-21 15:52:38 +02:00
Bernd Schoolmann
60855c734f [PM-17666] Move Encstring to KM ownership (#15457)
* Move Encstring to KM ownership

* Fix wrong import

* Fix build

* Fix remaining imports

* Fix tests
2025-07-16 11:15:24 -04:00
Thomas Avery
09fb74679d [PM-21912] Require userID for KeyService's hasUserKey (#14890)
* Update keyService hasUserKey to require userId and remove unused/duplicate methods

* Update lock component consumer

* Update send commands to pass in userId

* update SSO login to pass in userID

* Update bw serve to pass in userID

* remove unneeded method from electron-key.service
2025-07-09 11:53:16 -05:00
SmithThe4th
e253e05c45 [PM-22516] Fix cipher key decryption to handle new error-based API instead of null returns (#15124)
* Replace null check in cipher key decryption

* Handle decryption error properly in user asymmetric key regeneration service
2025-06-23 09:11:52 -04:00
Thomas Avery
c52e6a3f2c [PM-22408] Remove setMasterKeyEncryptedUserKey from KeyService (#15087)
* Swap consumers to masterPasswordService.setMasterKeyEncryptedUserKey

* Remove setMasterKeyEncryptedUserKey from keyService

* unit tests
2025-06-11 15:48:18 -05:00
Thomas Avery
90b07728d7 [PM-22133] Require userID for clearStoredUserKey (#14973) 2025-06-10 17:28:50 -05:00
Bernd Schoolmann
a368b70ab5 [BEEEP] Remove legacy biometrics protocol (#15004)
* Remove legacy biometrics protocol

* Remove legacy message handling on desktop
2025-06-10 05:25:12 +02:00
Thomas Avery
9d743a7ee0 [PM-21705] Require userID for refreshAdditionalKeys() on key-service (#14810)
* Require userID for refreshAdditionalKeys()

* Add error handling to desktop Unlock settings

* Add more unit test coverage
2025-06-06 13:38:25 -05:00
Addison Beck
299976e55a fix(eslint): extend tsconfig.base in tsconfig.eslint (#15082)
* fix(eslint): extend tsconfig.base in tsconfig.eslint

* fix(eslint): clean up new lint errors
2025-06-05 11:08:03 -04:00
Addison Beck
26caeb3083 Implement and extend tsconfig.base across projects (#14554)
* Implement and extend tsconfig.base across projects

* fixup! Merge remote-tracking branch 'origin/main' into rename-tsconfig

* fix: import tsconfig.base from components

* fix: skip typechecking node modules

* fixing tests

* fix the tests for real

* undo accidentally change
2025-06-02 20:38:17 +00:00
Oscar Hinton
2fbc4c1578 [CL-525] Upgrade angular to v19 (#14815)
Upgrade Angular to v19 using the update guide.

- Add `standalone: false` to any missed component in stories or tests.
- Update jest.config to follow the new best practices.
2025-06-02 13:13:31 -04:00
Thomas Avery
eba22cf5f8 [PM-21797] Require userID for keyService's getUserKeyFromStorage (#14855)
* require userID for keyService's getUserKeyFromStorage
2025-05-30 13:45:31 -05:00
Thomas Avery
895d54fd5e [PM-21443] Require userId for KeyService's everHadUserKey$ (#14712)
* Require userId for KeyService's everHadUserKey$

* handle null active user in tdeDecryptionRequiredGuard
2025-05-30 11:40:55 -05:00
Andreas Coroiu
d1fb37d696 [PM-17635] [PM-18601] Simplifying mocking and usage of the sdk (#14287)
* feat: add our own custom deep mocker

* feat: use new mock service in totp tests

* feat: implement userClient mocking

* chore: move mock files

* feat: replace existing manual sdkService mocking

* chore: rename to 'client'

* chore: improve docs

* feat: refactor sdkService to never return undefined BitwardenClient
2025-05-28 15:00:30 +02:00
Addison Beck
56a3b14583 Introduce eslint errors for risky/circular imports (#14804)
* first draft at an idea dependency graph

* ignore existing errors

* remove conflicting rule regarding internal platform logic in libs

* review: allow components to import from platform
2025-05-23 08:01:25 -04:00
Thomas Avery
bd29397fd8 [PM-21611] Require userId on KeyService clear methods (#14788) 2025-05-22 13:55:26 -05:00
Bernd Schoolmann
d7c936e1ea [PM-17900] Add cose / xchacha20poly1305 migration on userkey rotation (#14539)
* Add new encrypt service functions

* Undo changes

* Cleanup

* Fix build

* Fix comments

* Switch encrypt service to use SDK functions

* Add cose migration on userkey rotation

* Update sdk

* Set featureflag to default disabled

* Add tests

* Update sdk to build 168

* Make changes according to feedback
2025-05-20 12:25:14 -07:00
Patrick-Pimentel-Bitwarden
0b0397c3f0 fix(enums-eslint): Enum Rule for ESLint (#14650)
* fix(enums-eslint): Enum Rule for ESLint - Added enums in the warnings for eslint.

* fix(enums-eslint): Enum Rule for ESLint - Updated to error in both places for enums.

* fix(enums-eslint): Enum Rule for ESLint - Added new eslint plugin for warning on enums.

* fix(enums-eslint): Enum Rule for ESLint - Changed based on suggestion.

Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>

* refactor(browser-platform-utils): Remove Deprecation and Fix Code - Changed usages of firefox to private and moved the usages to the preferred public method and removed the deprecations.

* fix(enums-eslint): Enum Rule for ESLint - Updated to error and added disable rules for all other places.

* fix(enums-eslint): Enum Rule for ESLint - Undid other changes by accident
2025-05-13 10:07:38 -04:00
Bernd Schoolmann
5408a62b7d [PM-21001] Move KM usage of encrypt service (#14541)
* Add new encrypt service functions

* Undo changes

* Cleanup

* Fix build

* Fix comments

* Move KM usage of encrypt service

* Fix build
2025-05-12 11:41:45 +02:00
Bernd Schoolmann
744c1b1b49 [PM-21001] Move vault code to new encrypt service interface (#14546)
* Move vault code to new encrypt service interface

* Fix tests
2025-05-06 21:24:53 +00:00
Bernd Schoolmann
855dad7fcc Do not throw on missing provider keys (#14430) 2025-05-06 12:29:52 +02:00
Thomas Avery
d43e4757df [PM-7604] Require target UserID for KdfConfigService (#14380)
* Require userId for KdfConfigService

* Update auth team callers

* Update tools team callers
2025-04-29 17:25:27 -05:00
Bernd Schoolmann
fd0db40f79 [PM-20492] Refactor symmetric keys - remove key buffer representation, migrate consumers to .toEncoded() (#14371)
* Refactor encrypt service to expose key wrapping

* Fix build

* Undo ts strict removal

* Fix wrong method being used to encrypt key material

* Rename parameters and remove todo

* Add summary to encrypt

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/abstractions/encrypt.service.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Add tests for unhappy paths

* Add test coverage

* Add links

* Remove direct buffer access

* Fix build on cli

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
2025-04-25 19:26:39 +02:00
Bernd Schoolmann
e231286f37 [PM-19731] Refactor encrypt service to expose key wrapping (#14080)
* Refactor encrypt service to expose key wrapping

* Fix build

* Undo ts strict removal

* Fix wrong method being used to encrypt key material

* Rename parameters and remove todo

* Add summary to encrypt

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/abstractions/encrypt.service.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Add tests for unhappy paths

* Add test coverage

* Add links

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
2025-04-22 13:56:39 +00:00
Bernd Schoolmann
b09305577f [PM-19603] Change asymmetric interface to only allow key encapsulation (#14046)
* Change asymmetric interface to only allow key encapsulation

* Fix naming

* Clean up naming

* Update libs/common/src/key-management/crypto/abstractions/encrypt.service.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update libs/common/src/key-management/crypto/abstractions/encrypt.service.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Fix test

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
2025-04-15 16:39:02 +02:00
Bernd Schoolmann
5a1b0744f0 [PM-17665] Move cryptofunction service to km (#13285)
* Move cryptofunction service to km

* Fix formatting

* Fix import

* Fix build on desktop

* Fix build on browser and tests
2025-04-10 11:09:35 +02:00
Bernd Schoolmann
1c44640ea5 [PM-16541] Key rotation & enrollment trust for emergency access & organizations (#12655)
* Implement key rotation v2

* Pass through masterpassword hint

* Properly split old and new code

* Mark legacy rotation as deprecated

* Throw when data is null

* Cleanup

* Add tests

* Fix build

* Update libs/key-management/src/key.service.spec.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update apps/web/src/app/auth/settings/change-password.component.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Add documentation

* Centralize loading logic

* Implement trust dialogs

* Fix build and clean up

* Add tests for accept organization component

* Fix enrollment

* Update apps/web/src/app/admin-console/organizations/manage/organization-trust.component.html

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Cleanup according to feedback

* Change div to ng-container

* Init uninited strings

* Fix type errors on dialog config

* Fix typing

* Fix build

* Fix build

* Update libs/key-management-ui/src/key-rotation/key-rotation-trust-info.component.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Fix linting

* Undo legacy component import change

* Simplify dialog text

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
2025-04-07 13:41:19 +02:00
Bernd Schoolmann
1450a033b3 [PM-19469] Add logs for unlock time (#13972)
* Add logs for unlock time

* Undo local flag override

* Update message

* Update messages

* Fix build on chrome
2025-04-02 23:19:53 +02:00
Jake Fink
a3c9a42d13 [PM-19172] Passes UserId through change email component and adds tests (#13686)
* add tests and pass userid

* add tests for getOrDeriveMasterKey

* remove extra coalesce for token
2025-04-01 11:54:13 -04:00
Bernd Schoolmann
15738f16ae [PM-18038] Fix safari using outdated biometrics protocol (#13287)
* Fix safari using outdated biometrics protocol

* Remove logging

* Remove log

* Move canEnableBiometricUnlock to biometric service

* Fix build

* Add tests

* Fix type error

* Attempt to fix build

* Fix build

* Fix test failure
2025-03-31 16:59:01 +02:00
Bernd Schoolmann
22039d038d [PM-3475] Remove deprecated keys (#13266)
* Remove deprecated keys

* Fix cli build

* Fix build
2025-03-31 16:58:02 +02:00
Bernd Schoolmann
8c6a33d7b8 [PM-16603] Implement userkey rotation v2 (#12646)
* Implement key rotation v2

* Pass through masterpassword hint

* Properly split old and new code

* Mark legacy rotation as deprecated

* Throw when data is null

* Cleanup

* Add tests

* Fix build

* Update libs/key-management/src/key.service.spec.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Update apps/web/src/app/auth/settings/change-password.component.ts

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Add documentation

* Centralize loading logic

* Fix build

* Remove sharedlib from legacymigration component

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
2025-03-24 20:41:21 +01:00
Thomas Avery
81335978d8 [PM-17669] Move MasterPasswordService to KM (#13148)
* Move MasterPasswordService to KM
2025-03-13 13:29:27 -05:00
Thomas Rittson
ef72f513b1 eslint: report unused disable directives (#13463)
Remove any unused disable directives and FIXMEs in our code
2025-03-10 09:33:08 -04:00
Jake Fink
43f5423e78 [PM-12606] Move Vault Timeout and Vault Timeout Settings to KM (#13405)
* move vault timeout and vault timeout settings to km

* move browser vault timeout service to km

* fix cli import

* fix imports

* fix some relative imports

* use relative imports within common

* fix imports

* fix new imports

* Fix new imports

* fix spec imports
2025-02-28 09:55:03 -05:00
Oscar Hinton
cec117459b [PM-18599] Forbid unknown property and element in tests (#13556)
Fail tests when relying on unknownProperties or unknownElements. Existing instances are whitelist and have tickets created and assigned to the relevant teams.
2025-02-25 14:02:19 -08:00
Maciej Zieniuk
3924bc9c84 [PM-14445] TS strict for Key Management, Keys and Lock component (#13121)
* PM-14445: TS strict for Key Management Biometrics

* formatting

* callbacks not null expectations

* state nullability expectations updates

* unit tests fix

* secure channel naming, explicit null check on messageId

* KM-14445: TS strict for Key Management, Keys and Lock component

* conflicts resolution, new strict check failures

* null simplifications

* migrate legacy encryption when no active user throw error instead of hiding it

* throw instead of return
2025-02-20 18:45:37 +01:00
Bernd Schoolmann
7a7be6088a [PM-16984] Improve decryption code clarity (#12681)
* Improve decrypt failure logging

* Rename decryptcontext to decrypttrace

* Improve docs
2025-02-18 16:59:53 +01:00
SmithThe4th
a2945203f4 [PM-12047] Remove usage of ActiveUserState from cipher.service (#12814)
* Cipher service web changes

* Updated browser client to pass user id to cipher service observable changes

* Cli changes

* desktop changes

* Fixed test

* Libs changes

* Fixed merge conflicts

* Fixed merge conflicts

* removed duplicate reference fixed conflict

* Fixed test

* Fixed test

* Fixed test

* Fixed desturcturing issue on failed to decrypt ciphers cipher service

* Updated abstraction to use method syntax

* Fixed conflicts

* Fixed test on add edit v2

Passed active userId to delete function

* Used getUserId utility function

* made vault changes

* made suggestion changes

* made suggestion changes

* made suggestion changes

* Replace getUserId function calls with pipe operator syntax for better consistency

* fixed merge conflicts

* revert mistake made of usinf account activity during merge conflict fix

* fixed conflicts

* fixed tests
2025-02-12 08:53:31 -05:00
Thomas Avery
2b5c7861e2 [PM-16926] Fix KM bad imports (#12807) 2025-02-10 11:50:56 -06:00
Maciej Zieniuk
7e2e604439 [PM-14445] TS strict for Key Management Biometrics (#13039)
* PM-14445: TS strict for Key Management Biometrics

* formatting

* callbacks not null expectations

* state nullability expectations updates

* unit tests fix

* secure channel naming, explicit null check on messageId

* revert null for getUser, getGlobal in state.provider.ts

* revert null for getUser, getGlobal in state.provider.ts
2025-02-10 13:31:19 +01:00
Bernd Schoolmann
2f8a7a95bd [PM-15994] Move encrypt service to km ownership (#13220)
* Move encrypt service to km ownership

* Update imports for encrypt service abstraction and move bulk encrypt service abstraction

* Fix imports

* Fix further imports

* Fix imports

* Fix worker import
2025-02-05 17:39:11 +01:00
Jordan Aasen
2c118d9f01 [PM-16925] - fix all restricted imports in vault (#13236)
* fix all restricted imports in vault

* fix spec

* remove export
2025-02-04 14:26:03 -08:00
Oscar Hinton
f8bdd66fbb [PM-17629] Split up KM lib to km and km-ui (#13093) 2025-01-30 11:20:17 +01:00
Maciej Zieniuk
abb18881b6 [PM-14445] TS strict for Key Management KDF (#13007)
* PM-14445: TS strict for Key Management KDF

* state deserializer can return null
2025-01-23 10:45:33 +01:00
Bernd Schoolmann
ef20ca83b6 [PM-17121/17204] Fix fingerprint dialogs and disabled active biometric lock component (#12928)
* Fix biometrics unlock window being empty

* Add trust on sensitive action

* Add dialog for outdated desktop app and fix spelling

* Use updated fingerprint method

* Refactor connected app trust

* Move connected apps to ephemeral value store and show error on outdated browser

* Move trust logic to only occur when fingerprint setting is enabled

* Add more tests

* Simplify code

* Update ephemeral value list call to "listEphemeralValueKeys"

* Fix trust being ignored
2025-01-21 21:26:34 +01:00
Oscar Hinton
e5f83ff086 [PM-17031] Create UI-common (#12831)
Extract core functionality from `libs/angular` to allow teams to depend on `libs/ui-common` instead.

Moves the following functionality to `ui-common`.
- `I18nPipe`. `libs/angular` still has an old copy but `components` depends on the new variant from `ui-common`.
- `safeProvider`, `SafeProvider` and `SafeInjectionToken`. `libs/angular`re-exports these to avoid needing to update all consumers.
2025-01-17 10:42:31 -05:00
Jake Fink
494d349b57 prevent bio prompt when switching to unlocked account (#12875) 2025-01-15 13:22:50 -05:00
Bernd Schoolmann
a5dce05354 [PM-17035] Fix biometric unlock badge in mv2 (#12854)
* Fix biometrics not working in firefox or windows

* Remove logs

* Update badge after biometric unlock

* Add removal todo note

* Remove debug logging

* Fix type warnings

* Fix userkey typing in background biometrics service

* Simplify types for userkey in foreground-browser-biometrics and runtime.background.ts

* Add process reload logging

* Fix autoprompt not working when no process reload happened

* Fix biometric unlock badge in mv2

* Fix instant reprompt on firefox lock

* Remove biometrics autoprompt on firefox (#12856)
2025-01-15 17:59:39 +01:00
Bernd Schoolmann
318a3ac6a9 [PM-17038] Fix biometrics autoprompt in firefox and chrome (#12853)
* Fix biometrics not working in firefox or windows

* Remove logs

* Update badge after biometric unlock

* Add removal todo note

* Remove debug logging

* Fix type warnings

* Fix userkey typing in background biometrics service

* Simplify types for userkey in foreground-browser-biometrics and runtime.background.ts

* Add process reload logging

* Fix autoprompt not working when no process reload happened

* Fix instant reprompt on firefox lock

* Fix biometrics enabling error on chrome

* Update apps/browser/src/key-management/biometrics/foreground-browser-biometrics.ts

Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>

* FIx build & linting

---------

Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
2025-01-14 18:29:52 +01:00