* 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>
* 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
* [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
* 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
* [AC-1899] Only take the first emission of feature flags and organizations to avoid overwriting form values
* [AC-1899] Fix flexibleCollections flag to update when selected org changes
* [AC-1899] Prettier
* [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
* 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
* 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>
* [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>
* [PM-5976] Safari Browser SSO Initialization Race Condition Attempted Fix 3
* [PM-5976] Safari Browser SSO Initialization Race Condition Attempted Fix 3
* [PM-5976] Removing usage of pinging system and keeping reworked top-level registration of window message listener events
* [PM-5976] Pulling the implementation of the static content script delcaration for the content-message-handler file to the top of the list of content_scripts
* [PM-5976] Pulling the implementation of the static content script delcaration for the content-message-handler file to the top of the list of content_scripts
* [PM-5976] Removing the useCapture value within the window message event listener
* Implementing pinging system for SSO to address issue on Safari with race condition
* Implementing pinging system for SSO to address issue on Safari with race condition
* [PM-5976] Updating references within sso.ts
---------
Co-authored-by: Cesar Gonzalez <cgonzalez@bitwarden.com>
* PM-5976 - Only try to initiate browser SSO when document is ready to avoid race condition between browser content script message listener being registered and the browser sso initiating message being sent.
* PM-5976 - adjust initiateBrowserSsoIfDocumentReady per PR feedback
* 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>
* 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>
* 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
* 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.
* 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>
* keep collections in filters highlighted when featureflag is on and user navigates to a specific collection
* apply flexible collections logic to the bitcrumbs and filters in org view
* 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
* 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>
* Permissions Column added to Org Vault. Other updates to filter section and Can Manage Permission added and put behind feature flag
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
* update collection dialog access copy based on allowAdminAccessToAllCollectionItems setting
* remove requirement to have a Can Manage user if v1 flag is off or admins have access to all collections
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* wip
* Running prettier after npm ci
* Defects AC-1929 AC-1955 AC-1956
* Setting plan and product to Teams if adding an org from a provider
* Updated logic to correctly set seat count depending on how you approach the upgrade flow
* Moved logic setting seat count to changedProduct
* Setting sm seats when upgrading to the current count
* Setting max storage if the organization's current plan has it set above the base
* Refactored logic in changedProduct to be a bit more concise. Added logic for handling sm service accounts and storage increases
* Decomposed the logic in changedProduct
* Resolved defects introduced in the merge conflict
* Changes after executing `npm run prettier`
---------
Co-authored-by: Alex Morask <amorask@bitwarden.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* wip
* Running prettier after npm ci
* Defects AC-1929 AC-1955 AC-1956
* Updated logic to correctly set seat count depending on how you approach the upgrade flow
* Setting sm seats when upgrading to the current count
* Setting max storage if the organization's current plan has it set above the base
* Refactored logic in changedProduct to be a bit more concise. Added logic for handling sm service accounts and storage increases
* Decomposed the logic in changedProduct
* Resolved defects introduced in the merge conflict
---------
Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
## 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/)
* PM-1658 - Update Accept Organization component to take new org invite qParams into acct for accelerating the user through the org invite accept process.
* PM-1658 - Update trial initiation and register form comps to respect fromOrgInvite when email is populated to make the populated email read only so users in the org invite process dont change it.
* PM-1658 - Per PR feedback, we could simplify the logic by only sending the org sso identifier if it was required to be used.
* PM-1658 - Accept Comp - should send existing user email as qParam to get it to autofill properly. Previous "autofill" was due to using remember email when creating an account before testing the existing user inv flow.
* 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
* 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>
* 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>
Class based router guards are deprecated as of Angular 15.2, per angular.io/guide/deprecations#router-class-and-injection-token-guards. To simplify future angular upgrades we need to resolve these deprecations.
This PR migrates the HasPremium and DebounceNavigationService guards to use the new functional pattern.
* [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>
* 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>
* Adding the password complexity component to the password protected valut export
* Removing the zxcvbn import as the component handles the strength check
Assign ownership to many of the remaining libs/common files.
Criteria for ownership:
* Files used by a single team, is now owned by that team.
* Files related to a domain owned by a team is now owned by that team.
* Where ownership is unclear the "lowest level" service takes ownership.
* PM-2041 - (1) Bring over WebauthnApiService + required models from existing #5493 PR (2) Per discussion with Andreas, remove unnecessary methods from WebauthnApiService
* PM-2041 - Rename responses folder to response to match rest of codebase
* PM-2041 - Recreate BaseLoginViaWebAuthnComponent and then web implementation of it.
* PM-2041 - Web routing module - add LoginViaWebAuthnComponent and associated route "login-with-passkey"
* PM-2041 - InjectionTokens - add new navigator credentials injection token which provides the CredentialsContainer interface of the Credential Management API and exposes methods to request credentials and notify the user agent when events such as successful sign in or sign out happen
* PM-2041 - Rename WebauthnApiService & abstraction to WebAuthnLoginApiService
* PM-2041 - Rename WebauthnLoginApiService to WebAuthnAdminApiService
* PM-2041 - Bring over first draft of webauthn-login.service + abstraction; register on jslib-services.module.
* PM-2041 - Bring over web & base login component changes to add login with passkey button if feature flag enabled.
* PM-2041 - WebAuthnAdminApi - update list of TODOs based on conversation with Andreas
* PM-2041 - Login.module - cleanup todo after conversation w/ Andreas
* PM-2041 - Move utils out of web and into common auth/utils and renamed to webauthn-utils
* PM-2041 - Update userDecryptionOptions to support new webauthn prf decryption option
* PM-2041 - (1) Recreate webauthn-login service with updated logic (2) Move files from webauthn to webauthn-login (3) Recreate webauthn-login.strategy with updated logic
* PM-2041 - Remove completed TODO
* PM-2041 - Fix login-via-webauthn component imports + fix name (missing n)
* PM-2041 - Missed this change when renaming LoginViaWebAuthComponent to LoginViaWebAuthnComponent
* PM-2041 - Add WebAuthnLoginApiService to jslib-services.module
* PM-2041 - Remove unused param from WebAuthnLoginApiServiceAbstraction as we aren't supporting non-discoverable passkeys for MVP
* PM-2041 - WebAuthnLoginApiService - remove email and target correct endpoint for getCredentialAssertionOptions(...) call
* PM-2041 - WebAuthnLoginStrategy - (1) Remove unused dep (2) Add safeguard checks to setUserKey(...) logic similar to SSO login strategy
* PM-2041 - BaseLoginViaWebAuthnComponent - Rewrite authenticate logic to use new methods on webAuthnLoginService
* PM-2041 - UserDecryptionOptionsResponse - update naming of webAuthn options object to match server response
* PM-2041 - WebAuthnLoginAssertionResponseRequest - (1) clean up TODO (2) Fix response property name to match server
* PM-2041 - WebAuthnTokenRequest - must stringify device response b/c sending as form data
* PM-2041 - AuthService - Add WebAuthnLoginCredentials and WebAuthnLoginStrategy support to auth service
* PM-2041 - WIP tests for WebAuthnLoginService
* PM-2041 - UserDecryptionOptions - Rename WebAuthnPrfOptions to singular WebAuthnPrfOption to match server
* PM-2041 - Add TODO in login comp
* PM-2041 - (1) Update WebAuthnLoginService.assertCredential(...) to add a check to ensure we cannot leak PRF credentials to the BW server by mistake (2) Add credential to view names for clarity (3) Add JS doc style comments to WebAuthnLoginServiceAbstraction
* PM-2041 - Login.component.html - (1) Center passkey login button (2) Use correct user passkey icon
* PM-2041 - Utils + tests - (1) Add new hexStringToArrayBuffer(...) method (2) Add tests for existing fromBufferToHex(...) (3) Add tests for new hexStringToArrayBuffer(...) method
* PM-2041 - Fix broken import
* PM-2041 - WebAuthnLoginResponseRequest - Adjust warning to be correct
* PM-2041 - Webauthn-utils - createSymmetricKeyFromPrf(...) - add return type
* PM-2041 - WebAuthnLoginService spec file - good progress on figuring out how to test passkey assertion process. Tests are passing, but need to add more setup logic around the MockAuthenticatorAssertionResponse in order to be able to confirm the output is correct.
* PM-2041 - Utils + Utils Spec file changes - (1) Add new fromB64ToArrayBuffer(...) method (2) Add tests for existing fromBufferToB64(...) (3) Add tests for new fromB64ToArrayBuffer(...) method (4) Add round trip conversion tests in both directions
* PM-2041 - Utils.spec - update round trip conversion tests between hex string and array buffer.
* PM-2041 - WebAuthnLoginService.spec - assertCredential(...) happy path test passing
* PM-2041 - WebAuthnLoginAssertionResponseRequest - Add interface
* PM-2041 - WebAuthnLoginAssertionResponseRequest data should be UrlB64 strings per discussion w/ Andreas
* PM-2041 - WebAuthnLoginService Spec file - Per feedback, reverse approaches to generating test data (go from array buffer to b64 strings vs the reverse) to avoid using math.random which can introduce test inconsistency
* PM-2041 - Finish testing assertCredential(...)
* PM-2041 - WebAuthnLoginService tests completed - tested logIn method
* PM-2041 - Login html - add "or" between standard email login and passkey login
* PM-2041 - WebAuthnLoginStrategy test start
* PM-2041 - After rebase - BaseLoginViaWebAuthnComponent - Must rename ForceResetPasswordReason to ForceSetPasswordReason + refactor post login routing logic to match other auth owned flows.
* PM-2401 - Desktop - login comp - fix desktop build
* PM-2041 - Browser - login comp - fix build issue
* PM-2401 - WIP on webauthn-login.strategy testing
* PM-2401 - Finish testing webauthn login strategy
* PM-2041 - WebAuthnAdminApiService renamed to WebAuthnLoginAdminApiService
* PM-2041 - Remove unnecessary comment
* PM-2041 - Per PR feedback, remove noMargin and just add mb-3
* PM-2041 - Per PR feedback, remove unused 2FA and remember email logic (2FA isn't supported right now and we aren't using non-discoverable credentials so we aren't using a user entered email)
* PM-2401 - BaseLoginViaWebAuthnComponent - improve error handling to allow users to retry w/ another passkey
* PM-2401 - Per PR feedback, provide translated message to cover all invalid passkey scenarios.
* PM-2401 - WebAuthnLoginService - per PR feedback, remove unnecessary from
* PM-2041 - WebAuthnLoginCredentialAssertionView - per PR feedback, use actual key type
* PM-2401 - Per PR feedback, remove WebAuthnLoginStrategy constructor as it is identical to its super class constructor
* PM-2041 - WebAuthnLoginService tests - use first value from to improve tests
* PM-2401 - Fix WebAuthnLoginService build issue after changing SymmetricCryptoKey to PrfKey
* PM-2041 - WebAuthnLoginServiceAbstraction remove incorrect undefined from getCredentialAssertionOptions() abstraction
* PM-2041 - Refacor WebAuthn login service tests based on PR feedback
* PM-2041 - Per PR feedback, remove NAVIGATOR_CREDENTIALS injection token and just use WINDOW directly for WebAuthnLoginService
* PM-2041 - WebAuthnLoginServiceAbstraction - per PR feedback, improve assertCredential jsdocs with return info
* PM-2041 - Per PR feedback, update WebAuthnLoginStrategy logInTwoFactor(...) to return an exception if attempted to be called.
* PM-2041 - WebAuthnLoginResponseRequest - per PR feedback, replace fromBufferToB64(...) with fromBufferToUrlB64(...)
* PM-2041 - AssertionOptionsResponse - use doc comment per PR feedback
* PM-2041 - Per PR feedback, adjust location of helpers and mocks in WebAuthnLoginStrategy test file
* PM-2041 - Adjust WebAuthnLoginService tests to take the WebAuthnLoginResponseRequest change to use fromBufferToUrlB64(...) into account to get tests to pass again
* PM-2041 - WebAuthnLoginStrategy - adjust test name to match convention per PR feedback
* PM-2041 - More test tweaks - (1) Rename method (2) Support strict
* PM-2041 - Per PR feedback, AssertionOptionsResponse constructor should null check allowCredentials b/c it is optional
* PM-2041 - Per PR Feedback, remove duplicated fromB64ToArrayBuffer(...) from utils and update tests.
* PM-2041 - Per PR feedback, rename WebAuthnTokenRequest to WebAuthnLoginTokenRequest
* PM-2041 - Per discussion with product and Andreas, add 2FA transition handling just in case we add server support in the future.
* feat: stretch PRF key (#6927)
* feat: stretch PRF key
includes necessary utils -> service refactors
* feat: add tests
* [PM-2041] feat: assertion-options `POST` -> `GET`
* [PM-2041] chore: remove unused properties
* [PM-2041] fix: set private key
* [PM-2041] feat: remove all 2FA related fields
* [PM-2041] chore: clean up 2FA comments
* [PM-2041] chore: document `webauthn-login-prf-crypto.service.abstraction.ts`
* [PM-2041] chore: document webauthn login services
---------
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
* added previous-url to global-state
* updated storage of previousUrl for SSO/MFA flows
* revert file changes
* added post login routing
* Clear PreviousUrl from storage on new Login
* Components do not call StateService anymore
* removed needed query params
* refactored components to use RouterService
* fixed build error
* fixed mfa component
* updated logic for previous Url
* removed unneeded base implementation
* Added state call for Redirect Guard
* Fixed test cases
* Remove routing service calls
* renamed global field, changed routing to guard
* reverting constructor changes and git lint issue
* fixing constructor ordering
* fixing diffs to be clearer on actual cahnges.
* addressing accepting emergency access case
* refactor and add locked state logic
* refactor name of guard to be more clear
* Added comments and tests
* comments + support lock page deep linking + code ownership
* readability updates
* Combined guards and specs updated routing
* Update oss-routing.module.ts
* fixed stroybook build
* Allow for update logic in state update callbacks
* Prefer reading updates to sending in stream
* Inform state providers when they must deserialize
* Update DefaultGlobalState to act more like DefaultUserState
* Fully Implement AbstractStorageService
* Add KeyDefinitionOptions
* Address PR feedback
* Prefer testing interactions for ports
* Synced memory storage for browser
* Fix port handling
* Do not stringify port message data
* Use messaging storage
* Initialize new foreground memory storage services
This will need to be rethought for short-lived background pages, but for
now the background is the source of truth for memory storage
* Use global state for account service
* Use BrowserApi listener to avoid safari memory leaks
* Fix build errors: debugging and missed impls
* Prefer bound arrow functions
* JSON Stringify Messages
* Prefer `useClass`
* Use noop services
* extract storage observable to new interface
This also reverts changes for the existing services to use
foreground/background services. Those are now used only in state
providers
* Fix web DI
* Prefer initializing observable in constructor
* Do not use jsonify as equality operator
* Remove port listener to avoid memory leaks
* Fix logic and type issues
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>