1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-07-07 12:25:46 +02:00
Commit Graph

1116 Commits

Author SHA1 Message Date
aj-rosado
61b3759736
[PM-6334] Passing CollectionView or FolderView from Import component to ImportService (#8291)
* Passing CollectionView or FolderView from Import component to ImportService

* Corrected import service tests

* Added tests to validate if the incorrect object type error is thrown on setImportTarget
2024-03-19 14:19:41 +00:00
Jonathan Prusik
13e1672c69
[PM-6658] Migrate disableFavicon to Domain Settings service and remove Settings service (#8333)
* add showFavicons to domain settings

* replace usages of disableFavicon with showFavicons via the domain settings service and remove/replace settings service

* create migration for disableFavicon

* cleanup
2024-03-19 10:14:49 +00:00
Thomas Rittson
b95dfd9d30
[AC-2276] Move policyService helper methods to domain object (#8254)
* Move mapPolicyFromResponse and mapPoliciesFromToken to static factory methods
2024-03-19 12:19:32 +10:00
Justin Baur
a3f6b9eacb
[PM-6853] Recreate getUserStateOrDefault$ (#8374)
* Recreate getUserStateOrDefault$

* Update Tests
2024-03-18 19:59:06 +00:00
Tom
cc28149e60
[PM-5572] Event upload and collection state provider migration (#7863)
* event upload and collection state provider migration

* cipher can be null when exporting org

* Addressing pr comments. Casting UserId from calling methods

* fixing userAuth observable in event collection service

* Adding more documentation for the changes.

* cli needed state provider and account services added

* Addressing pr comments on modifying should update

* No need to auth on event upload

* Simplifying the takeEvents for pulling user events

* Reverting shouldUpdate to previous state

* Removing redundant comment

* Removing account service for event upload

* Modifying the shouldUpdate to evaluate the logic outside of the observable

* Adding back in the auth for event upload service and adding event upload to the cli logout method

* Adding the browser service factories

* Updating the browser services away from get background

* Removing event collect and upload services from browser services

* Removing the audit service import

* Adding the event collection migration and migration test

* Event collection state needs to be stored on disk

* removing event collection from state service and abstraction

* removing event collection from the account data

* Saving the migrations themselves
2024-03-18 14:36:43 -04:00
Addison Beck
c7abdb9879
Migrate OrganizationService to StateProvider (#7895) 2024-03-18 17:58:33 +01:00
Jared Snider
8fa1ef54bc
Revert "PM-5263 - TokenService needs to actually use secure storage (#8356)" (#8370)
This reverts commit ca8628880b.
2024-03-18 12:06:43 -04:00
Jared Snider
ca8628880b
PM-5263 - TokenService needs to actually use secure storage (#8356) 2024-03-15 21:05:23 +00:00
Justin Baur
4fabc94c3c
Add the key definition name in the error for buildKey (#8355) 2024-03-15 20:15:53 +00:00
Conner Turnbull
b99153a016
[AC-2156] Billing State Provider Migration (#8133)
* Added billing account profile state service

* Update usages after removing state service functions

* Added migrator

* Updated bw.ts and main.background.ts

* Removed comment

* Updated state service dependencies to include billing service

* Added missing mv3 factory and updated MainContextMenuHandler

* updated autofill service and tests

* Updated the remaining extensions usages

* Updated desktop

* Removed subjects where they weren't needed

* Refactored billing service to have a single setter to avoid unecessary emissions

* Refactored has premium guard to return an observable

* Renamed services to match ADR

f633f2cdd8/docs/architecture/clients/presentation/angular.md (abstract--default-implementations)

* Updated property names to be a smidgen more descriptive and added jsdocs

* Updated setting of canAccessPremium to automatically update when the underlying observable emits

* Fixed build error after merge conflicts

* Another build error from conflict

* Removed autofill unit test changes from conflict

* Updated login strategy to not set premium field using state service

* Updated CLI to use billing state provider

* Shortened names a bit

* Fixed build
2024-03-15 14:53:05 -05:00
Jared Snider
161fb1da5d
Auth/PM-5263 - TokenService State Provider Migration (#7975)
* PM-5263 - Token Service state migration - (1) Got key and state definitions setup (2) Ported over core state service getTimeoutBasedStorageOptions method logic into local determineStorageLocation method (3) Updated majority of methods to use state provider state

* PM-5263 - StateSvc - add TODO to remove timeoutBasedStorageOptions + other state methods after migration code complete.

* PM-5263 - TokenSvc - ClearToken method - (1) Update signature to remove user id as it wasn't used and it simplifies the new state provider implementation (2) Convert away from state svc to state provider state.

* PM-5263 - TokenService - update deps - WIP on circular dep issues.

* PM-5263 -  To resolve circular dep issues between VaultTimeoutSettingsSvc and TokenService: (1) For writes, require callers to pass in vault timeout data (2) For reads, we can just check both locations. This approach has 1 less state call than the previous implementation and is safe as long as the clear logic properly works and is executed anytime a user changes their vault timeout action (lock or log out) & vault timeout (numeric value)

* PM-5263 - VaultTimeoutSettingsSvc - Set token calls now updated to include vault timeout info.

* PM-5263 - Update API Service - add state service and look up vault timeout details and pass to token service when setting token info.

* PM-5263 - TokenService - update service dependencies.

* PM-5263 - TokenService - Add new getAccessTokenByUserId method for state service use case.

* PM-5263 - StateSvc - remove migrated methods and try to replace all usages of getAccessToken. WIP

* PM-5263 - TokenSvc Migration - start on migrator

* PM-5263 - (1) TokenSvc - Build new clearAccessTokenByUserId which is required by state service (2) TokenSvc - Update getToken to take an optional userId to handle another state service case (3) Add some documentation to TokenSvc abstraction.

* PM-5263 - StateService - finish updating all calls within the state service which accessed token service state directly with calls to the new token service methods instead.

* PM-5263 - TokenSvc Abstraction - Add more docs

* PM-5263 - TokenSvc abstraction - more doc tweaks

* PM-5263 - Web state service - add new token service dependency.

* PM-5263  - User API Key Login Strategy - Update to pull vault timeout action and vault timeout from state service in order to pass to new token service endpoints for setting API key client id and secret.

* PM-5263  - (1) Remove TokenSvc owned state from account (2) StateSvc - remove account scaffold logic for clearing removed account data. The same functionality will exist in the state provider framework via lifecycle hooks cleaning up this data and users getting initialized with null data by default.

* PM-5263 - Add token service dependency to state service (WIP - desktop deps not working)

* PM-5263 - Update services module on desktop and browser to add token svc dependency

* PM-5263 - API service factory - add state service factory dependency that I missed initially to get browser building.

* PM-5263 - TokenSvc - getToken/setToken/decodeToken --> getAccessToken/setAccessToken/decodeAccessToken

* PM-5263 - TokenSvc State Provider Migrator - WIP - update expected acct type to match actual account

* PM-5263 - TokenService - clearToken renamed to clearTokens

* PM-5263 - CLI - NodeApiService - add state service dep to get CLI building.

* PM-5263 - StateDefinitions - use unique state definition names

* PM-5263 - StateSvc - remove getTimeoutBasedStorageOptions as no longer used.

* PM-5263 - TokenSvc - Add TODO for figuring out how to store tokens in secure storage.

* PM-5263 - StateSvc - remove get/set 2FA token - references migrated later.

* PM-5263 - TODO: figure out if using same key definition names is an issue

* PM-5263 - TokenServiceStateProviderMigrator written

* PM-5263 - TokenServiceStateProviderMigrator - (1) Don't update legacy account if we only added a new state in state provider for 2FA token (2) Use for loop for easier debugging

* PM-5263 - TokenServiceStateProviderMigrator test - WIP - migration testing mostly complete and passing. Rollback logic TODO.

* PM-5263 - TokenServiceStateProviderMigrator - Add rollback logic to restore 2FA token from users to global.

* PM-5263 - TokenServiceStateProviderMigrator - Refactor rollback to only set account once as not necessary to set it every time.

* PM-5263 - TokenServiceStateProviderMigrator tests - test all rollback scenarios

* PM-5263 - Remove TODO as don't need unique key def names as long as state def keys are unique.

* PM-5263 - TokenSvc - update clearAccessTokenByUserId to use proper state provider helper method to set state.

* PM-5263 - Revert accidentally committing settings.json changes.

* PM-5263 - TokenSvc - update all 2FA token methods to require email so we can user specifically scope 2FA tokens while still storing them in global storage.

* PM-5263 - Update all token service 2FA set / get / clear methods to pass in email.

* PM-5263  - JslibServices module - add missed login service to login strategy svc deps.

* PM-5263 - VaultTimeoutSettingsService - setVaultTimeoutOptions - rename token to accesToken for clarity.

* PM-5263 - (1) TokenSvc - remove getAccessTokenByUserId and force consumers to use getAccessToken w/ optional user id to keep interface small (2) TokenSvc - attempt to implement secure storage on platforms that support it for access & refresh token storage (3) StateSvc - replace usage of getAccessTokenByUserId with getAccessToken

* PM-5263 - TokenSvc - add platform utils and secure storage svc deps

* PM-5263 - TODO: figure out what to do with broken migration

* PM-5263 - TODO: update tests in light of latest 2FA token changes.

* PM-5263 - TokenSvc - clean up TODO

* PM-5263 - We should have tests for the token service.

* PM-5263 - TokenSvc - setAccessToken - If platform supports secure storage and we are saving an access token, remove the access token from memory and disk to fully migrate to secure storage.

* PM-5263 - TokenSvc - getAccessToken - Update logic to look at memory and disk first always and secure storage last to support the secure storage migration

* PM-5263 - TokenSvc - setAccesToken - if user id null on a secure storage supporting platform, throw error.

* PM-5263 - TokenService - (1) Refresh token now stored in secure storage (2) Refresh token set now private as we require a user id to store it in secure storage and we can use the setTokens method to enforce always setting the access token and refresh token together in order to extract a user id from the refresh token. (3) setTokens clientIdClientSecret param now optional

* PM-5263 - TokenServiceStateProviderMigrator - update migration to take global but user scoped 2FA token storage changes into account.

* PM-5263 - Remove old migration as it references state we are removing. Bump min version.

Co-authored-by: Matt Gibson <git@mgibson.dev>

* PM-5263 - TokenService - 2FA token methods now backed by global state record which maps email to individual tokens.

* PM-5263 - WIP on Token Svc migrator and test updates based on new 2FA token storage changes.

* PM-5263 - TokenSvc - (1) Add jira tickets to clean up state migration (2) Add state to track secure storage migration to improve # of reads to get data

* PM-5263 - StateDef - consolidate name of token domain state defs per feedback from Justin + update migration tests

* PM-5263 - TokenSvc - fix error message and add TODO

* PM-5263 - Update token service migration + tests to pass after all 2FA token changes.

* PM-5263 - Fix all login strategy tests which were failing due to token state provider changes + the addition of the loginService as a dependency in the base login strategy.

* PM-5263 - Register TokenService state provider migration with migrator

* PM-5263 - TokenSvc state migration - set tokens after initializing account

* PM-5263 - TokenService changes - WIP - convert from ActiveUserStateProvider to just SingleUserStateProvider to avoid future circ dependency issues.

Co-authored-by: Jake Fink <jlf0dev@users.noreply.github.com>

* PM-5263 - TokenSvc - create getSecureStorageOptions for centralizing all logic for getting data out of SecureStorage.

* PM-5263 - TokenSvc - (1) Refactor determineStorageLocation to also determine secure storage - created a TokenStorageLocation string enum to remove magic strings (2) Refactor setAccessToken to use switch (3) Refactor clearAccessTokenByUserId to clear all locations and not early return on secure storage b/c we only use secure storage if disk is the location but I don't want to require vault timeout data for this method.

* PM-5263 - TokenSvc - getDataFromSecureStorage - Refactor to be more generic for easier re-use

* PM-5263 - TokenSvc - Convert refresh token methods to use single user state and require user ids

* PM-5263 - VaultTimeoutSettingsSvc - get user id and pass to access and refresh token methods.

* PM-5263 - TokenSvc - refactor save secure storage logic into private helper.

* PM-5263 - Base Login Strategy - per discussion with Justin, move save of tokens to before account initialization as we can always derive the user id from the access token. This will ensure that the account is initialized with the proper authN status.

* PM-5263 - TokenSvc - latest refactor - update all methods to accept optional userId now as we can read active user id from global state provider without using activeUserStateProvider (thus, avoiding a circular dep and having to have every method accept in a mandatory user id).

* PM-5263 - VaultTimeoutSettingsService - remove user id from token calls

* PM-5263 - TokenSvc - update all places we instantiate token service to properly pass in new deps.

* PM-5263 - TokenSvc migration is now 27th instead of 23rd.

* PM-5263  - Browser - MainContextMenuHandler - Update service options to include PlatformUtilsServiceInitOptions as the TokenService requires that and the TokenService is now injected on the StateService

* PM-5263 - TokenSvc migration test - update rollback tests to start with correct current version

* PM-5263 - Create token service test file - WIP

* PM-5263 - TokenSvc - tests WIP - instantiates working.

* PM-5263 - TokenSvc - set2FAToken - use null coalesce to ensure record is instantiated for new users before setting data on it.

* PM-5263 - TokenService tests - WIP - 2FA token tests.

* PM-5263 - Worked with Justin to resolve desktop circular dependency issue by adding SUPPORTS_SECURE_STORAGE injection token instead of injecting PlatformUtilsService directly into TokenService.

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* PM-5263 - TokenSvc tests - WIP - (1) Update TokenSvc instantiation to use new supportsSecureStorage (2) Test TwoFactorToken methods

* PM-5263 - Fix SUPPORTS_SECURE_STORAGE injection token to properly call supportsSecureStorage message

* PM-5263 - Token state testing

* PM-5263 - TokenState fix name of describe

* PM-5263 - TokenService - export TokenStorageLocation for use in tests.

* PM-5263 - TokenSvc Tests WIP

* PM-5263 - TokenSvc tests - access token logic mostly completed.

* PM-5263 - TokenSvc Tests - more WIP - finish testing access token methods.

* PM-5263 - TokenSvc WIP - another clear access token test.

* PM-5263 - TokenSvc tests - WIP - SetTokens tested.

* PM-5263 - Tweak test name

* PM-5263 - TokenSvc tests - remove unnecessary describe around 2FA token methods.

* PM-5263 - TokenSvc.clearAccessTokenByUserId renamed to just clearAccessToken

* PM-5263 - TokenSvc - refactor clearTokens logic and implement individual clear logic which doesn't require vault timeout setting information.

* PM-5263 - TokenSvc - Replace all places we have vaultTimeout: number with vaultTimeout: number | null to be accurate.

* PM-5263 - TokenSvc.clearTokens - add check for user id; throw if not found

* PM-5263 - TokenService - test clearTokens

* PM-5263 - TokenSvc Tests - setRefreshToken tested

* PM-5263 - TokenSvc tests - getRefreshToken tested + added a new getAccessToken test

* PM-5263 - TokenSvc - ClearRefreshToken scenarios tested.

* PM-5263 - TokenSvc.clearRefreshToken tests - fix copy pasta

* PM-5263 - TokenSvc tests - (1) Fix mistakes in refresh token testing (2) Test setClientId for all scenarios

* PM-5263 - TokenSvc tests - (1) Add some getClientId tests (2) clarify lack of awaits

* PM-5263 - TokenSvc Tests - WIP - getClientId && clearClientId

* PM-5263 - TokenService - getClientSecret - fix error message

* PM-5263 - TokenService tests - test all client secret methods

* PM-5263 - Update TokenSvc migration to 30th migration

* PM-5263 - TokenService - update all tests to initialize data to undefined now that fake state provider supports faking data based on specific key definitions.

* PM-5263 - (1) TokenSvc.decodeAccessToken - update static method's error handling (2) TokenSvc tests - test all decodeAccessToken scenarios

* PM-5263 - TokenSvc - (1) Add DecodedAccessToken type (2) Refactor getTokenExpirationDate logic to use new type and make proper type checks for numbers for exp claim values.

* PM-5263 - TokenSvc tests - test getTokenExpirationDate method.

* PM-5263 - TokenSvc - (1) Update DecodedAccessToken docs (2) Tweak naming in tokenSecondsRemaining

* PM-5263 - TokenSvc abstraction - add jsdoc for tokenSecondsRemaining

* PM-5263 - TokenSvc tests - test tokenSecondsRemaining

* PM-5263 - TokenSvc - DecodedAccessToken type - update sstamp info

* PM-5263 - TokenService - fix flaky tokenSecondsRemaining tests by locking time

* PM-5263 - TokenSvc Tests - Test tokenNeedsRefresh

* PM-5263 - (1) TokenSvc - Refactor getUserId to add extra safety (2) TokenSvc tests - test getUserId

* PM-5263  - (1) TokenSvc - refactor getUserIdFromAccessToken to handle decoding errors (2) TokenSvc tests - test getUserIdFromAccessToken

* PM-5263 - (1) TokenSvc - Refactor getEmail to handle decoding errors + check for specific, expected type (2) TokenSvc tests - test getEmail

* PM-5263 - TokenSvc tests - clean up comment

* PM-5263 - (1) TokenSvc - getEmailVerified - refactor (2) TokenSvc tests - add getEmailVerified tests

* PM-5263  - (1) TokenSvc - refactor getName (2) TokenSvc tests - test getName

* PM-5263 - (1) TokenSvc - refactor getIssuer (2) TokenSvc tests - test getIssuer

* PM-5263 - TokenSvc - remove unnecessary "as type" statements now that we have a decoded access token type

* PM-5263  - (1) TokenSvc - refactor getIsExternal (2) TokenSvc Tests - test getIsExternal

* PM-5263  - TokenSvc abstraction - tune up rest of docs.

* PM-5263 - TokenSvc - clean up promise<any> and replace with promise<void>

* PM-5263 - TokenSvc abstraction - more docs.

* PM-5263  - Clean up TODO as I've tested every method in token svc.

* PM-5263 - (1) Extract JWT decode logic into auth owned utility function out of the token service (2) Update TokenService decode logic to use new utility function (3) Update LastPassDirectImportService + vault.ts to use new utility function and remove token service dependency.  (4) Update tests + migrate tests to new utility test file.

* PM-5263 - Rename decodeJwtTokenToJson to decode-jwt-token-to-json to meet lint rules excluding capitals

* PM-5263 - TokenSvc + tests - fix all get methods to return undefined like they did before instead of throwing an error if a user id isn't provided.

* PM-5263 - Services.module - add missing token service dep

* PM-5263 - Update token svc migrations to be 32nd migration

* PM-5263 - Popup - Services.module - Remove token service as it no longer requires a background service due to the migration to state provider. The service definition in jslib-services module is enough.

* PM-5263 - BaseLoginStrategy - Extract email out of getTwoFactorToken method call for easier debugging.

* PM-5263 - Login Comp - Set email into memory on login service so that base login strategy can access user email for looking up 2FA token stored in global state.

* PM-5263 - (1) LoginComp - remove loginSvc.setEmail call as no longer necessary + introduced issues w/ popup and background in browser extension (2) AuthReq & Password login strategies now just pass in email to buildTwoFactor method.

* PM-5263 - SsoLoginSvc + abstraction - Add key definition and get/set methods for saving user email in session storage so it persists across the SSO redirect.

* PM-5263 - Base Login Strategy - BuildTwoFactor - only try to get 2FA token if we have an email to look up their token

* PM-5263 - Remove LoginService dependency from LoginStrategyService

* PM-5263 - (1) Save off user email when they click enterprise SSO on all clients in login comp (2) Retrieve it and pass it into login strategy in SSO comp

* PM-5263 - (1) TokenSvc - update 2FA token methods to be more safe in case user removes record from local storage (2) Add test cases + missing clearTwoFactorToken tests

* PM-5263 - Browser SSO login - save user email for browser SSO process

* PM-5263 - Finish removing login service from login strategy tests.

* PM-5263 - More removals of the login service from the login strategy tests.

* PM-5263 - Main.ts - platformUtilsSvc no longer used in TokenSvc so remove it from desktop main.ts

* PM-5263 - Fix failing login strategy service tests

* PM-5263 - Bump token svc migration values to migration 35 after merging in main

* PM-5263 - Bump token svc migration version

* PM-5263 - TokenService.clearTwoFactorToken - use delete instead of setting values to null per discussion with Justin

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* PM-5263 - TokenSvc + decode JWT token tests - anonymize my information

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* PM-5263 - TokenSvc tests - update clear token tests based on actual deletion

* PM-5263 - Add docs per PR feedback

* PM-5263 - (1) Move ownership of clearing two factor token on rejection from server to base login strategy (2) Each login strategy that supports remember 2FA logic now persists user entered email in its data (3) Base login strategy processTwoFactorResponse now clears 2FA token (4) Updated base login strategy tests to affirm the clearing of the 2FA token

* Update libs/auth/src/common/login-strategies/login.strategy.ts

Co-authored-by: Jake Fink <jfink@bitwarden.com>

* Update libs/auth/src/common/login-strategies/password-login.strategy.ts

Co-authored-by: Jake Fink <jfink@bitwarden.com>

* PM-5263 - Login Strategy - per PR feedback, add jsdoc comments to each method I've touched for this PR.

* PM-5263 - (1) TokenSvc - adjust setTokens, setAccessToken, setRefreshToken, and clearRefreshToken based on PR feedback to remove optional user ids where possible and improve public interface (2) TokenSvc Abstraction - update docs and abstractions based on removed user ids and changed logic (3) TokenSvc tests - update tests to add new test cases, remove no longer relevant ones, and update test names.

* PM-5263 - Bump migrations again

---------

Co-authored-by: Matt Gibson <git@mgibson.dev>
Co-authored-by: Jake Fink <jlf0dev@users.noreply.github.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: Jake Fink <jfink@bitwarden.com>
2024-03-15 11:50:04 -04:00
Matt Gibson
8ee1965832
Revert "Use global state for biometric prompt cancel storage (#8328)" (#8351)
This reverts commit 770f782a16.
2024-03-15 11:28:34 -04:00
Jonathan Prusik
ac7d80980d
remove unused services (#8334) 2024-03-15 14:11:16 +00:00
Matt Gibson
770f782a16
Use global state for biometric prompt cancel storage (#8328)
* Fix error on close due to context differences in background

Desktop background does not have active user information. Also, we want to delete _all_ prompt cancelled data, not just that for the active user. Storing this on global and manipulating observables to active achieves this without needing any user information in the background.

* Remove potentially orphaned data

* Throw nice error if prompt cancelled used without active user

* Register migration
2024-03-15 09:07:22 -04:00
Justin Baur
1e921eb4f6
getUserState$ Helper Improvements (#8267)
* Block Sending Null to `getUser`

* Update Comments & Tests

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Update Comment

* Update Fake

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2024-03-15 09:05:04 -04:00
Matt Gibson
e9a34ac5b8
Fix and test hasUserKey implementation (#8336) 2024-03-14 20:59:30 -04:00
Thomas Rittson
5506842623
[AC-2171] Member modal - limit admin access - editing self (#8299)
* If editing your own member modal, you cannot add new collections or groups
  * Update forms to prevent this
  * Add helper text
* Delete unused api method
2024-03-15 09:33:15 +10:00
Justin Baur
1d76e80afb
Refactor State Providers (#8273)
* Delete A Lot Of Code

* Fix Tests

* Create SingleUserState Provider Once

* Update Manual Instantiations

* Fix Service Factory

* Delete More

* Delete Unused `updatePromise`

* `postStorageSave` -> `doStorageSave`

* Update Comment

* Fix jslib-services
2024-03-14 16:38:22 -05:00
Jonathan Prusik
4f8fa57b9d
fix default value for autoCopyTotp (#8287) 2024-03-14 20:34:07 +00:00
rr-bw
65b7ca7177
[PM-5266] Create Avatar Service (#7905)
* rename file, move, and update imports

* refactor and implement StateProvider

* remove comments

* add migration

* use 'disk-local' for web

* add JSDoc comments

* move AvatarService before SyncService

* create factory

* replace old method with observable in story

* fix tests

* add tests for migration

* receive most recent avatarColor emission

* move logic to component

* fix CLI dependency

* remove BehaviorSubject

* cleanup

* use UserKeyDefinition

* avoid extra write

* convert to observable

* fix tests
2024-03-14 09:56:48 -07:00
SmithThe4th
ebf51ebaaf
[PM-5433] Migrate Showcards and Showidentities on current tab to state provider (#8252)
* added showCards and Identities to vault settings and then added migration file

* added migration file and removed fields from domain

* fixed merge conflicts
2024-03-14 11:37:57 -04:00
Matt Gibson
d28634b068
Log key when no active user found (#8326) 2024-03-13 17:21:33 -04:00
Matt Gibson
25f89e2a1c
[PM-6769] [SM-1158] Fix Translation pipe issues on main (#8319)
* Require init in i18n service.

this is needed to load translations and set translation locale

* No longer need to cast i18n

* Expose user preferred locale in i18nService

This is for correctly displaying `default` when no locale has been set in preferences components. The `locale$` observable should always resolve to the currently locale currently being translated to.
2024-03-13 11:35:46 -04:00
Justin Baur
e6fe0d1d13
[PM-5539] Migrate ThemingService (#8219)
* Update ThemingService

* Finish ThemingService

* Lint

* More Tests & Docs

* Refactor to ThemeStateService

* Rename File

* Fix Import

* Remove `type` added to imports

* Update InitServices

* Fix Test

* Remove Unreferenced Code

* Remove Unneeded Null Check

* Add Ticket Link

* Add Back THEMING_DISK

* Fix Desktop

* Create SYSTEM_THEME_OBSERVABLE

* Fix Browser Injection

* Update Desktop Manual Access

* Fix Default Theme

* Update Test
2024-03-13 15:25:39 +00:00
Thomas Rittson
29b5643310
[AC-2278] [BEEEP] Typesafe Angular DI (#8206)
Use SafeProvider as a factory for all our providers to ensure
that the DI token, implementation, and deps all match.

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2024-03-12 18:21:57 -05:00
Justin Baur
8f8385d822
Reorder import (#8313) 2024-03-12 17:38:28 -05:00
Justin Baur
3175b20ca5
Add UserKeyDefinition to union (#8298) 2024-03-12 21:10:01 +00:00
Jonathan Prusik
31d37a817c
fix cipher service factory not using domain settings service correctly (#8312) 2024-03-12 17:00:51 -04:00
Jonathan Prusik
0a595ea95e
[PM-5562] Implement Domain Settings state provider (#8226)
* create domain settings state provider

* replace callsites for defaultUriMatch and neverDomains with DomainSettingsService equivalents

* replace callsites for equivalentDomains with DomainSettingsService equivalents and clean up unused AccountSettingsSettings

* add migrations for domain settings state

* do not use enum for URI match strategy constants and types

* add getUrlEquivalentDomains test

* PR suggestions/cleanup

* refactor getUrlEquivalentDomains to return an observable

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by:  Audrey  <ajensen@bitwarden.com>

* update tests

* add UriMatchStrategy docs notes

* service class renames

* use service abstraction at callsites previously using service class directly

---------

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by:  Audrey  <ajensen@bitwarden.com>
2024-03-12 15:07:14 -04:00
Jake Fink
a0e0637bb6
[PM-5255, PM-3339] Refactor login strategy to use state providers (#7821)
* add key definition and StrategyData classes

* use state providers for login strategies

* serialize login data for cache

* use state providers for auth request notification

* fix registrations

* add docs to abstraction

* fix sso strategy

* fix password login strategy tests

* fix base login strategy tests

* fix user api login strategy tests

* PM-3339 add tests for admin auth request in sso strategy

* fix auth request login strategy tests

* fix webauthn login strategy tests

* create login strategy state

* use barrel file in common/spec

* test login strategy cache deserialization

* use global state provider

* add test for login strategy service

* fix auth request storage

* add recursive prototype checking and json deserializers to nested objects

* fix CLI

* Create wrapper for login strategy cache

* use behavior subjects in strategies instead of global state

* rename userApi to userApiKey

* pr feedback

* fix tests

* fix deserialization tests

* fix tests

---------

Co-authored-by: rr-bw <102181210+rr-bw@users.noreply.github.com>
2024-03-12 14:19:50 -04:00
rr-bw
790b310d22
[PM-5270] Update PasswordResetEnrollmentService to take dependency on AccountService (#8080)
* take dependency on AccountService

* update test
2024-03-12 10:11:42 -07:00
Matt Gibson
ddac10136f
Fix missed service dependency changes (#8305) 2024-03-12 17:12:12 +01:00
Matt Gibson
5feb9af051
[PM-6654] new app id service for angular (#8229)
* Improve state documentation

* Add namespace for application id

* Spec out behavior of app id service

* Use state providers for app ids

* Migrate app Id

* Add reactive interface
2024-03-12 11:12:40 -04:00
Matt Gibson
f4150ffda6
[PM-6511] New i18n for angular (#8122)
* Use state provider to store preferred language

* migrate preferred language

* Use new i18n provider to get LOCAL_ID

* Fix preloaded english i18n

This is a mock service that forces english translations, it doesn't need the i18n interface that allows changing of locales.

* PR improvements

* Fixup merge
2024-03-11 13:59:19 -04:00
Will Martin
d66365fd53
[CL-206] update bit-nav components to active match query params (#8242)
* remove exactMatch input in favor of routerLinkActiveOptions
2024-03-11 11:22:04 -04:00
aj-rosado
7b7a442e4d
[PM-6147]Using reactive methods on SendAddEditComponent load (#8013)
* Using SendService get$ on SendAddEditComponent load

* Calling reactive method on loadSend

* Improved code quality on send add edit

* removed unnecessary patch value

* Improved error message on send add-edit.component

* Add comment regarding promise.reject completing the BehaviourSubject

* Corrected send null validation
2024-03-08 16:25:23 +00:00
Justin Baur
a803b67f4f
Consider Higher StateVersion "ready" (#8255) 2024-03-08 10:54:12 -05:00
Jonathan Prusik
f90de62adc
[PM-6382] Migrate disableContextMenuItem to Autofill Settings state (#8246)
* add enableContextMenu to autofillSettings and migrate disableContextMenuItem

* replace usages of disableContextMenuItem with autofill settings service global enableContextMenu
2024-03-08 15:34:07 +00:00
Matt Gibson
f83dcf2b24
Move fingerprint validated to biometric state povider (#8058) 2024-03-07 19:41:56 -06:00
Thomas Rittson
eedd6f0881
[AC-2008] [AC-2123] [Pt 2] Transition PolicyService to use StateProvider (#7977)
* fully wire up StateProvider within PolicyService
* migrate old policy data to new location
* minor update to existing interfaces
2024-03-08 10:26:00 +10:00
✨ Audrey ✨
c7318311af
[PM-5974] introduce ForwarderGeneratorStrategy (#8207)
* update defaults to include `website` parameter
* update utilities tests to include `website` parameter
2024-03-07 12:45:56 -05:00
Jonathan Prusik
c52456cbb6
[AC-2248][PM-5352] Bugfix - Fix non-working policy state in autofill settings service (#8156)
* fix broken policy state in autofill settings service

* cleanup and re-org

* move toast display tracking value and update to autofill settings state
2024-03-06 16:07:46 -05:00
Matt Gibson
c14091904b
Propose team as a first pass organization to state definitions (#8225) 2024-03-06 17:48:28 +00:00
rr-bw
b3e4ecc568
[PM-3388] AnonLayout Component (#6424)
* setup anon-layout component

* add story with content

* simplify stories and add title input

* add responsiveness

* adjust border styling

* add logo

* add logo

* mock PlatformUtilsService

* more responsivness

* add secondary content

* add stories and clarifying comments

* add more to responsiveness

* Update libs/components/tailwind.config.js

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* Update libs/components/tailwind.config.base.js

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* Update libs/auth/src/components/anon-layout.stories.ts

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* refactor: use bit-icon instead of css file, add auth- prefix, adjust tailwind settings

* account for longer content

* allow for adding an icon above logo

* simplify stories by removing unnecessary styling

* delete duplicate logo and minify logo and icon

* remove componentWrapperDecorator

* change subTitle to subtitle

* use bitTypography

* add accessibility title and use tw class for fill color

* add <title> element to SVG

* typography update and minor styling updates for stories

* match breakpoint for logo and h1

* reduce spacing between sections

* move to new folder

* add closing tag

* make fields protected

* use svg directly

* refactor icons

* revert to allow for additional icons in the future

* decouple icon from component

---------

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
2024-03-06 09:32:50 -08:00
Merissa Weinstein
5dcc035245
[PM-4882] Passkeys: funnel rp name or id to the cipher name on save (#7969)
* funnel rp name or id to the cipher name on save

* remove comment

* add rp name and id to addCipher function

---------

Co-authored-by: Merissa Weinstein <merissaweinstein@merissas-mbp-2.lan>
2024-03-06 11:30:12 -06:00
Shane Melton
940fd21ac4
[PM-6645] Update canAccessOrgAdmin helper to consider disabled organizations and owners explicitly (#8220) 2024-03-06 08:03:52 -08:00
Jason Ng
e2a543506a
PM-6558 Vault Onboarding Extension Check on Install (#8216)
updated browser runtime background to send hasBWInstalled message on installation
2024-03-06 10:48:27 -05:00
Addison Beck
101e1a4f2b
Migrate provider service to state provider (#8173)
* Migrate existing provider data to StateProvider

Migrate existing provider data to StateProvider

* Rework the ProviderService to call StateProvider

* Unit test the ProviderService

* Update DI to reflect ProviderService's new args

* Add ProviderService to logout chains across products

* Remove provider related stateService methods

* Update libs/common/src/state-migrations/migrations/28-move-provider-state-to-state-provider.spec.ts

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>

* Cover up a copy/paste job

* Compare equality over entire array in a test

---------

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
2024-03-05 19:35:12 +00:00
Justin Baur
c9b5125f74
Include Storage Location In Fake Cache Key (#8203) 2024-03-05 12:30:40 -05:00
Justin Baur
c3eba7f2c8
[PM-6404] Fully Integrate clearOn Events (#8134)
* Add New KeyDefinitionOption

* Add New Services

* Add WebStorageServiceProvider Tests

* Update Error Message

* Add `UserKeyDefinition`

* Fix Deserialization Helpers

* Fix KeyDefinition

* Add `UserKeyDefinition`

* Fix Deserialization Helpers

* Fix KeyDefinition

* Move `ClearEvent`

* Cleanup

* Fix Imports

* Integrate onClear Events

* Remove Accidental Addition

* Fix Test

* Add VaultTimeoutService Tests

* Only Register When Current State is Null

* Address Feedback
2024-03-04 20:33:25 +00:00
Jonathan Prusik
4ba2717eb4
[PM-5559] Implement User Notification Settings state provider (#8032)
* create user notification settings state provider

* replace state service get/set disableAddLoginNotification and disableChangedPasswordNotification with user notification settings service equivalents

* migrate disableAddLoginNotification and disableChangedPasswordNotification global settings to user notification settings state provider

* add content script messaging the background for enableChangedPasswordPrompt setting

* Implementing feedback to provide on PR

* Implementing feedback to provide on PR

* PR suggestions cleanup

---------

Co-authored-by: Cesar Gonzalez <cgonzalez@bitwarden.com>
2024-03-04 14:12:23 -05:00
✨ Audrey ✨
d87a8f9271
[PM-6523] generator service tuning (#8155)
* rename policy$ to evaluator$
* replace `ActiveUserState` with `SingleUserState`
* implement `SingleUserState<T>` on `SecretState`
2024-03-04 13:43:38 -05:00
Matt Gibson
b691b6b1d6
[PM-6484] Revert "[PM-5277] Migrate Sync Service to State Provider (#7680)" (#8157)
* Revert "[PM-5277] Migrate Sync Service to State Provider (#7680)"

This reverts commit 78008a9e1e.

Includes a noop migration builder that allows us to bridge over the deleted migration

* Prefer revert migrations to noop

this revert avoids the need to change behavior between released vs unreleased migrations and keeps some dangerous code out of the repo :success:

* Update ordering of badge settings migrator to be consistent with `rc`, which was cut with only up to version 25

* Fix missing type import
2024-03-04 09:34:22 -05:00
Thomas Rittson
ad21a1d160
[AC-2249] Remove StateService from PolicyApiService (#8106)
This was unused.
2024-03-01 15:59:45 -06:00
Victoria League
f95ff93a71
[CL-181] Fix toggle group badge alignment (#8167) 2024-03-01 16:17:24 -05:00
Matt Gibson
5677d6265e
Ps/pm 5537/move biometric unlock to state providers (#8099)
* Establish biometric unlock enabled in state providers

* Use biometric state service for biometric state values

* Migrate biometricUnlock

* Fixup Dependencies

* linter and import fixes

* Fix injection

* Fix merge

* Use boolean constructor as mapper

* Conform to documented test naming conventions

* Commit documentation suggestion

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

* Fix merge commit

* Fix test names

---------

Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
2024-03-01 10:17:06 -05:00
Andreas Coroiu
7bbde647f4
[PM-5725] New passkeys should always return 0 as counter value (#8024)
* [PM-5725] feat: do not increment counter if is zero

* [PM-5725] feat: skip save to server when counter is 0
2024-03-01 13:58:55 +00:00
Victoria League
8d528c2d4a
[CL-170] Fix size of radio group legend (#8154) 2024-02-29 15:21:39 -05:00
Will Martin
323d86850a
[CL-203] fix select options position (#8151)
* add relative to body

* remove scrollbar positon hack
2024-02-29 11:35:13 -05:00
Alex Morask
7cfe862aa6
[PM-5971] Fix Payment Method Warning Bugs (#7923)
* Rework implementation of payment method warnings

* Move payment-method-warnings.component to module

* Moved timer/subscribe to app.component

* Remove unrelated refactoring

* Remaining feedback

* Add paymentMethodWarningsService tests

* Thomas' feedback

* fix tests

* Use barrel file imports

* Make banner work with new vault navigation

* Matt's feedback
2024-02-29 08:18:47 -05:00
Matt Gibson
ea0f5fa771
Fix clear keys state logic (#8143)
* Fix clear keys state logic

Disk state should only be cleared if memory only is not specified.

* Remove unnecessary zip from testing
2024-02-28 14:14:07 -05:00
Jonathan Prusik
5443ea2232
fix migration rollbacks (#8124) 2024-02-28 10:31:21 -05:00
Justin Baur
87c75e5ac8
[PM-6404] Initial Clear Events Code (#8029)
* Add New KeyDefinitionOption

* Add New Services

* Add WebStorageServiceProvider Tests

* Update Error Message

* Add `UserKeyDefinition`

* Fix Deserialization Helpers

* Fix KeyDefinition

* Add `UserKeyDefinition`

* Fix Deserialization Helpers

* Fix KeyDefinition

* Move `ClearEvent`

* Cleanup

* Fix Imports

* Remove `updateMock`

* Call Super in Web Implementation

* Use Better Type to Avoid Casting

* Better Error Docs

* Move StorageKey Creation to Function

* Throw Aggregated Error for Failures
2024-02-27 21:58:31 +00:00
Jonathan Prusik
929b5ebec3
[PM-5568] Implement Badge Settings state provider (#8112)
* create badge settings state provider

* replace state service get/set disableBadgeCounter with badge settings service equivalent

* migrate disableBadgeCounter account setting to badge settings state provider

* cleanup and address PR suggestions
2024-02-27 21:03:12 +00:00
✨ Audrey ✨
36116bddda
[PM-5614] introduce SecretState wrapper (#7823)
Matt provided a ton of help on getting the state interactions right. Both he 
and Justin collaborated with me to write the core of of the secret classifier.

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
2024-02-27 11:40:32 -05:00
Jake Fink
5a1f09a568
[PM-5499] Use public key for approving auth requests (#8110)
* change key check to public key check

* use public key for encryption

* fix tests
2024-02-27 11:28:50 -05:00
Thomas Rittson
0a5c9d3525
[AC-2008] [AC-2122] [Pt 1] Transition PolicyService to use StateProvider (#7959)
* Delete unnecessary StateDefinition

* Add StateProvider to PolicyService

* Add new getters using StateProvider (not exposed or used yet)
2024-02-27 08:51:10 +10:00
Alex Morask
f53af7c466
[AC-1863] Send initiationPath on organization or user signup (#7747)
* Sent initiation path for organization and user signups

* Rename organizationQueryParameter > organizationTypeQueryParameter

* Jared's feedback

* Split PM & SM initiation path
2024-02-26 14:20:11 -05:00
Justin Baur
632598d804
[PM-6404] Add UserKeyDefinition (#8052)
* Add `UserKeyDefinition`

* Fix Deserialization Helpers

* Fix KeyDefinition

* Move `ClearEvent`

* Address PR Feedback

* Feedback
2024-02-26 11:28:40 -05:00
Jake Fink
1435203e12
[PM-5499] Create Auth Request Service (#8056)
* create auth request service

* copy methods from auth crypto service

* register new auth request service

* remove refs to auth request crypto service

* remove auth request crypto service

* remove passwordless login method from login strategy service

* add docs to auth request service
2024-02-26 10:07:08 -05:00
Justin Baur
d02651583f
Extend Cleanup Delay (#8076) 2024-02-26 14:20:15 +00:00
aj-rosado
d0aea28f0a
Checking if hideEmail control is enabled before trying to deactivate it on Sends (#8041) 2024-02-26 11:59:50 +00:00
Jonathan Prusik
44bda82bc4
revert to old secrets masking behaviour in browser cipher edit view (#8018) 2024-02-23 17:40:27 -05:00
Jonathan Prusik
34a8d9af86
[PM-6383] Migrate clearClipboard account setting to autofill settings service (#8022)
* migrate clearClipboard account setting to autofill settings state provider

* replace state service get/set clearClipboard with autofill settings service equivalents

* PR suggestions cleanup
2024-02-23 13:52:13 -05:00
Cesar Gonzalez
38e40a0471
[PM-5697] Capture all form data from page when selecting "New item" within the inline menu even if popout is already open (#7773)
* [PM-5679] Capture all form data from page when selecting "New item" even if popout is already open

* [PM-5679] Capture all form data from page when selecting "New item" even if popout is already open

* [PM-5697] Fixing floating promise within the handleExtensionMessage method
2024-02-23 18:27:25 +00:00
Robyn MacCallum
8ab4eecc8a
[SM-1065] SmOnboarding state provider (#8037)
* Create state definition

* Create SmOnboardingTaskService

* Replace usage of stateService value with state new state provider

* Migrate old state values to state provider

* Fix injection of SmOnboardingTasksService

* Remove smOnboardingTasks from state

* Fix state provider imports

* Fix migration after merge from main

* Move null handling to SMOnboardingTasksService
2024-02-23 13:16:42 -05:00
Shane Melton
dee0b20554
[AC-2195] Fixes for FC V1 for Custom Users (#8034)
* [AC-2195] Update canEditAnyCipher permission to make an exception for Custom users with editAnyCollection permission

* [AC-2195] Update V1 FC flag check to include check for an organization's FC status

* [AC-2195] Remove redundant collection management setting check that was hiding the restricted access message for custom users with deleteAnyCollection

* [AC-2195] Ensure users with canEditAnyCollections can edit all collections
2024-02-23 10:01:25 -08:00
Oscar Hinton
38d8fbdb5a
Vertical Vault Navigation (#6957)
* WIP admin console layout

* Update icons

* Migrate more things

* Migrate the last pages

* Move header to web

* Fix story not working

* Convert header component to standalone

* Migrate org layout to standalone

* Enable org switcher

* Add AC to product switcher

* Migrate provider portal to vertical nav

* Migrate PM

* Prettier fixes

* Change AC and PP to use secondary variant layout & update logos

* Remove full width setting

* Remove commented code

* Add header to report pages

* Add provider portal banner

* Fix banner for billing pages

* Move vault title to header

* Prevent scrollbar jumping

* Move send button to header

* Replace search input with bit-search

* Remove unused files and css

* Add banner

* Tweak storage option

* Fix duplicate nav item after merge

* Migrate banner state to state provider framework

* [AC-2078] Fix device approvals header

* [PM-5861] Hide AC from product switcher for users that do not have access

* [PM-5860] Fix Vault and Send page headers

* [AC-2075] Fix missing link on reporting nav group

* [AC-2079] Hide Payment Method and Billing History pages for self-hosted instances

* [AC-2090] Hide reports/event log nav items for users that do not have permission

* [AC-2092] Fix missing provider portal option in product switcher on page load

* Add null check for organization in org layout component

* [AC-2094] Fix missing page header for new client orgs page

* [AC-2093] Update New client button styling

* Fix failing test after merge

* [PM-2087] Use disk-local for web layout banner

* [PM-6041] Update banner copy to read "web app"

* [PM-6094] Update banner link to marketing URL

* [PM-6114] add CL container component to VVR pages (#7802)

* create bit-container component

* add container to all page components

* Fix linting errors after merge with main

* Fix product switcher stories

* Fix web-header stories

* mock org state properly in product switcher stories (#7956)

* refactor: move web layout migration banner logic into a service (#7958)

* make CL codeowner of web header files

* move migration banner logic to service; update stories

* [PM-5862] Ensure a sync has run before hiding navigation links

* Remove leftover banner global state

* Re-add dropped selfHosted ngIf

* Add rel noreferrer

* Remove comment

---------

Co-authored-by: Shane Melton <smelton@bitwarden.com>
Co-authored-by: Will Martin <contact@willmartian.com>
2024-02-23 09:22:45 -08:00
Will Martin
43d1174a06
[CL-169] add bit-section component (#8062) 2024-02-23 10:51:17 -05:00
Matt Gibson
9775e77079
[PM-5537] Migrate Biometric Prompts (#7771)
* Fix nextMock arguments

* Add state for biometric prompts

* Use biometric state for prompts

* Migrate biometric prompt data

* wire up biometric state to logouts

* Add migrator to migrate list

* Remove usages of prompt automatically

Explicitly list non-nulled state as intentional

* `npm run prettier` 🤖

* Fix web lock component
2024-02-23 09:21:18 -05:00
Jake Fink
19a373d87e
[PM-6211] Create key generation service (#7939)
* create key generation service

* replace old key generation service and add references

* use key generation service in key connector service

* use key generation service in send service

* user key generation service in access service

* use key generation service in device trust service

* fix tests

* fix browser

* add createKeyFromMaterial and tests

* create ephemeral key

* fix tests

* rename method and add returns docs

* ignore material in destructure

* modify test

* specify material as key material

* pull out magic strings to properties

* make salt optional and generate if not provided

* fix test

* fix parameters

* update docs to include link to HKDF rfc
2024-02-23 08:48:15 -05:00
Oscar Hinton
a553704f28
Add support for removing values in migration helper (#8057) 2024-02-22 16:21:39 -06:00
Matt Gibson
56bffb04bb
Ps/pm 5533/migrate decrypted user key (#7970)
* Move user key memory state to state providers

Note: state service observable change is because these updates are no longer internal to the class, but reporter directly to account service through crypto service on update of a user key

* remove decrypted user key state

Note, we're going to move the encrypted cryptoSymmetric key (and associated master key encrypted user keys)  as part of the master key service creation. Crypto service will no longer be responsible for the encrypted forms of user key.

* Deprecate notices belong on abstraction

* Allow for single-direction status updates

This is necessary since we don't want to have to guarantee that the update to logged out occurs after the update to locked.

* Remove deprecated subject

It turns out the set for cryptoMasterKey was also unused 🎉
2024-02-22 15:07:26 -05:00
aj-rosado
f9539ef68b
Calling processFolder method when adding ciphers on PsonoJsonImporter (#7984) 2024-02-22 17:51:44 +00:00
Cesar Gonzalez
7629652a47
[PM-5887] Refactor WebCryptoFunction to Remove Usage of the window Object in the Background Script (#7749) 2024-02-21 15:51:02 +00:00
Jason Ng
0576bd9f2c
PM-5955 Multiple Badges Overlap With Permissions Column (#7843)
* update badge components so multiple badges to do not overlap with permissions column in collections
2024-02-20 12:08:39 -05:00
Kai
e823c27c8d
Only GetGlobals when we actually need them (#7855)
Since we only need it as a backup if accountVaultTimeoutAction is
null/undefined, there should be no need to call this function every time.

While the overhead may seem trivial at first glance, it can add up to a
massive increase in runtime when the function is called repeatedly in
quick succession (e.g. when running `bw list items` where it is executed
once for every item).

In my concrete case this change leads to a 20x speedup.
2024-02-20 15:51:32 +01:00
Will Martin
d4968bb225
[CL-166] add title and subtitle inputs to bit-dialog (#7597) 2024-02-19 11:03:24 -05:00
Will Martin
cbcd5d9747
[CL-192][CL-193] fix virtual scroll (#7986)
* [CL-192] use sticky sidebar instead of static; remove main screen height

* [CL-193] patch cdk dialog scroll block
2024-02-19 08:52:42 -05:00
Alex Morask
1f8e6ea6f8
Use split endpoint names for FF 'AC-1607_present-user-offboarding-survey' (#7983) 2024-02-16 13:38:10 -05:00
SmithThe4th
5b652092cd
[PM-5272] Migrate CollapsedGroupings to State Provider (#7954) 2024-02-16 12:53:24 -05:00
Andreas Coroiu
b0dd64bab4
[PM-4756] [PM-4755] Add BE and BS flags, and credProps (#7947)
* [PM-4756] feat: set BE and BS flags

* [PM-4755] feat: add support for credProps.rk

* [PM-4755] feat: add extension support to page-script object mapping
2024-02-16 10:55:51 +01:00
Oscar Hinton
02dde0c0d3
[PM-6328] Checkmarx - Resolve warnings (#7941) 2024-02-15 16:25:53 -05:00
Matt Gibson
c8c1ed42ba
[PM-5537] Remove Unecessary Biometric State (#7762)
* Create state for biometric client key halves

* Move enc string util to central utils

* Provide biometric state through service

* Use biometric state to track client key half

* Create migration for client key half

* Ensure client key half is removed on logout

* Remove account data for client key half

* Remove unnecessary key definition likes

* Remove moved state from account

* Fix null-conditional operator failure

* Simplify migration

* Remove lame test

* Fix test type

* Add migrator

* Remove state that is never read.

* Remove unnecessary biometric state

We don't need to determine platform in desktop background, it can be done in the UI at any time.

* Fix merge

* Use platform utils to identify OS desktop type
2024-02-15 15:29:29 -05:00
Todd Martin
7c37ce117c
[PM-6241] Remove unused entityId and entityType state (#7899)
* Removed unused entityId and entityType state

* Removed from interface.

* Removed unused state from AccountProfile.
2024-02-14 23:06:56 +00:00
Jake Fink
6562875a23
[PM-6302, PM-6303] Add duo state and connector message on browser/desktop (#7957)
* pass state for clients

* use redirect connector to set cookie with translations

* simplify duo redirect url validation
2024-02-14 18:00:38 -05:00
Jason Ng
3edf098aaf
PM-5274 Migrate Collection Service State (#7732)
* update collection service to use new state provider framework, remove stateservice from collection service, update collections state provider with migrate file and unit test
2024-02-14 17:03:03 -05:00
Matt Gibson
d8b74b78da
[PM-5533] Migrate Asymmetric User Keys to State Providers (#7665) 2024-02-14 15:04:08 -05:00
Matt Gibson
7a6d7b3a68
Include missing migration (#7840)
This migration missing from #7825 does not suggest missing data since no client has been released in the interim.
2024-02-14 14:25:08 -05:00
Justin Baur
1ff7bdd014
[PM-6172] Run localStorage migrations for web (#7900)
* Create MigrationRunner

- Create MigrationRunner Service for running migrations in StateService
- Create web override so that migrations also run against `localStorage`

* Fix Web StateService

* Fix WebMigrationRunner

* Fix CLI

* Fix ElectronStateService

* Update Comment

* More Common Scenarios
2024-02-14 08:52:13 -05:00
Shane Melton
2a9d396a01
[PM-5757] Update local collection data when a collection is updated (#7940)
* [PM-5757] Update local data when a collection is updated

* [PM-5757] Use defer() for collections re-evaluate the promise on refresh$
2024-02-13 13:04:13 -08:00
Matt Gibson
f0ae318f57
Link derived state fake to parent observable. (#7922) 2024-02-13 15:26:56 -05:00
Daniel James Smith
9980c3feb9
[PM-5459] Move libs/exporter to libs/tools/ (#7380)
* Move libs/exporter into libs/tools/*

Migrating all files from libs/exporter over to libs/tools/export/vault-export/vault-export-core
Rename package to vault-export-core
Fix all file paths

* Update libs and tsconfig imports

* Fix client imports

* Fix eslint, jest and package-lock.json

* Update CODEOWNERS

* Add README.md to whitelist-capital-letters

* Fix vault-export-service tests not running

* Update libs/tools/export/vault-export/README.md

Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>

* Fix types imports

* Export types from vault-export-core

* Fixed content of README

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
2024-02-13 14:22:37 -05:00
Thomas Rittson
c8b04729cb
Add NotificationType.SyncOrganizations (#7924) 2024-02-13 18:15:52 +00:00
Todd Martin
bdc951194e
[PM-5800] Remove passwordless-login feature flag (#7626)
* Removed passwordless-login feature flag

* Removed conditional on login component.

* Added back reference accidentally deleted.

* Fixed initialization of the service in tests.

* Removed unused private variable.

* Updated DI to remove configService

* Undid changes to workspace file.

* Undid all changes to workspace file

* Undid merge changes to collection dialog

* Linting
2024-02-13 11:15:16 -05:00
Addison Beck
a9297af2d3
Add a key definition for providers (#7915) 2024-02-13 12:27:52 +00:00
Jonathan Prusik
c65e92f769
[PM-5560] Implement Autofill Settings state provider (#7767)
* Begin migration of autofill settings

Co-authored-by: Cesar Gonzalez <cagonzalezcs@users.noreply.github.com>
Co-authored-by: Thomas Avery <Thomas-Avery@users.noreply.github.com>
Co-authored-by: Jonathan Prusik <jprusik@users.noreply.github.com>
Co-authored-by: Colton Hurst <coltonhurst@users.noreply.github.com>

* add browser dependency for AutofillSettingsService

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* update autofill settings service

* replace usages of stateService get/set autofillOnPageLoad with autofillSettingsService

* replace usages of stateService get/set autofillOnPageLoadDefault with autofillSettingsService

* replace usages of stateService get/set autoCopyTotp with autofillSettingsService

* replace usages of stateService get/set autoFillOnPageLoadCalloutIsDismissed with autofillSettingsService

* replace usages of stateService get/set activateAutoFillOnPageLoadFromPolicy with autofillSettingsService

* replace usages of get/set autoFillOverlayVisibility with autofillSettingsService

* inlineMenuVisibility should use global state

* add the AutofillSettingsService to background scripts

* fix typing

* replace additional usages of get/set autoFillOverlayVisibility and disableAutoTotpCopy with autofillSettingsService equivalents

* replace additional usages of get/set autofillOnPageLoadDefault with autofillSettingsService equivalent

* replace additional usages of get/set activateAutoFillOnPageLoadFromPolicy with autofillSettingsService equivalent

* remove additional deprecated and unused state service calls

* improve naming conventions and consistency

* fix missing mock for policy service test

* replace missing overlay background tests

* cleanup

* fix double inversion

* fix reference to wrong setter

* move handleActivateAutofillPolicy out of BrowserPolicyService

* create state migration script

* resolve linting issues

* remove migrated setting properties

* add AutofillSettingsSErvice to jslib-services

* handle conditional content script loading via autofillOnPageLoad check

* add deprecated note to getFromLocalStorage

* add jsdoc decorators to new autofill service methods

* handle undefined globalState

* move autofill settings out of BrowserPolicyService

* Move autofill settings code out of policyService

* fix tests

* fix typo in state definition

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Cesar Gonzalez <cagonzalezcs@users.noreply.github.com>
Co-authored-by: Thomas Avery <Thomas-Avery@users.noreply.github.com>
Co-authored-by: Colton Hurst <coltonhurst@users.noreply.github.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
2024-02-12 17:11:04 -05:00
Jason Ng
fd8c26601a
PM-3231 Vault Onboarding Part 1 (#6905)
* Onboarding Component moved to web for sharing. Vault Onboarding Component created for new users. Still behind feature flag.
2024-02-12 11:43:43 -05:00
Jake Fink
f786c8ce93
clear ever had user key for logged out user instead of active (#7911) 2024-02-12 11:12:35 -05:00
Oscar Hinton
6b12968721
[PM-5820] Upgrade angular to 16 (#7638)
Upgrade Angular and related dependencies to v16.
2024-02-12 17:00:41 +01:00
✨ Audrey ✨
eafe3dec67
[PM-5973] add catchall generation strategy (#7898) 2024-02-12 10:27:47 -05:00
✨ Audrey ✨
c41dce8c63
[PM-5972] add subaddress generator strategy (#7897) 2024-02-12 09:20:55 -05:00
aj-rosado
7d47f1496c
[PM-6072] Add get$ method on SendService (#7839)
* Added missing get$ method on SendService

* Added distinctUntilChanged to the get$ method and added more tests

* Added more validations and tests to get$

* Added some more test cases to get$

* Refactored test cases from get$
2024-02-09 18:27:50 +00:00
Alex Morask
b239e3736f
[AC-1607] Add offboarding survey to subscription pages (#7809)
* Add offboarding survey to subscription pages

* Cleaning up unused code

* Removing unused eslint suppression

* Product updates

* Jared's feedback
2024-02-09 12:08:46 -05:00
✨ Audrey ✨
64381cbae0
check credential type explicitly when loading evaluator (#7791) 2024-02-09 11:33:52 -05:00
Joseph Yu
bb031f6779
[PM-2311] Allow empty passphrase separator (#5473)
* Change passphrase generator's default wordSeparator to the empty string ''
* Create DefaultPassphraseGenerationOptions
* Use DefaultPassphraseGenerationOptions.wordSeparator in passphrase generation
* Add `empty` separator option to passphrase generator CLI and an example
* Change DefaultPassphraseGenerationOptions numWords to 3
* Use `DefaultPassphraseGenerationOptions.numWords` in CLI passphrase gen
2024-02-09 11:07:53 -05:00
Shane Melton
5c6245aaae
[AC-1124] Restrict admins from accessing items in the Collections tab (#7537)
* [AC-1124] Add getManyFromApiForOrganization to cipher.service.ts

* [AC-1124] Use getManyFromApiForOrganization when a user does not have access to all ciphers

* [AC-1124] Vault changes
- Show new collection access restricted view
- Include unassigned ciphers for restricted admins
- Restrict collections when creating/cloning/editing ciphers

* [AC-1124] Update edit cipher on page navigation to check if user can access the cipher

* [AC-1124] Hide ciphers from restricted collections

* [AC-1124] Ensure providers are not shown collection access restricted view

* [AC-1124] Modify add-edit component to call the correct endpoint when a restricted admin attempts to add-edit a cipher

* [AC-1124] Fix bug after merge with main

* [AC-1124] Use private this._organization

* [AC-1124] Fix broken builds
2024-02-08 14:07:42 -08:00
Will Martin
64b1772bfd
exclude CL popover story from Chromatic (#7862) 2024-02-08 21:01:35 +01:00
Matt Gibson
4c051f8d7f
ActiveUserState Update should return the userId of the impacted user. (#7869)
This allows us to ensure that linked updates all go to the same user without risking active account changes in the middle of an operation.
2024-02-08 14:54:15 -05:00
Matt Gibson
b0edcb81af
Ps/run-foreground-derived-state-in-zone (#7861)
* Sync derived state through memory storage

* Run foreground derived state in NgZone

* fix tests
2024-02-08 14:04:38 -05:00
Jake Fink
304c492f24
[PM-5364] Create SSO Login Service and add state ownership (#7485)
* create sso service

* rename sso service to sso-login service

* rename service

* add references to sso login service and update state calls

* fix browser

* fix desktop

* return promises

* remove sso state from account and global objects

* more descriptive org sso identifier method names

* fix sso tests

* fix tests
2024-02-08 12:44:35 -05:00
Matt Gibson
2525a3707f
Prefer get methods to return single user states unless specified active (#7834)
* Prefer get methods to return single user states unless specified active

* Improve comment
2024-02-08 12:02:48 -05:00
Daniel García
4be25e3df3
[PM-3756] Disable node integration and enable context isolation in desktop (#6975)
* Disable node integration and enable context isolation

* Review comments

* Log in renderer through IPC

* Missed imports

* Mock electron API

* resourcesPath is undefined in the preload, but process.windowsStore works correctly

* Replace fromBufferToUtf8 conditional implementation for the `buffer` package

The current non-node implementation is different than the node implementation,
as the non-node would break when the contents can't be parsed as a URI component.
Replacing the impl by the `buffer` package makes the result match in both environments.

* Fix lint

* Add some more tests

* Remove buffer from devDependencies
2024-02-08 18:00:19 +01:00
Will Martin
070d8556cf
[CL-179][PM-6011] open parent bit-nav-groups when bit-nav-item becomes active (#7801)
* add routing to nav-group stories

* open parent nav group when active
2024-02-08 10:35:13 -05:00
Matt Gibson
3371760779
Add derive option to clear state after cleanup (#7852)
Co-authored-by: Thomas Rittson <eliykat@users.noreply.github.com>
2024-02-07 20:33:28 -05:00
✨ Audrey ✨
6d79231476
[PM-5610] add eff long word list generator (#7748) 2024-02-07 13:24:32 -05:00
Addison Beck
82cb52a938
Properly set up StateProvider dependency for OrganizationService (#7841) 2024-02-07 10:28:14 -06:00
Matt Gibson
2ca34b46db
[PM-5537] Persist require password on startup through logout (#7825)
* Persist require password on startup through logout

* Test new methods
2024-02-07 10:39:54 -05:00
SmithThe4th
923cac0a96
enable passkeys option should be set by default (#7835) 2024-02-07 09:27:22 -05:00
Addison Beck
b3135403e8
Wire up key definitions for OrganizationService (#7781)
* Wire up key definitions for OrganizationService

[`AC-2009`: Transition OrganizationService to use StateProvider](
https://bitwarden.atlassian.net/browse/AC-2009)

In order to support the new `StateProvider` APIs for managing
application state this commit modifies `OrganizationService` in the following
ways:

1. Adding a `KeyDefinition` object to `OrganizationService` to store the
   `organization` record in `StateProvider`.
1. Injecting `StateProvider` and wiring up `OrganizationService` to read
   from the `organizations` key definition for the active user account.
1. Expanding the capabilities of `OrganizationData` to be able to read
   itself from a JSON string. Previously this was handled directly by
   `StateService`.
1. Updating tests to include requirements for testing against
   `StateProvider`.
1. Marking the existing `StateService`-backed `organizations`
   `Observable` and `BehaviorSubject` as deprecated.

This is largely unimplemented code with no intended visible effects to
the system. Implementing getting & updating the `organizations` value
from `StateProvider` will the next step in this work.

* Rework null check on OrganizationData

* Remove deprecation signals for the time being

* Move key definition inline with its service

* Create date objects when deserialzing json from state
2024-02-06 18:48:34 -06:00
SmithThe4th
e9865c1cec
[PM-5275] Migrate state in Fido2ClientService to State Providers (#7745)
* added state definition and key definition

* created vault settings service

* created enable passkeys migrations

* created enable passkeys migrations

* renamed the state definition

* created vault settings service

* updated enable passkey key definition

* updated references with vault settings service

* renamed files to avoid conflict

* removed set and get enable passkeys from state service

* removed comment

* fixed comments

* added readonly keyword

* removed service registartion from service module

* removed readonly keyword from abstract class

* swicted to used optional chaining

* renamed files

* added disk-local argument for web
2024-02-06 15:15:22 -05:00
Shane Melton
78008a9e1e
[PM-5277] Migrate Sync Service to State Provider (#7680)
* [PM-5277] Introduce lastSync state via State Providers

* [PM-5277] Add migrator and tests

* [PM-5277] Use memory for web storage location

* [PM-5277] Remove lastSync methods from state service

* [PM-5277] Remove lastSync from AccountProfile

* [PM-5277] Use string instead of Date to fix serialization for chrome.storage API in Browser

* [PM-5277] Only set account if lastSync was deleted during migration

* [PM-5277] Fix spec file
2024-02-06 12:00:41 -08:00
SmithThe4th
7e00ece092
[PM-5276] Migrate FolderService to state providers (#7682)
* added state definitionand key definition for folder service

* added data migrations

* created folder to house key definitions

* deleted browser-folder-service and added state provider to the browser

* exposed decrypt function so it can be used by the key definition, updated folder service to use state provider

* removed memory since derived state is now used

* updated test cases

* updated test cases

* updated migrations after merge conflict fix

* added state provider to the folder service constructor

* renamed migration file

* updated comments

* updated comments

* removed service registartion from browser service module and removed unused set and get encrypted folders from state service

* renamed files

* added storage location overides and removed extra methods
2024-02-06 14:51:02 -05:00
Justin Baur
f64092cc90
[PM-6032] Run migrations in main process (#7795)
* Run Migrations in Desktop Main Process

* Add `waitForMigrations` method

* Add `InitOptions`

* Fix Destructuring
2024-02-06 12:01:12 -05:00
Matt Gibson
166269520c
Allow common get and set operations from state providers (#7824)
* Allow common get and set operations from state providers

* Use finnish endings for observables
2024-02-06 11:35:22 -05:00
Todd Martin
78bd44b276
Modified to use the correct header. (#7817) 2024-02-05 15:03:03 -05:00
Jake Fink
816bcf4f39
[PM-5255] Create login strategy service (#7750)
* refactor login strategies into own service

* create login service factory

* replaces instances of authService with loginStrategyService

* replace more instances of authService

* move logout back to auth service

* add browser dependencies

* fix desktop dependencies

* fix cli dependencies

* fix lint and test files

* fix anonymous hub deps

* fix webauthn-login service deps

* add loginstrategyservice to bg

* move login strategy service and models to auth folder

* revert changes to tsconfig

* use alias for imports

* fix path

---------

Co-authored-by: rr-bw <102181210+rr-bw@users.noreply.github.com>
2024-02-05 14:26:41 -05:00
Jared Snider
c91ceb2014
Auth/PM-5368 & PM-4613 - Web & Browser - Add support for new 2FA Duo Frameless Redirect flow (#7670)
* [PM-5368] Open Duo auth url. Add BroadcastChannel listener for duo result.

* [PM-5368] Remove debug line. Use PlatformUtilService to launch Uri.

* PM-5368 - Some progress on getting new frameless duo implementation in place

* PM-5368 - Base2FAComp - Save off duoFramelessUrl for use later on as user must be given the option to remember the device before launching the duo frameless flow in the new tab.

* PM-5368 - Web - 2FA Comp - (1) Only show larger width when showing backwards compatible duo (2) Stack buttons per new design (3) selectedProviderType === providerType.OrganizationDuo is correct check for when org requires DUO

* PM-5368 - Web - 2FA Comp - translate duo stuff

* PM-4613 - Browser 2FA - Get most of DUO frameless in place. WIP. Must figure out how to transfer state from popup to popout + add popout logic to auth-popout-windows.ts. Converted existing useAnotherTwoStepMethod button to use new comp lib bitButton per design.

* PM-4613 - Browser 2FA Comp - (1) HTML - add margin around duo frameless text to match figma (2) Get popout extension logic working properly - now closes existing popup

* PM-4613 - TODO figure out communication between web and browser as broadcast channel will not work.

* PM-5368 - Base comp + web changes - (1)  Base component now has a setupDuoResultListener method for child classes to override (2) Web overrides setupDuoResultListener and cleans up broadcast channel once a duo result comes through.

* PM-4613 - Browser - (1) Add window message handling to content-message-handler content script to pass along the duo result message to the browser extension (2) 2FA comp - override setupDuoResultListener and use browserMessagingApi to listen to duoResult and submit when it comes through.

* PM-5368 - Web - 2FA comp - only clean up duo result channel on ngDestroy so that user can re-submit if an error occurs.

* PM-5368 and PM-4613 - (1) Update base 2FA comp to only initialize duo result listener once as init is called any time the user changes 2FA option if multiple are present (duo org and duo personal) (2) Each client now will only create a listener once even if it is called more than once (3) On web, only try to clean up the duoResultChannel if it was created to avoid erroring on other 2FA methods.

* PM-5368 - Base 2FA comp - add TODO to remove duo SDK handling once we remove the duo-redirect flag

* PM-5368 - Per PR feedback, avoid repetition of duo provider check by using a new public property for isDuoProvider

* PM-4613 -  Per PR feedback: (1) Deconstruct code out of data (2) Add test for duoResult.

---------

Co-authored-by: André Bispo <abispo@bitwarden.com>
2024-02-05 13:23:50 -05:00
Matt Gibson
414ee2563f
[PM-5537] Biometric State Service (#7761)
* Create state for biometric client key halves

* Move enc string util to central utils

* Provide biometric state through service

* Use biometric state to track client key half

* Create migration for client key half

* Ensure client key half is removed on logout

* Remove account data for client key half

* Remove unnecessary key definition likes

* Remove moved state from account

* Fix null-conditional operator failure

* Simplify migration

* Remove lame test

* Fix test type

* Add migrator

* Prefer userKey when legacy not needed

* Fix tests
2024-02-05 13:02:28 -05:00
Todd Martin
250e7c87e8
[PM-6012] Added device identifier header when updating trust on key rotation (#7807) 2024-02-05 11:35:33 -05:00
Will Martin
cb8849c355
Add eslint rule no-floating-promises (#7789)
* add eslint rule no-floating-promises

* add eslint-disable comment to offending lines
2024-02-02 15:13:37 -05:00
✨ Audrey ✨
e8d0d56c5f
[PM-5608] introduce passphrase generator strategy (#7690) 2024-02-02 10:49:38 -05:00
Will Martin
4e4e39e9f7
[CL-178] contain overflow in bit-layout main content (#7783) 2024-02-02 10:36:12 -05:00
Justin Baur
5e710b45b0
Add Missing await (#7788) 2024-02-02 09:06:03 -05:00
Addison Beck
d39fa8ee86
Add state definitions for Admin Console services (#7776) 2024-02-01 16:06:25 -06:00
Will Martin
d0212bd1b0
[CL-173] hide nav-group active styles when expanded (#7695)
* hide nav-group active styles when open

* update org-switcher to show child nav-item active styles
2024-02-01 16:23:05 -05:00
Will Martin
b054211fe6
[CL-175] remove position fixed from sidebar (#7760)
Removes fixed position from `bit-layout`'s sidebar. This prevents the sidebar from taking up too much space on smaller viewports.
2024-02-01 15:36:58 -05:00
Jake Fink
7d3c6dbed7
[PM-5995] Clear everhaduserkey on logout (#7759)
* clear everhaduserkey on logout

* change to null
2024-02-01 09:36:29 -05:00
Colton Hurst
01781848f3
SM-904: Remove SecretsManagerBeta (Phase 2) (#6891)
* SM-904: Remove SecretsManagerBeta

* SM-904: Remove additional places sm beta is used

* SM-904: Remove unused SM Beta messages
2024-01-31 17:09:35 -05:00
Matt Gibson
3a9dead640
[PM-5533] migrate provider keys (#7649)
* Provide RSA encryption in encrypt service

* Define state for provider keys

* Require cryptoService

This is temporary until cryptoService has an observable active user private key. We don't want promise-based values in derive functions

* Update crypto service provider keys to observables

* Remove provider keys from state service

* Migrate provider keys out of state account object

* Correct Provider key state types

* Prefix migration with current version number
2024-01-29 16:53:01 -05:00
Todd Martin
c199f02d44
[PM-5638] Bump minimum server version for vault item encryption (#7705)
* PM-5638 Bumped up msv for IVIE

* Updated version to 2024.2.0 for next release.

---------

Co-authored-by: Carlos Gonçalves <cgoncalves@bitwarden.com>
2024-01-29 16:17:16 -05:00
Will Martin
d33b9ec58d
[CL-156][CL-176] update bit-nav-item styles (#7712)
* remove secondary-300 color redefinition

* add nav-item hover styles

* use inset focus-visible ring
2024-01-29 15:58:33 -05:00
Matt Gibson
1da6733e71
JSON stringify memory items (#7731)
* JSON stringify memory items

stringification is required so they can be reliably sent through messaging

* Simplify null handling
2024-01-29 19:42:58 +00:00
Alex Morask
8468dbab5b
[AC-1842] Secrets Manager Trial Page (#7475)
* Got trial page working without the form set up

* Set up the form to create SM subscription

* Add free SM trial page and sign up

* Conner's changes

* fixed imports

* Set isFromSecretsManagerTrial

* Fixed OrgKey location

* Add isFromSecretsManager prop to free org create

* Add LTO callout

* Switch LTO to background box

* Defect: AC-2081

* Fixed typo "Secrets Manger" to "Secrets Manager"

* Removed discount price logic for storage and secrets manager prices since they don't apply

---------

Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
2024-01-29 10:45:48 -05:00
aj-rosado
305fd39871
[AC-1782] Flexible collections import behavior in Password Manager and Admin Console (#6888)
* Added logic to only return organisations where user has import permissions and collections that he manages on Import

* Changed the UnassignedCollections validation logic

* Added validation to check if the user is coming from AdminConsole on the import component

* Added import collection service abstraction to allow get admin collections

* Corrected feature flag reads on import component

* Refactor import component methods ngOnInit and performImport to improve codescene
Using FeatureFlag Observable

* Modified validation to allow import if user has organizations to import into

* Using the new organization flexiblecollections property on import

* Created collection-admin-import.service to return all the org collections to the import on Admin Console

* Small changes on import flexible collections

* Fix linting issues

* changed canAccessImport rules and deprecated canAccessImportExport

* Validating if user canAccessImportExport instead of admin before calling the handleOrganizationImportInit.

* AC-2095 - Corrected getAllAdminCollections from ImportCollectionAdminService to properly get all the collections on AdminConsole

* Reverting AC-2095

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2024-01-29 15:11:19 +00:00
aj-rosado
d5de9cbeb2
[AC-1492] Split export service (#7462)
* Split export service into vault and org export service

* Changed CLI logic to use split export logic

* correct unit tests

* Created individual export service, export service making the calls for org and ind vault

* Improved code readability

* Merged PasswordProtectedExport with Export methods to simplify calls

* Some small refactor

* [AC-1492] Managed collections export (#7556)

* Added managed collections export method
Added logic to show orgs on export that the user can export from

* Merge branch 'tools/AC-1492/split-export-services' into tools/AC-1492/export-flexible-collections

# Conflicts:
#	apps/web/src/app/admin-console/organizations/tools/vault-export/org-vault-export.component.ts
#	apps/web/src/app/tools/vault-export/export.component.ts

* Change export to use new organization.flexiblecollection flag

* Little refactor changing parameter names and reduzing the size of export.component.ts ngOnInit

* Removed unused service from export constructor and removed unnecessary default value from org export service parameter

* Simplified organizations selection for vault export to only verify if it has flexiblecollections

* removed unecessary services from ExportComponent constructor on popup

* Fixed possible race condition on managed export
2024-01-29 09:38:16 +00:00
Will Martin
053053624f
[CL-174] add title to bit-nav-item (#7703)
* add title to bit-nav-item
2024-01-26 11:55:00 -05:00
Oscar Hinton
c0e157610e
Fix DefaultActiveUserState test always failing locally (#7701)
The test always fails locally due to first setting a local time, and then fetching it through UTC which may have different timezones.
2024-01-26 14:34:42 +01:00
Jared Snider
2c1d215b71
Auth/PM-5242 - Create new User Verification dialog and form input components which support PIN and biometrics verification (#7536)
* PM-5242 - First working draft of copying out web CL implementation of user verification form and dialog components into standalone libs/auth components which could be used in any client.

* PM-5242 - Rename UserVerificationFormComponent to UserVerificationFormInputComponent b/c it doesn't actually have a form and is meant to slot into a form as an input.

* PM-5242 - Update libs/auth angular index to take renamed component into account

* PM-5242 - Clean up UserVerificationDialogComponent as have much cleaner design approach now (maintain existing func while simply adding new requirements for client side validation for passkeys)

* PM-5242 - UserVerificationFormInput component - WIP draft of new client and server split of user verification logic

* PM-5242 - UserVerificationFormInput - WIP - Lots of progress on client side verification layout - more to do

* PM-5242 - UserVerificationFormInputComponent - Add hasMultipleVerificationMethods property so we can only show alternate methods if user has them.

* PM-5242 - UserVerificationFormInputComponent - rename hasMultipleVerificationMethods to hasMultipleClientVerificationOptions

* PM-5242 - Add new user verification biometrics fingerprint icon with proper secondary fill so it displays properly on all themes.

* PM-5242 - Create enum for tracking client user verification states

* PM-5242 - UserVerificationFormInputComponent - WIP - (1) Got biometrics layout working except for error state (2) Emitting active client verification option and biometrics result to dialog (3) Properly identifying if biometrics is enabled in a platform agnostic way (4) Translations TODO

* PM-5242 - UserVerificationDialogComponent - (1) Wire up new inputs and outputs for UserVerificationFormInput (2) Don't show submit button when clientside biometrics verification active

* PM-5242 - UserVerificationFormInputComponent - wired up biometrics failure and retry handling + re-arranged comp properties to put inputs & outputs at the top

* PM-5242 - UserVerificationFormInput component - Add logic to prevent currently active client verification method from being shown an option

* PM-5242 - UserVerificationFormInput - adjust margins

* PM-5242 - User verification dialog and form input comps - replace Verification with VerificationWithSecret type where applicable

* PM-5242 - UserVerificationFormComp - Default to server for backwards compatibility and to avoid requiring the input at all

* PM-5242 - UserVerificationFormInputComp - (1) Rename processChanges to processSecretChanges (2) Short circuit processSecretChanges when biometrics is active (3) Add new function for determining type of verification that has a secret.

* PM-5242 - UserVerificationDialog - Support custom, optional callout in dialog body.

* PM-5242 - UserVerificationDialogComp - support custom confirm button text and type.

* PM-5242 - UserVerificationDialog - Add user verification dialog result type to allow for handling all possible verification scenarios

* PM-5242 - UserVerificationFormInputComp - tweak comment

* PM-5242 - UserVerificationFormInput comp html - add placeholder text for no client verifications found scenario

* PM-5242 - UserVerificationDialogComponent - (1) Add confirm & cancel to dialog result (2) Add cancel method vs using bitDialogClose for specificity (3) Adjust naming of output property to properly specify that it is scoped to client verification (4) Adjust layout of dialog html to handle when no client side verification methods are found.

* PM-5242 - UserVerificationFormInput - Clean up test code

* PM-5242 - UserVerificationFormInput - For server verification, we don't need to check if the user has a local master key hash as we will generate a hash to send to the server for comparison.

* PM-5242 - UserVerificationFormInput html - Remove now unnecessary dev warning as I've provided a default

* PM-5242 - UserVerification Dialog & Form Input - add translations on all clients for all visible text.

* PM-5242 - UserVerificationFormInput html - remove no active client verification handling from form input comp as it is instead emitted upwards to parent dialog component to be handled there.

* PM-5242 - UserVerificationDialogComp - (1) Make UserVerificationDialogResult.noAvailableClientVerificationMethods optional because it isn't needed in cancel flows (thanks Will) (2) Modify static open to intercept closed observable event in order to always return a UserVerificationDialogResult as BitDialog returns empty string when the user clicks the x

* PM-5242 - UserVerificationDialogComp - Simplify dialog param names to remove redundant dialog

* PM-5242 - UserVerificationDialogParams - update comments to match new names

* PM-5242 - UserVerificationDialog Storybook - WIP first draft

* PM-5242 - UserVerificationDialogStoryComponent - WIP - try out having imports the same as the standalone component

* PM-5242 - UserVerificationDialogStoryComponent - more WIP - building now - some stuff displaying

* PM-5242 - UserVerificationDialogStoryComponent - some progress on providers setup

* PM-5242 - Not going to use storybook for user verification dialog

* PM-5242 - UserVerificationDialogComp - move types into own file + add docs

* PM-5242 - Update auth index to export user-verification-dialog.types

* PM-5242 - UserVerificationFormInput & UserVerificationService - Extract out getAvailableVerificationOptions logic into service

* PM-5242 -UserVerificationDialogComponent - Update close logic to handle escape key undefined scenario

* PM-5242 - UserVerificationFormInput - add getInvalidSecretErrorMessage for properly determining invalid secret translation

* PM-5242 - UserVerificationDialogComp - Refactor submit logic to handle different return methodologies in existing MP and OTP user verification service code vs new PIN flow (e.g., throwing an error instead of returning false)

* PM-5242 - PinCryptoService - change error logs to warnings per discussion with Justin

* PM-5242 - UserVerificationFormInput - Biometrics flow on desktop - remove accidentally added period in couldNotCompleteBiometrics translation key.

* PM-5242 - UserVerificationFormInput HTML - Re-arrange order of other client verification options to match design

* PM-5242 - UserVerificationFormInputComponent - Reset inputs as untouched on change of client verification method.

* PM-5242 - UserVerificationDialogComponent - Remove TODO as existing secret change logic turns invalidSecret false when biometrics is swapped to.

* PM-5242 - UserVerificationFormInputComponent - getInvalidSecretErrorMessage - fix PIN error message not being returned.

* PM-5242 - UserVerificationDialogComponent - Add documentation and examples to open method.

* PM-5242 - UserVerificationDialogComponent - tweak open docs

* PM-5242 - Remove accidental period from translation keys on browser & web

* PM-5242 - UserVerificationFormInputComponent - OTP flow needed button module to work

* PM-5242 - UserVerificationDialogParams - Add docs explaining that noAvailableClientVerificationMethods is only for desktop & browser.

* PM-5242 - User-verification-form-input - Adjust layout to meet new design requirements - (1) On load, send OTP without user clicking a button (2) Allow resending of the codes (3) show a code sent message for 3 seconds

* PM-5242 - Browser User Verification - Instantiate PinCryptoService and UserVerification service AFTER instantiating vaultTimeoutSettingsService so that it isn't undefined at run time.

* PM-5242 - JslibServices Module - UserVerificationService - add missing PlatformUtilsServiceAbstraction dependency.

* PM-5242 - Desktop Native Messaging Service - Wrap biometric getUserKeyFromStorage call in try catch because it throws an error if the user cancels the biometrics prompt and doesn't send a response to the browser extension when using the biometrics unlock bridge to the desktop app and OS.

* PM-5242 - Browser Extension - NativeMessagingBackground - if the desktop biometricUnlock command is executed with a canceled (not adjusting misspelling to keep side effects at a min) response, don't bother continuing.

* PM-5242 - BrowserCryptoService - When retrieving the user key via desktop biometrics, return null for user key if the user fails or cancels the biometrics prompt. Otherwise, if there is a user key in memory after unlock, biometrics user verification will always just return the user key from state regardless of if the user has successfully passed the biometrics prompt or not.

* PM-5242 - BrowserCryptoService - extra comments

* PM-5242 - Clean up translations - (1) Remove unused defaultUserVerificationDialogConfirmBtnText (2) Refactor name of defaultUserVerificationDialogTitle to just be verificationRequired which matches existing naming conventions.

* PM-5242 - CLI - fix order of service instantiations to ensure that vaultTimeoutSettingsService isn't undefined for PinCryptoService and UserVerificationService

* PM-5242 - Rename UserVerificationDialogParams to UserVerificationDialogOptions to match existing naming conventions of other CL comps.

* PM-5242 - UserVerificationDialogComponent - dialogParams renamed to dialogOptions

* PM-5242 - UserVerificationService Abstraction - Per PR feedback, use keyof for verificationType

* PM-5242 - UserVerificationBiometricsIcon - Per PR feedback, use https://jakearchibald.github.io/svgomg/ to optimize SVG by 50%.

* PM-5242 - Per PR feedback, clarify UserVerificationDialogOptions.clientSideOnlyVerification comment.

* PM-5242 - UserVerificationTypes - Add comments clarifying all text passed to the UserVerificationDialog are translation keys

* PM-5242 - UserVerificationDialogComp - fix extra new line per PR feedback

* PM-5242 - UserVerificationDialogTypes - per PR feedback and discussion with Will M., export ButtonType from CL so we (and consumers of the dialog) can properly import it via standard CL import.

* PM-5242 - BrowserCryptoService - Adjust comments per PR feedback.

* PM-5242 - UserVerificationDialogComponent - make ActiveClientVerificationOption readonly as it only for component html

* PM-5242 - UserVerificationDialogComp html - finish comment

* PM-5242 - BrowserCryptoService - add returns js doc per PR feedback.

* PM-5242 - UserVerificationDialogComponent - per PR feedback, add unexpected error toast.

* PM-5242  - UserVerificationService - getAvailableVerificationOptions - update params to use keyof like abstraction

* PM-5242 - Mark all existing client specific implemetations of user verification as deprecated.
2024-01-25 14:03:27 -05:00
Justin Baur
45c0c09b71
[PM-5829] Add disk-local option for web (#7669)
* Add `disk-local` option for web

* Fix `web` DI

* Update libs/common/src/platform/state/state-definition.ts

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Rely On Default Implementation for Most of Cache Key

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2024-01-25 12:48:51 -05:00
✨ Audrey ✨
6b97c0e716
[PM-5840] add duck duck go forwarder (#7674) 2024-01-25 10:24:22 -05:00
✨ Audrey ✨
af4cafa2b9
[PM-5841] add fastmail forwarder (#7676) 2024-01-25 10:23:56 -05:00
✨ Audrey ✨
67f1fc4f95
[PM-5842] add firefox relay forwarder (#7677) 2024-01-25 10:22:55 -05:00
✨ Audrey ✨
f6da6d637c
[PM-5843] add forward email forwarder (#7678) 2024-01-25 10:22:26 -05:00
✨ Audrey ✨
2c69810460
[PM-5844] add simple login forwarder (#7679) 2024-01-25 10:21:51 -05:00
Thomas Rittson
bcb232cc80
[AC-2026] Add flexible collections opt-in UI (#7443) 2024-01-25 16:56:31 +10:00
✨ Audrey ✨
8555dcc613
fix const lint (#7673) 2024-01-24 22:34:59 +00:00
✨ Audrey ✨
df2329f059
[PM-5781] Anon addy forwarder (#7654) 2024-01-24 17:23:39 -05:00
Justin Baur
c1d5351075
[PM-5535] Migrate Environment Service to StateProvider (#7621)
* Migrate EnvironmentService

* Move Migration Test Helper

* Claim StateDefinition

* Add State Migration

* Update StateServices

* Update EnvironmentService Abstraction

* Update DI

* Update Browser Instantiation

* Fix BrowserEnvironmentService

* Update Desktop & CLI Instantiation

* Update Usage

* Create isStringRecord helper

* Fix Old Tests

* Use Existing AccountService

* Don't Rely on Parameter Mutation

* Fix Conflicts
2024-01-24 14:21:50 -05:00
Bernd Schoolmann
842fa5153b
Replace promise.all with for loop for performance reasons (#7582) 2024-01-24 13:42:37 -05:00
Jonathan Prusik
dc9a5079ba
handle access on cipher properties when cipher is undefined (new cipher creation) (#7666) 2024-01-24 12:40:32 -05:00
Matt Gibson
af0d2f515d
Vault/pm-4185/checksum uris (#6485)
* Validate checksum on decrypt of URI

* Add uri checksum to domain during encryption

* Move hash to stateless encrypt service

* Add checksum field to all the other models necessary for syncing with server

* Remove old test in favor of `describe` block

* PM-4185 Added a boolean to control checksum validation

* PM-4185 Fi unit tests

* [PM-4810][PM-4825][PM-4880] Fix encrypted import and add null check (#6935)

* PM-4810 Bumped up version

* PM-4880 Add null check

* PM-4825 Fix encrypted export

* PM-5462 Fix item saving with blank URI (#7640)

* PM-4185 Add back uriChecksum setting

---------

Co-authored-by: Carlos Gonçalves <cgoncalves@bitwarden.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: gbubemismith <gsmithwalter@gmail.com>
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
2024-01-24 17:22:58 +00:00
Shane Melton
622791307a
[AC-1890] Update the collection PUT/POST response models to include collection permission details (#7512) 2024-01-24 08:26:43 -08:00
aj-rosado
512f6ef892
Added capability on psono importer to add sub-folders (#7602) 2024-01-24 12:55:43 +00:00
Matt Gibson
e23bcb50e8
[PM-5533] Migrate Org Keys to state providers (#7521)
* Move org keys to state providers

* Create state for org keys and derive decrypted for use

* Make state readonly

* Remove org keys from state service

* Migrate user keys state

* Review feedback

* Correct test name

* Refix key types

* `npm run prettier` 🤖
2024-01-23 13:01:49 -08:00
✨ Audrey ✨
dbf836b573
[PM-5606] Add reactive generator service (#7446) 2024-01-23 14:22:52 -05:00
Kyle Spearrin
e359aef979
fixes (#7145) 2024-01-23 18:21:59 +00:00
Alex Morask
014281cb93
[AC-1758] Show banner when organization requires a payment method (#7088)
* Add billing banner states to account settings

* Add billing banner service

* Add add-payment-method-banners.component

* Use add-payment-method-banners.component in layouts

* Clear banner on payment method addition

* Ran prettier after CI update

* Finalize banners styling/translations

* Will's (non-Tailwind) feedback

* Review feedback

* Review feedback

* Review feedback

* Replace StateService with StateProvider in BillingBannerService

* Remove StateService methods
2024-01-23 12:47:52 -05:00
✨ Audrey ✨
d5738b7483
[PM-5780] New username generation settings types (#7613)
Split from  #6924
2024-01-23 09:52:20 -05:00
Cesar Gonzalez
0127db44a0
[PM-5551] Removing Autofill v2 and AutofillOverlay Feature Flags (#7642)
* [PM-5551] Removing Autofillv2 and AutofillOverlay Feature Flags

* [PM-5551] Fully removing references to autofill v1
2024-01-22 17:11:07 +00:00
Tom
ec7c3878c9
Tools/pm 4440 replace lastpass sso dialog (#7608)
* Initial implementation of simple dialog

* Updating buttons and dialog type

* Set the cancel text normally

* Removing the lastpass sso dialog component
2024-01-22 16:05:31 +00:00
Oscar Hinton
7bb4ea842f
[PM-3919] Remove deprecated Angular functionality from ModalService (#6285)
Remove deprecated Angular functionality from ModalService so we can upgrade Angular.
2024-01-22 09:36:42 +00:00
Jake Fink
07af08b893
[PM-2772] add flag to deter process reload if cancel is clicked on biometrics (#7350)
* add flag to deter process reload if cancel is clicked on biometrics

* rename flag

* store biometrics cancelled to disk instead of integrating with process reload

* allow auto-prompt when opening app
2024-01-19 10:08:55 -05:00
Kyle Spearrin
06c7c3fd18
[PM-5149] UI for unique SP entity id on organization sso configs (#7117)
* add ui for making sp entity id unique

* pretty

* updates
2024-01-18 21:54:31 +00:00
Justin Baur
06028c35bc
Fully Test EnvironmentService (#7589)
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2024-01-18 13:06:54 -05:00
Justin Baur
57609737f1
Fix SingleUserStateProvider (#7593)
* Fix SingleUserStateProvider

- Fix cache key to be unique per instance per user

* Add Specific State Provider Tests

* Add Missing await
2024-01-18 13:02:30 -05:00
Oscar Hinton
5810b0c7a2
[PM-5300] Use deep linking for premium (#6432)
Resolves the get premium links not working in the browser extension. Replaces them with the deep links instead.
2024-01-18 17:43:34 +01:00
Jonathan Prusik
8e9a104bd0
[deps] Autofill: Update prettier to v3.2.2 (#7565)
* [deps] Autofill: Update prettier to v3.2.2

* prettier fixes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-17 16:02:44 -05:00
Thomas Rittson
ee4aa31444
[AC-2027] Update Flexible Collections logic to use organization property (#7445)
* Remove unused feature flag

* Replace feature flag ref with org flag

* Remove deprecated feature flag to discourage use

* Add check to org.canCreateNewCollections

* Adjust init logic of components to avoid race conditions

* Make canCreateNewCollections logic more explicit

* Resolve merge conflicts with vault changes

* Update comments

* Remove uses of old feature flag

* Remove last of old feature flag

* Clean up feature flag

* Fix linting

* Fix linting
2024-01-17 12:33:39 +00:00
Matt Gibson
160a636fa0
Move key types to central location (#7531) 2024-01-17 07:27:44 -05:00
Jared Snider
756c02cec2
Auth/PM-4596 - Extract PIN and Biometrics unlock method logic into re-useable services for user verification (#7107)
* PM-4596 - PinCryptoService first draft

* PM-4596 - PinCryptoService - Refactor pinKeyEncryptedKey retrievals out into own method getPinKeyEncryptedKeys

* PM-4596 - npm ci + npm run prettier to fix lint issues

* PM-4596 - PinCryptoService - Add kdf types

* PM-4596 - PinCryptoService - Refactor pin validation into own helper method.

* PM-4596 - Rename pin-crypto.service.ts to pin-crypto.service.implementation.ts

* PM-4596 - PinCryptoService - add additional logging for error states.

* PM-4596 - JslibServicesModule - register new PinCryptoService and PinCryptoServiceAbstraction

* PM-4596 - PinCryptoService - modify decryptUserKeyWithPin signature to not require email to match MP verification process in user verification service.

* PM-4596 - Lock components - use new PinCryptoService.decryptUserKeyWithPin(...) to get user key + refactor base comp unlock with pin method to improve

* PM-4596 - Lock component - if too many invalid attempts, added toast explaining that we were logging the user out due to excess PIN entry attempts

* PM-4596 - UserVerificationService - (1) Refactor verifyUser(...) to use switch + separate methods for a cleaner parent method + better extensibility for PIN & biometrics which are TBD (2) Add PIN support to validateInput(...)

* PM-4596 - UserVerificationService - add PIN and biometrics functions to verifyUser(...)

* PM-4596 - PinCryptoService Spec - start test file - instantiates properly

* PM-4596 - PinCryptoService tests - WIP

* PM-4596 - PinCryptoService tests - WIP - got success cases working

* PM-4596 - pin-crypto.service.implementation.spec.ts renamed to pin-crypto.service.spec.ts

* PM-4596 - PinCryptoService.getPinKeyEncryptedKeys(...) - add comment + var name change for clarity

* PM-4596 - PinCryptoService tests - test invalid, null return scenarios

* PM-4596 - CLI - bw.ts - update UserVerificationService instantiation to include new pinCryptoService

* PM-4596 - PinCryptoService - import VaultTimeoutSettingsServiceAbstraction instead of implementation for factory creation to get browser building

* PM-4596 - (1) Create pinCryptoServiceFactory for browser background (2) Add it to the existing userVerificationServiceFactory

* PM-4596 - Browser - Main.background.ts - Add pinCryptoService and add to userVerificationService dependencies

* PM-4596 - UserVerificationService - per PR feedback simplify returns of verifyUserByPIN(...) and verifyUserByBiometrics(...)

* PM-4596 - Messages.json on desktop & browser - per PR feedback, adjust tooManyInvalidPinEntryAttemptsLoggingOut translation text to remove "you"

* PM-4596 - VerificationType enum - fix line copy mistake and give BIOMETRICS own, unique value.

* PM-4596 - VerificationType - rename BIOMETRICS to Biometrics to match existing MasterPassword value case.

* PM-4596  - Update verification type to consider whether or not a secret exists as we have added a new verification which doesn't have a type. Add new server and client side verification types.  Update all relevant code to pass compilation checks.

* PM-4596 - More verification type tweaking

* PM-4596 - Verification - verificationHasSecret - tweak logic to be more dynamic and flexible for future verification types

* PM-4596 - UpdateTempPasswordComp - use new MasterPasswordVerification

* PM-4596 - Desktop - DeleteAcctComp - use VerificationWithSecret to solve compile error w/ accessing secret

* PM-4596 - Per discussions with Andreas & Will, move new Pin Crypto services into libs/auth + added @bitwarden/auth path to CLI tsconfig + added new, required index.ts files for exporting service abstractions & implementations

* PM-4596 - Fixed missed import fixes for lock components across clients for pin crypto service after moving into @bitwarden/auth

* PM-4596 - More PinCryptoService import fixes to get browser & desktop building

* PM-4596 - Update desktop lock comp tests to pass by providing new pin crypto service.

* PM-4596 - User verification service -update todo

* PM-4596 - PinCryptoService - per PR feedback, fix auto import wrong paths.

* PM-4596 - PinCryptoService tests - fix imports per PR feedback

* PM-4596 - UserVerificationSvc - rename method to validateSecretInput per PR feedback

* Fix imports

* PM-4596 - PinCryptoService - Refactor naming for clarity and move test cases into describes per PR feedback

* reorg libs/auth; expose only libs/auth/core to cli app

* PM-4596 - UserVerification - Resolve import issue with importing from libs/auth. Can't use @bitwarden/auth for whatever reason.

* PM-4596 - Fix desktop build by fixing import

* PM-4596 - Provide PinCryptoService to UserVerificationService

* PM-4596 - PinCryptoServiceFactory - you cannot import services from @bitwarden/auth in the background b/c it brings along the libs/auth/components and introduces angular into the background context which doesn't have access to angular which causes random test failures. So, we must separate out the core services just like the CLI to only bring along the angular agnostic services from core.

* PM-4596 - Refactor libs/auth to have angular / common + update all imports per discussion with Matt & Will. Introduced circular dep between PinCryptoService + VaultTimeoutSettingsService + UserVerificationService

* PM-4596 - VaultTimeoutSettingsService - Refactor UserVerificationService out of the service and update all service instantiations and tests. The use of the UserVerificationService.hasMasterPassword method no longer needs to be used for backwards compatibility. This resolves the circular dependency between the PinCryptoService, the UserVerificationService, and the VaultTimeoutSettingsService. We will likely refactor the hasMasterPassword method out of the UserVerificationService in the future.

* PM-4596 - Update CL tsconfig.libs.json to add new auth/common and auth/angular paths for jslib-services.module imports of pin crypto service to work and for test code coverage to run successfully.

* PM-4596 - Address PR feedback

* PM-4596 - Update root tsconfig (only used by storybook) to add new libs/auth paths to fix chromatic build pipeline.

* PM-4596 - Actually update tsconfig with proper routes to fix storybook

* PM-4596 - UserVerificationService - verifyUserByBiometrics - add error handling logic to convert failed or cancelled biometrics verification to a usable boolean

* PM-4596 - Add missing await

* PM-4596 - (1) Add log service and log to user verification service biometric flow to ensure errors are at least revealed to the console (2) Fix factory missing PinCryptoServiceInitOptions

* PM-4596 - Use the correct log service abstraction

* PM-4596 - Remove unused types per PR review

---------

Co-authored-by: William Martin <contact@willmartian.com>
2024-01-16 14:52:06 -05:00
Jonathan Prusik
eae845d900
[PM-4260] [BEEEP] Mask TOTP seeds in cipher edit view - similar to how the password is hidden (#6649)
* PoC disallow changing masked values in edit mode and mask TOTP with password

* toggle totp seed visibility independently from password visibility in edit mode

* cleanup

* add fallback value for when a cipher returns a null value for maskedPassword

* toggle masks off for maskable login properties with no value on load

* do not show mask toggle for password or totp if no value is present
2024-01-12 22:35:30 -05:00
Oscar Hinton
93e9937e5c
Add some test cases to the password strength service (#7483)
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
2024-01-12 07:25:33 +01:00
Rui Tomé
48643e45ea
[AC-1893] Removed logic to downgrade Manager roles and remove Edit/Delete any collection permissions for Flexible Collections (#7365) 2024-01-12 07:54:11 +10:00
Justin Baur
0874df8b84
Global State Rewrite (#7515)
* Global State Rewrite

* Apply suggestions from code review

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Prettier

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2024-01-11 16:32:56 -05:00
Matt Bishop
6baad76088
[PM-5548] Eliminate in-app purchase logic (#7433)
* Eliminate in-app purchase logic

* Remove more in-app logic found, for payment and subscription management

---------

Co-authored-by: Lotus Scott <148992878+lscottbw@users.noreply.github.com>
2024-01-11 15:24:43 -05:00
aj-rosado
99022e2baa
Added dashed line as separator and label for common formats on format selector for import (#7432) 2024-01-11 16:24:40 +00:00
Oscar Hinton
280cb7e2c0
[CL-161] Update bit-search support autofocus (#7272)
appAutofocus currently doesn't work on the bit-search component. This PR resolves this issue by introducing a FocusableElement interface components can implement, which is respected by the autofocus directive.
2024-01-11 16:52:22 +01:00
Matt Gibson
f8d72f0231
[PM-5465] Fix null checks in login view uris (#7421)
* Prefer empty lists to null

* Defensively null check public properties
2024-01-11 14:55:16 +00:00
Thomas Rittson
1f57244d1a
Add organization.flexibleCollections to models (#7442) 2024-01-11 13:52:18 +10:00
Tom
a572e4119e
[PM-4535] Import into org vault with remove individual vault policy set (#7343)
* Refactored import ngOnInit. Set the default org if import allowed. Verified org id exists on import

* moving handlePolicies to the end of ngOnInit
2024-01-10 16:12:24 -05:00
Todd Martin
7bd8b00fbf
[PM-2260] Remove TDE feature flag and all conditional logic based on it (#7352) 2024-01-10 12:33:11 -05:00
Matt Gibson
46a3834f46
Add state for everHadUserKey (#7208)
* Migrate ever had user key

* Add DI for state providers

* Add state for everHadUserKey

* Use ever had user key migrator

Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
Co-authored-by: Carlos Gonçalves <LRNcardozoWDF@users.noreply.github.com>
Co-authored-by: Jason Ng <Jcory.ng@gmail.com>

* Fix test from merge

* Prefer stored observables to getters

getters create a new observable every time they're called, whereas one set in the constructor is created only once.

* Fix another merge issue

* Fix cli background build

---------

Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
Co-authored-by: Carlos Gonçalves <LRNcardozoWDF@users.noreply.github.com>
Co-authored-by: Jason Ng <Jcory.ng@gmail.com>
2024-01-10 11:51:45 -05:00
Matt Gibson
211d7a2626
Ps/improve state provider fakers (#7494)
* Expand state provider fakes

- default null initial value for fake states
- Easier mocking of key definitions through just the use of key names
  - allows for not exporting KeyDefinition as long as the key doesn't collide
- mock of fake state provider to verify `get` calls
- `nextMock` for use of the fn mock matchers on emissions of `state$`
- `FakeAccountService` which allows for easy initialization and working with account switching

* Small bug fix for cache key collision on key definitions unique by only storage location

* Fix initial value for test
2024-01-10 10:36:19 -05:00
Todd Martin
c9a2f07e04
Remove Fido2VaultCredentials feature flag (#7463)
* Removed Fido2 client credentials feature flag

* Removed test for feature flag.
2024-01-09 12:56:58 -05:00
Ike
6f22f05eee
Update sso prevalidate path (#7479)
* Update sso prevalidate path

* fixed formatting
2024-01-08 11:24:45 -08:00
Mathijs van Veluw
06adde65e7
[PM-4906] Allow bitmenu to overflow and scroll when needed (#6941)
add `tw-overflow-y-auto` to bit-menu which will automatically add a scrollbar when needed
2024-01-05 10:41:30 -05:00
Matt Gibson
92f593df08
Remove unnecessary complex types (#7451)
#7290 introduced these types, but during development we switched over to specifying dependencies in type parameters instead of an object. This change meant we no longer needed these `Type` or `ShapeToInstance` types, greatly simplifying the types related to derived state.
2024-01-04 16:50:55 -05:00
Justin Baur
5e11cb212d
Combined State (#7383)
* Introduce Combined State

* Cleanup Test

* Update Fakes

* Address PR Feedback

* Update libs/common/src/platform/state/implementations/default-active-user-state.ts

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Prettier

* Get rid of ReplaySubject reference

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2024-01-04 16:30:20 -05:00
Matt Gibson
06affa9654
Rework derived state (#7290)
* Remove derived state from state classes

* Create provider for derived state

Derived state is automatically stored to memory storage, but can be derived from any observable.

* Fixup state provider method definitions

* Test `DefaultDerivedState`

* remove implementation notes

* Write docs for derived state

* fixup derived state provider types

* Implement buffered delayUntil operator

* Move state types to a common module

* Move mock ports to centra location

* Alias DerivedStateDependency type

* Add dependencies to browser

* Prefer internal rxjs operators for ref counting

* WIP

* Ensure complete on subjects

* Foreground/background messaging for browser

Defers work for browser to the background

* Test foreground port behaviors

* Inject foreground and background derived state services

* remove unnecessary class field

* Adhere to required options

* Add dderived state to CLI

* Prefer type definition in type parameters to options

* Prefer instance method

* Implements factory methods for common uses

* Remove nothing test

* Remove share subject reference

Share manages connector subjects internally and will reuse them until
refcount is 0 and the cleanup time has passed. Saving our own reference
just risks memory leaks without real testability benefits.

* Fix interaction state
2024-01-04 14:47:49 -05:00
Jason Ng
eebd10dfd0
linting failures from community pr update (#7434) 2024-01-03 15:36:48 -05:00
Bernd Schoolmann
1b4717a78f
[PM-3343] Capture TOTP QR codes from websites in the browser extension (#5985)
* Implement totp capture for browser extensions
2024-01-03 13:20:17 -05:00
Jared Snider
1fdc6629e3
Auth/PM-3859 - Desktop - Create lock mechanism to prevent app menu redraw on sync complete when user logging out (#6920)
* PM-3859 - Desktop App Comp - Build lock mechanism for update app menu which doesn't try to update the menu for users who are being logged out which was causing errors (primary scenario was triggered by logging in on desktop with a TDE user w/out a MP, triggering a sync, then hitting the command to lock the vault right after which would trigger a log out while the sync was still in process.  Then, while the log out was in process, the sync would try and trigger an update to the app menu but it would error as some of the user's state had already been cleaned up)

* PM-3859 - App comp - remove use of promise.all to prevent any race conditions from causing intermittent logout errors with state being cleared and then values trying to be set on the cleared state (I observed setMasterKey get called after state account.keys was cleared - received error when attempting to set value on undefined).

* PM-3859 - Desktop Vault Items Component - on log out, if you were on the vault screen, the loss of focus on the vault search text box would trigger a search 200 ms after log out had been triggered.  This would eventually attempt to set an undefined master key (VaultItemsComponent.doSearch() --> cipherService.getAllDecrypted() --> cryptoService.getUserKeyWithLegacySupport() --> cryptoService.getMasterKey() --> cryptoService.setMasterKey()).  However, at this point, the account had been cleared as part of the log out process and an error would be thrown in the state service for trying to set account.keys.masterKey to undefined when the account and account.keys were undefined. These changes prevent the search from firing until the value changes and also prevents setMasterKey from being called if it is undefined.
2024-01-02 22:22:17 +00:00
Justin Baur
f2eea12b4f
Route on switchAccountFinish Message (#7422) 2024-01-02 16:55:42 -05:00
Andreas Coroiu
551d2c2441
[PM-5302] Refactor Passkey feature enable/disable logic (#7242)
* feat: add missing tests for `isFido2FeatureEnabled`

* feat: add user logged in check

* chore: rewrite with cartesian product

* chore: remove test

The test was more complex than the actual function, removing.

* feat: add domain exclusion

* feat: add origin equal vault case

* chore: clean up the old code from `content-secript`

* feat: return early to avoid making api calls

* fix: prettier linting

* fix: incorrect logic inversion

---------

Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2024-01-02 13:42:16 -05:00
Matt Gibson
a682f2a0ef
[PM-5468] Ensure prototypes available on memory stored objects (#7399)
* Hide account switcher in addEdit generator

* Handle AddEditCipher deserialization

* Opaque types are not serializable

* Better handle jsonification of login uris

* Ensure we don't overwrite original with clone

* Ensure cipherView prototype is always restored if it exists
2024-01-02 10:46:45 -05:00
SmithThe4th
c289b3b8a4
Removed automatic fallback to browser when no credentials exist (#7135)
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
2023-12-27 14:32:54 -05:00
rr-bw
00bb814fbe
[PM-2414] Angular 16 Upgrade - SetPinComponent (#7214)
* migrate to DialogService

* use static method

* add reactive form dependencies

* begin migrating to reactive forms

* migrate template inputs to use CL

* update set-pin.component.ts file to work with reactive forms

* migrate desktop template and class file to Dialog and ReactiveForms

* update settings page

* remove old properties

* update settings form upon dialog close

* refactor ngOnInit()

* remove duplicate validator (already have a validator in class file)
2023-12-27 10:48:06 -08:00
Tom
64362fe869
[PM-536] Adding the 1password fix for custom sections and test cases (#7190)
* Adding the 1password fix for custom sections and test cases

* sorting the validate function

* running prettier to format files

* removed id from getField name and refactored dupe field validation
2023-12-22 16:22:39 -05:00
SmithThe4th
6755c8c6ce
[PM-5347] Fix buggy P1363 to DER conversion (#7303)
* [PM-5347] feat: add tests

* fixed miscalculated lengths for R and S components by not by prepending an extra byte when the MSB of the first byte in a component is greater than or equal to 0x80

* renamed to correct format

* fixed issue when there is a leading zero and a negative

* removed comment

* Made test cases clearer and more informative, renamed joseToDer, removed alg parameter and defaulted to use ES256 algorithm

---------

Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
2023-12-22 15:57:47 -05:00
Jake Fink
a62f8cd652
[PM-3797] Client changes to use new key rotation process (#6881)
## Type of change

<!-- (mark with an `X`) -->

```
- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
```

## Objective

<!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding-->
Final Client changes for Key Rotation Improvements. 

- Introduces a new `KeyRotationService` that is responsible for owning rotation process.
- Moves `Send` re-encryption to the `SendService` (`KeyRotationService` shouldn't have knowledge about how domains are encrypted).
- Moves `EmergencyAccess` re-encryption to the `EmergencyAccessService`.
- Renames `AccountRecoveryService` to `OrganizationUserResetPasswordService` after feedback from Admin Console


## Code changes

<!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes-->
<!--Also refer to any related changes or PRs in other repositories-->

Auth
- **emergency-access-update.request.ts:** New request model for domain updates that includes Id
- **emergency-access.service.ts:** Moved `EmergencyAccess` re-encryption to the `EmergencyAccessService`. Add deprecated method for legacy key rotations if feature flag is off
- **key-rotation.service/api/spec/module:** New key rotation service for owning the rotation process. Added api service, module, and spec file.
- **update-key.request.ts:** Moved to Auth ownership. Also added new properties for including other domains.
- **migrate-legacy-encryption.component.ts:** Use new key rotation service instead of old component specific service. Delete old service.
- **change-password.component.ts:** Use new key rotation service.
- **settings.module.ts:** Import key rotation module.

Admin Console
- **organization-user-reset-password.service.ts/spec:** Responsible for re-encryption of reset password keys during key rotation. Added tests.
- **organization-user-reset-password-enrollment.request.ts:** New request model for key rotations
- **reset-password.component.ts:** Update `AccountRecoveryService` to `OrganizationUserResetPasswordService`
- **enroll-master-password-reset.component.ts:** Update `AccountRecoveryService` to `OrganizationUserResetPasswordService`

Tools
- **send.service/spec.ts:** Responsible only for re-encryption of sends during key rotation. Added tests.

Other
- **api.service.ts:** Move `postAccountKey` to `KeyRotationApiService`
- **feature-flag.enum.ts:** add new feature flag

## Screenshots

<!--Required for any UI changes. Delete if not applicable-->

## Before you submit

- Please add **unit tests** where it makes sense to do so (encouraged but not required)
- If this change requires a **documentation update** - notify the documentation team
- If this change has particular **deployment requirements** - notify the DevOps team
- Ensure that all UI additions follow [WCAG AA requirements](https://contributing.bitwarden.com/contributing/accessibility/)
2023-12-22 10:31:24 -05:00
Shane Melton
a19a4ffdf7
[AC-1879] Add null check for collection view helpers (#7073)
* [AC-1879] Add null check for collection view helpers

* [AC-1879] Add additional null check to organization-options.component.ts
2023-12-21 15:51:48 -08:00
SmithThe4th
07d224d6bc
[PM-4239] When viewing an item with a passkey, passkey is not announced by screenreader (#7154)
* Made passkey field focusable

* Made passkey field focusableand accessibilty possible for screenreaders in announcing the field
2023-12-21 10:54:54 -05:00
cyprain-okeke
de04bc4410
[AC-1753] Automatically assign provider's pricing to new organizations (#7228)
* changes for the msp task

* fix an issues

* resolve pr comment
2023-12-20 22:55:30 +01:00
Will Martin
44fa727fc1
[CL-159] add bottom border to bit-banner (#7230)
* add bottom border to banner

* Update libs/components/src/banner/banner.component.html

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

---------

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
2023-12-19 17:23:13 -05:00
Jared Snider
9544da28c7
PM-5304 - Sync Service - setForceSetPasswordReasonIfNeeded(...) - Add bandaid to early return if state gets corrupted with undefined acctDecryptionOpts so that the sync won't error and prevent users from accessing their data added on another device. (#7265) 2023-12-19 22:04:25 +00:00
Oscar Hinton
017da06f9a
[CL-160] Rename BadgeType to BadgeVariant (#7244)
We're establishing a common language for the Component Library. As part of this work we're renaming componentType to variant. Starting with badges.
2023-12-19 19:22:37 +01:00
Shane Melton
cdb59f0939
[AC-1982] Add AllowAdminAccessToAllCollectionItems setting to the organization (#7268) 2023-12-19 11:32:53 +10:00
Jonathan Prusik
f04cd7eeef
autofill overlay visibility setting should be off by default (#7266) 2023-12-18 18:10:47 -05:00
Matt Gibson
87b6651f8e
[pm-5287] fix account switch logout routing (#7231)
* Navigate to home from account switcher

Also updates the main background handling of logout to either finish switch or logout, depending on which occurred

* Prefer observable guards

we were racing the account switch process on `accountService` and this async guard. It only depended on account status, which is available from `accountService`, so the correct move was to observe that status.

The unauthGuardFn allows for updating homepage depending on window state because popout windows have different nav to other locations.
2023-12-18 14:23:43 -05:00
Matt Gibson
69657a5ab5
Ps/allow state provider migrations from v 9 (#7263)
* Provide missing spec helpers and fakers

* We need to be able to migrate v9 stuff to state providers
2023-12-18 07:50:04 -05:00
Will Martin
4d5c955018
[CL-152] undeprecate openSimpleDialogRef (#7232) 2023-12-15 11:22:19 -05:00
Will Martin
e102919c2f
[CL-133] add skip links to bit-layout (#7213)
* Add light LinkType to link directive

* add skip link to bit-layout; update i18n for all apps

* install storybook interaction testing packages

* update storybook config

* add skiplink story to bit-layout

* update route and focus logic

* remove focus ring
2023-12-15 09:06:05 -05:00
Will Martin
b73d73b508
create team owned libs for billing, admin-console, platform (#7233)
* add admin-console lib files

* add billing lib files

* add platform lib files

* update lib references in config files

* update package-lock
2023-12-15 09:02:21 -05:00
bharat
96d1c83385
[PM-4077] safeincloud multiple url fix (#6394)
* safeincloud multiple url fix
* Ensure LoginView.uris is consistently populated
2023-12-14 16:40:51 +00:00
Justin Baur
7abbe0dafd
State definitions tests (#7173)
* Add StateDefinition Tests and Rules

* Update Comments
2023-12-14 10:00:36 -05:00
Daniel James Smith
60d9f3d150
[PM-1925][PM-2741][AC-1334] flexible collections export page (#5759)
* Use bitTypography for page title

* Replaced app-callout with bit-callout

* Replace button with bit-button

* Update radio buttons to use CL

* Use searchable select for fileFormat dropdown

* Remove unneeded divs (old styling)

* pm-1826 remove eslint-disable tailwindcss/no-custom-classname

* Removed for-attribute from bit-labels

* Removed bitInput from bit-selects

* Removed name-attribute from bit-selects

* Make format a required field

* Removed unused dependency on cryptoService

* Remove unused dependency on BroadcasterService

* Removed dependency on window

* Moved organizationId into BaseExportComponent

* Add vaultSelector

Add organizationService as new dependency
Retrieve organizations a user has access to
Add vaultSelector dropdown
Add `export from` label
Add exportFromHint

* Removed hint as discussed by product&design

* Add function to check for import/export permission

* Export callout should listen to changes

Even though the organizationId was changed, the Input did not trigger changing the scope

* Reading FlexibleCollections feature flag to show the vault-selector on export (#7196)

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com>
2023-12-14 13:55:54 +01:00
Daniel James Smith
3c7f369e40
[PM-5164] Update description of passwordsafe xml importer (#7115)
* Add comment to the PasswordSafeXmlImporter to show it's the one from pwsafe.org and not from passwordsafe.com

* Update dropdown value for pwsafexml, toshow it's from pwsafe.org

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2023-12-13 12:16:27 -05:00
Matt Gibson
fd85d13b18
Ps/avoid state emit until updated (#7198)
* Add a small default time to limit timing failures

* Handle subscription race conditions

* Add Symbols to tracked emission types

This is a bit of a cheat, but Symbols can't be cloned, so
we need to nudge them to something we can handle.
They are rare enough that anyone hitting this is likely to
expect some special handling.

* Ref count state listeners to minimize storage activity

* Ensure statuses are updated

* Remove notes

* Use `test` when gramatically more proper

* Copy race and subscription improvements to single user

* Simplify observer initialization

* Correct parameter names

* Simplify update promises

test we don't accidentally deadlock along the `getFromState` path

* Fix save mock

* WIP: most tests working

* Avoid infinite update loop

* Avoid potential deadlocks with awaiting assigned promises

We were awaiting a promise assigned in a thenable. It turns out that
assignment occurs before all thenables are concatenated, which can cause
deadlocks. Likely, these were not showing up in tests because we're
using very quick memory storage.

* Fix update deadlock test

* Add user update tests

* Assert no double emit for multiple observers

* Add use intent to method name

* Ensure new subscriptions receive only newest data

TODO: is this worth doing for active user state?

* Remove unnecessary design requirement

We don't need to await an executing update promise, we
can support two emissions as long as the observable is
guaranteed to get the new data.

* Cleanup await spam

* test cleanup option behavior

* Remove unnecessary typecast

* Throw over coerce for definition options

* Fix state$ observable durability on cleanup
2023-12-13 08:06:24 -05:00
✨ Audrey ✨
df406a9862
[PM-252] fix inconsistent generator configuration behavior (#6755)
* decompose password generator policy enforcement
* integrate new logic with UI
* improve UX of minimum password length
* improve password generator policy options documentation
* initialize min length to default minimum length boundary
* reset form value on input to prevent UI desync from model

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2023-12-12 19:17:20 -05:00
Will Martin
02ba26e53c
[AC-1786] deprecate manager role (#6931)
* add deprecation message

* hide manager option

* deprecate manager enum
2023-12-12 09:43:47 -05:00
Matt Gibson
08b69fffe1
Revert "Ps/avoid state emit until updated (#7124)" (#7187)
This reverts commit 38c335d8fb.
2023-12-12 08:07:42 -05:00
Will Martin
79dbe051c8
[AC-1747] deprecate access control indicator (#6796)
---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2023-12-11 22:40:11 -05:00
Matt Gibson
38c335d8fb
Ps/avoid state emit until updated (#7124)
* Add a small default time to limit timing failures

* Handle subscription race conditions

* Add Symbols to tracked emission types

This is a bit of a cheat, but Symbols can't be cloned, so
we need to nudge them to something we can handle.
They are rare enough that anyone hitting this is likely to
expect some special handling.

* Ref count state listeners to minimize storage activity

* Ensure statuses are updated

* Remove notes

* Use `test` when gramatically more proper

* Copy race and subscription improvements to single user

* Simplify observer initialization

* Correct parameter names

* Simplify update promises

test we don't accidentally deadlock along the `getFromState` path

* Fix save mock

* WIP: most tests working

* Avoid infinite update loop

* Avoid potential deadlocks with awaiting assigned promises

We were awaiting a promise assigned in a thenable. It turns out that
assignment occurs before all thenables are concatenated, which can cause
deadlocks. Likely, these were not showing up in tests because we're
using very quick memory storage.

* Fix update deadlock test

* Add user update tests

* Assert no double emit for multiple observers

* Add use intent to method name

* Ensure new subscriptions receive only newest data

TODO: is this worth doing for active user state?

* Remove unnecessary design requirement

We don't need to await an executing update promise, we
can support two emissions as long as the observable is
guaranteed to get the new data.

* Cleanup await spam

* test cleanup option behavior

* Remove unnecessary typecast

* Throw over coerce for definition options
2023-12-11 20:32:39 -05:00
Rui Tomé
483a197e4d
[AC-1139] Flexible collections: deprecate Manage/Edit/Delete Assigned Collections custom permissions (#6906)
* [AC-1139] Add new layout for MemberDialogComponent when FC feature flag is enabled

* [AC-1139] Deprecated Organization canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections

* [AC-1139] Checking if FC feature flag is enabled when using canDeleteAssignedCollections or canViewAssignedCollections

* [AC-1139] Added missing parameter to customRedirect

* [AC-1139] Fixed canEdit permission

* [AC-1139] Fixed CanDelete logic

* [AC-1139] Changed canAccessVaultTab function to receive configService

* Override deprecated values on sync

* [AC-1139] Reverted change that introduced ConfigService as a parameter to canAccessVaultTab

* [AC-1139] Fixed circular dependency

* [AC-1139] Moved overriding of deprecated values to syncService

* Revert "[AC-1139] Fixed circular dependency"

This reverts commit 6484420976.

* Revert "Override deprecated values on sync"

This reverts commit f0c25a6996.

* [AC-1139] Added back the deprecation of methods canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections

* [AC-1139] Reverted change on syncService

* [AC-1139] Override deprecated values on sync

* [AC-1139] Fix canDelete logic in
collection-dialog.component.ts and
bulk-delete-dialog.component.ts

* [AC-1139] Moved override logic from syncService to organizationService

* [AC-1139] Add ability to have titlecase titles on nested-checkbox.component checkboxes; use on member-dialog.component

* Revert "[AC-1139] Add ability to have titlecase titles on nested-checkbox.component checkboxes; use on member-dialog.component"

This reverts commit 9ede0fc5ac.

* [AC-1139] Fix bulk delete functionality

* [AC-1139] Refactor canEdit and canDelete to use ternary operator

* [AC-1139] Fix canDelete condition in VaultComponent

---------

Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2023-12-08 18:07:52 +00:00
Will Martin
0b6af73435
[CL-149] add stacked banner story (#7106) 2023-12-08 11:49:20 -05:00
Will Martin
04741bcab4
[CL-135] update CL migration docs (#6926) 2023-12-08 11:37:03 -05:00
Oscar Hinton
5a3ac7d73e
[CL-155] Add support for hiding the close button on banner (#7142) 2023-12-08 17:15:57 +01:00
ttalty
c4b31c9f8f
Tools/pm 3567 import xxe detection (#6918)
* RegEx to prevent external entities from being imported in xml

* Adding the test case

* Changing the regex and updating test case description
2023-12-08 09:50:02 -05:00
Todd Martin
2b3faca86b
Move PasswordStrengthComponent to Tools (#7125)
* Moved password-strength component to Tools

* Move zxcvbn into Tools ownership

zxcvbn is the library currently used to calculate the password-strength

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2023-12-07 14:11:05 -05:00