passbolt-browser-extension 5.16.1 → 5.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pre-commit-config.yaml +6 -2
- package/CHANGELOG.md +210 -1
- package/README.md +2 -2
- package/RELEASE_NOTES.md +3 -4
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager/AppDelegate.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager/ViewController.swift +15 -15
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/SafariWebExtensionHandler.swift +5 -5
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/AbstractController.swift +5 -5
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/ErrorController.swift +2 -2
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/FetchController.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/OpenSafariSettingsController.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/SaveFileController.swift +2 -2
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/controllers/WriteClipboardController.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/services/fetch/SecureProfileSessionManager.swift +36 -30
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/services/fetch/fetchService.swift +24 -24
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/services/file/SaveFileService.swift +15 -15
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/utils/ErrorSerializer.swift +13 -13
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Extension/utils/LocatedError.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/SafariWebExtensionHandlerTests.swift +3 -3
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/AbstractControllerTests.swift +2 -2
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/ErrorControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/FetchControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/OpenSafariSettingsControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/SaveFileControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/controllers/WriteClipboardControllerTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/services/fetch/FetchServiceTests.swift +1 -1
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/services/fetch/SecureProfileSessionManagerTests.swift +7 -7
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/utils/ErrorSerializerTests.swift +17 -17
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager Tests/utils/LocatedErrorTests.swift +12 -12
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager.xcodeproj/project.pbxproj +12 -14
- package/eslint.config.mjs +3 -35
- package/jest.config.json +1 -2
- package/package.json +45 -51
- package/src/all/_locales/locales.test.js +2 -0
- package/src/all/background_page/controller/InformMenuController/InformMenuController.test.js +45 -1
- package/src/all/background_page/controller/accountRecovery/accountRecoverySaveUserSettingController.js +1 -2
- package/src/all/background_page/controller/accountRecovery/accountRecoverySaveUserSettingController.test.js +10 -8
- package/src/all/background_page/controller/accountRecovery/accountRecoveryValidatePublicKeyController.test.js +1 -1
- package/src/all/background_page/controller/accountRecovery/recoverAccountController.js +4 -0
- package/src/all/background_page/controller/accountRecovery/recoverAccountController.test.js +5 -1
- package/src/all/background_page/controller/auth/authLocalLogoutController.js +3 -14
- package/src/all/background_page/controller/auth/authLocalLogoutController.test.js +3 -3
- package/src/all/background_page/controller/auth/authLoginController.js +2 -2
- package/src/all/background_page/controller/auth/authOfflineLogoutController.js +4 -12
- package/src/all/background_page/controller/auth/authOfflineLogoutController.test.js +3 -3
- package/src/all/background_page/controller/auth/{findAndUpdateActiveSessionLocalStorageController.js → findAndUpdateActiveSessionSessionStorageController.js} +6 -6
- package/src/all/background_page/controller/auth/{findAndUpdateActiveSessionLocalStorageController.test.js → findAndUpdateActiveSessionSessionStorageController.test.js} +30 -30
- package/src/all/background_page/controller/auth/getOrFindActiveSessionController.test.js +22 -20
- package/src/all/background_page/controller/auth/isMfaRequiredController.js +5 -4
- package/src/all/background_page/controller/auth/isMfaRequiredController.test.js +3 -3
- package/src/all/background_page/controller/crypto/getUserKeyInfoController.test.js +1 -1
- package/src/all/background_page/controller/crypto/getUserPrivateKeyController.test.js +1 -1
- package/src/all/background_page/controller/extension/onExtensionInstalledController.js +61 -30
- package/src/all/background_page/controller/extension/onExtensionInstalledController.test.js +131 -19
- package/src/all/background_page/controller/informCallToActionController/informCallToActionController.js +4 -2
- package/src/all/background_page/controller/informCallToActionController/informCallToActionController.test.js +50 -2
- package/src/all/background_page/controller/mfaPolicy/mfaGetMfaSettingsController.test.js +13 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupAbortWebauthnCeremonyController.js +52 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupAbortWebauthnCeremonyController.test.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupBeginWebauthnCeremonyController.js +52 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupBeginWebauthnCeremonyController.test.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupDeleteWebauthnCredentialController.js +55 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupDeleteWebauthnCredentialController.test.js +55 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupFinishWebauthnCeremonyController.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupFinishWebauthnCeremonyController.test.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnCredentialsController.js +54 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnCredentialsController.test.js +61 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnSettingsController.js +53 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupGetWebauthnSettingsController.test.js +57 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupHandleWebauthnCeremonyResultController.js +55 -0
- package/src/all/background_page/controller/mfaSetup/MfaSetupHandleWebauthnCeremonyResultController.test.js +52 -0
- package/src/all/background_page/controller/move/moveFolderController.js +12 -12
- package/src/all/background_page/controller/move/moveFolderController.test.js +31 -1
- package/src/all/background_page/controller/move/moveResourcesController.js +18 -5
- package/src/all/background_page/controller/move/moveResourcesController.test.js +68 -7
- package/src/all/background_page/controller/recover/completeRecoverController.js +4 -0
- package/src/all/background_page/controller/recover/completeRecoverController.test.js +5 -1
- package/src/all/background_page/controller/resource/setResourcesExpiryDateController.test.js +1 -1
- package/src/all/background_page/controller/sessionTimestamps/getSessionTimestampsController.js +54 -0
- package/src/all/background_page/controller/sessionTimestamps/getSessionTimestampsController.test.js +91 -0
- package/src/all/background_page/controller/setup/completeSetupController.js +4 -0
- package/src/all/background_page/controller/setup/completeSetupController.test.js +5 -1
- package/src/all/background_page/controller/share/shareResourcesController.test.js +2 -2
- package/src/all/background_page/controller/sso/getQualifiedSsoLoginErrorController.test.js +1 -1
- package/src/all/background_page/controller/sso/hasSsoLoginErrorController.test.js +1 -1
- package/src/all/background_page/controller/subscription/createSubscriptionKeyController.js +3 -3
- package/src/all/background_page/controller/subscription/createSubscriptionKeyController.test.js +4 -4
- package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.js +3 -3
- package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.test.js +4 -4
- package/src/all/background_page/controller/theme/findThemesController.js +52 -0
- package/src/all/background_page/controller/theme/findThemesController.test.js +68 -0
- package/src/all/background_page/controller/theme/updateThemeController.js +55 -0
- package/src/all/background_page/controller/theme/updateThemeController.test.js +76 -0
- package/src/all/background_page/controller/user/getOrFindLoggedInUserController.test.js +2 -2
- package/src/{chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.js → all/background_page/error/webauthnAlreadyRunningCeremonyError.js} +7 -14
- package/src/all/background_page/error/webauthnAuthenticatorAlreadyRegisteredError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyAbortedError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyCancelledError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyError.js +26 -0
- package/src/all/background_page/error/webauthnCeremonyNotFoundError.js +26 -0
- package/src/all/background_page/error/webauthnTLSCertificateError.js +24 -0
- package/src/all/background_page/event/appBootstrapEvents.js +32 -0
- package/src/all/background_page/event/appBootstrapEvents.test.js +31 -0
- package/src/all/background_page/event/appEvents.js +1 -26
- package/src/all/background_page/event/authEvents.js +2 -2
- package/src/all/background_page/event/configEvents.js +0 -12
- package/src/all/background_page/event/folderEvents.js +5 -4
- package/src/all/background_page/event/informCallToActionEvents.js +3 -2
- package/src/all/background_page/event/informMenuEvents.js +2 -2
- package/src/all/background_page/event/mfaEvents.js +38 -1
- package/src/all/background_page/event/quickAccessEvents.js +12 -0
- package/src/all/background_page/event/resourceEvents.js +9 -5
- package/src/all/background_page/event/themeEvents.js +9 -21
- package/src/all/background_page/index.js +16 -0
- package/src/all/background_page/model/auth/authModel.js +3 -3
- package/src/all/background_page/model/auth/authModel.test.js +2 -2
- package/src/all/background_page/model/entity/export/exportResourcesFileEntity.js +2 -0
- package/src/all/background_page/model/entity/export/exportResourcesFileEntity.test.js +1 -0
- package/src/all/background_page/model/entity/folder/foldersCollection.js +13 -9
- package/src/all/background_page/model/entity/folder/foldersCollection.test.data.js +35 -0
- package/src/all/background_page/model/entity/folder/foldersCollection.test.js +60 -0
- package/src/all/background_page/model/entity/import/importResourcesFileEntity.test.data.js +5 -0
- package/src/all/background_page/model/entity/mfa/mfaEnabledProviderEntity.js +11 -0
- package/src/all/background_page/model/entity/mfa/mfaEnabledProviderEntity.test.js +13 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialEntity.js +126 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialEntity.test.data.js +26 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialEntity.test.js +105 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.js +52 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.test.data.js +22 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.test.js +60 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnSettingsEntity.js +45 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnSettingsEntity.test.data.js +17 -0
- package/src/all/background_page/model/entity/mfa/mfaWebauthnSettingsEntity.test.js +48 -0
- package/src/all/background_page/model/entity/mfa/webauthnCredentialCreationOptionsEntity.js +235 -0
- package/src/all/background_page/model/entity/mfa/webauthnCredentialCreationOptionsEntity.test.data.js +42 -0
- package/src/all/background_page/model/entity/mfa/webauthnCredentialCreationOptionsEntity.test.js +152 -0
- package/src/all/background_page/model/entity/mfa/webauthnRegistrationResponseEntity.js +72 -0
- package/src/all/background_page/model/entity/mfa/webauthnRegistrationResponseEntity.test.data.js +26 -0
- package/src/all/background_page/model/entity/mfa/webauthnRegistrationResponseEntity.test.js +83 -0
- package/src/all/background_page/model/entity/mfa/webauthnSetupCeremonyEntity.js +121 -0
- package/src/all/background_page/model/entity/mfa/webauthnSetupCeremonyEntity.test.data.js +36 -0
- package/src/all/background_page/model/entity/mfa/webauthnSetupCeremonyEntity.test.js +100 -0
- package/src/all/background_page/model/entity/permission/change/permissionChangesCollection.js +0 -59
- package/src/all/background_page/model/entity/permission/change/permissionChangesCollection.test.js +0 -333
- package/src/all/background_page/model/entity/sso/ssoLoginUrlEntity.js +1 -1
- package/src/all/background_page/model/entity/theme/themeEntity.test.data.js +12 -0
- package/src/all/background_page/model/entity/theme/themesCollection.test.data.js +10 -1
- package/src/all/background_page/model/entity/userAndGroupSearchResultEntity/userAndGroupSearchResultEntity.js +1 -1
- package/src/all/background_page/model/entity/userAndGroupSearchResultEntity/userAndGroupSearchResultEntity.test.js +19 -1
- package/src/all/background_page/model/export/resources/csvRowComposer/abstractRowComposer.js +8 -0
- package/src/all/background_page/model/export/resources/csvRowComposer/csvNetwrixRowComposer.js +67 -0
- package/src/all/background_page/model/export/resources/csvRowComposer/csvNetwrixRowComposer.test.js +37 -0
- package/src/all/background_page/model/export/resources/resourcesCsvExporter.js +5 -2
- package/src/all/background_page/model/export/resources/resourcesCsvExporter.test.js +3 -1
- package/src/all/background_page/model/import/resources/csvRowParser/csvNetwrixRowParser.js +98 -0
- package/src/all/background_page/model/import/resources/csvRowParser/csvNetwrixRowParser.test.js +145 -0
- package/src/all/background_page/model/import/resources/resourcesCsvImportParser.js +2 -0
- package/src/all/background_page/model/import/resources/resourcesCsvImportParser.test.js +19 -1
- package/src/all/background_page/model/keyring.test.js +1 -1
- package/src/all/background_page/model/multiFactorAuthentication/multiFactorAuthenticationModel.test.js +1 -1
- package/src/all/background_page/model/user/userModel.test.js +1 -1
- package/src/all/background_page/model/user.js +2 -2
- package/src/all/background_page/model/userSettings/userSettings.js +1 -1
- package/src/all/background_page/pagemod/accountRecoveryBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/appBootstrapPagemod.js +8 -6
- package/src/all/background_page/pagemod/appBootstrapPagemod.test.js +15 -20
- package/src/all/background_page/pagemod/authBootstrapPagemod.js +2 -2
- package/src/all/background_page/pagemod/authBootstrapPagemod.test.js +7 -8
- package/src/all/background_page/pagemod/pagemod.js +3 -1
- package/src/all/background_page/pagemod/pagemod.test.js +1 -1
- package/src/all/background_page/pagemod/pagemodManager.test.js +14 -20
- package/src/all/background_page/pagemod/publicWebsiteSignInPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/recoverBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/setupBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/webIntegrationPagemod.js +2 -2
- package/src/all/background_page/pagemod/webIntegrationPagemod.test.js +10 -10
- package/src/all/background_page/sdk/port/portManager.js +13 -1
- package/src/all/background_page/sdk/port/portManager.test.js +98 -0
- package/src/all/background_page/service/accountRecovery/decryptPrivateKeyPasswordDataService.js +1 -1
- package/src/all/background_page/service/accountRecovery/decryptResponseDataService.js +1 -1
- package/src/all/background_page/service/accountRecovery/parseAccountRecoveryUrlService.js +1 -1
- package/src/all/background_page/service/accountRecovery/validateOrganizationPublicKeyService.test.js +1 -1
- package/src/all/background_page/service/activeSession/{findAndUpdateActiveSessionLocalStorageService.js → findAndUpdateActiveSessionSessionStorageService.js} +27 -60
- package/src/all/background_page/service/activeSession/findAndUpdateActiveSessionSessionStorageService.test.js +720 -0
- package/src/all/background_page/service/activeSession/getOrFindActiveSessionService.js +8 -8
- package/src/all/background_page/service/activeSession/getOrFindActiveSessionService.test.js +16 -16
- package/src/all/background_page/service/api/accountSettings/accountSettingsService.js +0 -29
- package/src/all/background_page/service/api/accountSettings/accountSettingsService.test.data.js +0 -6
- package/src/all/background_page/service/api/accountSettings/accountSettingsService.test.js +1 -32
- package/src/all/background_page/service/api/actionLog/actionLogApiService.test.js +1 -1
- package/src/all/background_page/service/api/comment/commentApiService.test.js +1 -1
- package/src/all/background_page/service/api/metadata/metadataKeysApiService.test.js +1 -1
- package/src/all/background_page/service/api/mfa/webauthnApiService.js +76 -0
- package/src/all/background_page/service/api/mfa/webauthnApiService.test.js +119 -0
- package/src/all/background_page/service/api/mfa/webauthnSettingsApiService.js +44 -0
- package/src/all/background_page/service/api/mfa/webauthnSettingsApiService.test.js +56 -0
- package/src/all/background_page/service/api/sessionKey/sessionKeysBundlesApiService.test.js +1 -1
- package/src/all/background_page/service/api/theme/themesApiService.js +57 -0
- package/src/all/background_page/service/api/theme/themesApiService.test.js +83 -0
- package/src/all/background_page/service/app/parseAppUrlService.js +18 -10
- package/src/all/background_page/service/app/parseAppUrlService.test.js +21 -21
- package/src/all/background_page/service/auth/localLogoutService.js +42 -0
- package/src/all/background_page/service/auth/localLogoutService.test.js +43 -0
- package/src/all/background_page/service/auth/offlineLogoutService.js +47 -0
- package/src/all/background_page/service/auth/offlineLogoutService.test.js +46 -0
- package/src/all/background_page/service/auth/offlineSessionExpiryAlarmService.js +2 -2
- package/src/all/background_page/service/auth/offlineSessionExpiryAlarmService.test.js +3 -3
- package/src/all/background_page/service/auth/parseAuthUrlService.js +11 -6
- package/src/all/background_page/service/auth/parseAuthUrlService.test.js +11 -13
- package/src/all/background_page/service/auth/postLoginOfflineService.js +3 -3
- package/src/all/background_page/service/auth/postLoginOfflineService.test.js +3 -3
- package/src/all/background_page/service/auth/postLoginService.js +5 -4
- package/src/all/background_page/service/auth/postLoginService.test.js +4 -4
- package/src/all/background_page/service/auth/postLogoutService.js +2 -1
- package/src/all/background_page/service/auth/postLogoutService.test.js +24 -1
- package/src/all/background_page/service/auth/startLoopAuthSessionCheckService.js +8 -4
- package/src/all/background_page/service/auth/startLoopAuthSessionCheckService.test.js +36 -13
- package/src/all/background_page/service/authenticationStatusService.test.js +1 -1
- package/src/all/background_page/service/clipboard/clipboardProviderService.js +0 -7
- package/src/all/background_page/service/clipboard/clipboardProviderService.test.js +0 -10
- package/src/all/background_page/service/clipboard/copyToClipboardService.js +1 -5
- package/src/all/background_page/service/crypto/decryptSsoPassphraseService.js +1 -1
- package/src/all/background_page/service/extension/onExtensionUpdateAvailableService.test.js +2 -6
- package/src/all/background_page/service/extension/onStartUpService.js +2 -2
- package/src/all/background_page/service/extension/onStartUpService.test.js +3 -3
- package/src/all/background_page/service/group/groupUpdateSecretsCryptoService.js +1 -1
- package/src/all/background_page/service/group/groupUpdateService.js +1 -1
- package/src/all/background_page/service/group/groupUpdateService.test.js +3 -3
- package/src/all/background_page/service/localStorage/localStorageService.js +6 -2
- package/src/all/background_page/service/localStorage/localStorageService.test.js +31 -14
- package/src/all/background_page/service/local_storage/sessionTimestampsLocalStorage.js +40 -0
- package/src/all/background_page/service/local_storage/sessionTimestampsLocalStorage.test.js +63 -0
- package/src/all/background_page/service/metadata/rotateMetadata/rotateMetadataKeyService.test.js +2 -2
- package/src/all/background_page/service/metadata/rotateMetadata/rotateResourcesMetadataKeyService.test.js +2 -2
- package/src/all/background_page/service/mfa/validateWebauthnCreationOptionsService.js +41 -0
- package/src/all/background_page/service/mfa/validateWebauthnCreationOptionsService.test.js +52 -0
- package/src/all/background_page/service/mfa/webauthnSetupCeremonyService.js +266 -0
- package/src/all/background_page/service/mfa/webauthnSetupCeremonyService.test.js +437 -0
- package/src/all/background_page/service/migrateMetadata/migrateMetadataResourcesService.test.js +2 -2
- package/src/all/background_page/service/move/deserializeConfirmedMovePermissions.js +41 -0
- package/src/all/background_page/service/move/deserializeConfirmedMovePermissions.test.js +80 -0
- package/src/all/background_page/service/move/moveOneFolderService.js +88 -135
- package/src/all/background_page/service/move/moveOneFolderService.test.js +774 -5237
- package/src/all/background_page/service/move/moveResourcesService.js +68 -40
- package/src/all/background_page/service/move/moveResourcesService.test.data.js +53 -0
- package/src/all/background_page/service/move/moveResourcesService.test.js +559 -2090
- package/src/all/background_page/service/offline/canUseOfflineStorageService.js +16 -1
- package/src/all/background_page/service/offline/canUseOfflineStorageService.test.js +14 -6
- package/src/all/background_page/service/offline/getOrFindOfflineSettingsService.js +6 -2
- package/src/all/background_page/service/offline/getOrFindOfflineSettingsService.test.js +33 -1
- package/src/all/background_page/service/offline/offlineRetentionDataFlushService.js +12 -9
- package/src/all/background_page/service/offline/offlineRetentionDataFlushService.test.js +35 -24
- package/src/all/background_page/service/permission/calculatePermissionsChangesService.js +172 -0
- package/src/all/background_page/service/permission/calculatePermissionsChangesService.test.js +370 -0
- package/src/all/background_page/service/rbac/getOrFindRbacService.js +6 -2
- package/src/all/background_page/service/recover/parseRecoverUrlService.js +1 -1
- package/src/all/background_page/service/resource/export/exportResourcesService.test.js +3 -0
- package/src/all/background_page/service/resource/getOrFindOfflineResourcesService.js +30 -10
- package/src/all/background_page/service/resource/getOrFindOfflineResourcesService.test.js +108 -9
- package/src/all/background_page/service/resource/getOrFindResourcesService.js +30 -10
- package/src/all/background_page/service/resource/getOrFindResourcesService.test.js +99 -9
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.js +6 -2
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.test.js +29 -2
- package/src/all/background_page/service/secret/decryptAndParseResourceSecretService.js +1 -1
- package/src/all/background_page/service/sessionStorage/webauthnSetupCeremonySessionStorageService.js +62 -0
- package/src/all/background_page/service/sessionStorage/webauthnSetupCeremonySessionStorageService.test.js +60 -0
- package/src/all/background_page/service/sessionStorage/workersSessionStorage.js +30 -0
- package/src/all/background_page/service/sessionStorage/workersSessionStorage.test.js +55 -0
- package/src/all/background_page/service/sessionTimestamps/getSessionTimestampsService.js +48 -0
- package/src/all/background_page/service/sessionTimestamps/getSessionTimestampsService.test.js +66 -0
- package/src/all/background_page/service/sessionTimestamps/updateSessionTimestampsService.js +102 -0
- package/src/all/background_page/service/sessionTimestamps/updateSessionTimestampsService.test.js +221 -0
- package/src/all/background_page/service/{local_storage/activeSessionLocalStorage.js → session_storage/activeSessionSessionStorage.js} +17 -17
- package/src/all/background_page/service/{local_storage/activeSessionLocalStorage.test.js → session_storage/activeSessionSessionStorage.test.js} +31 -34
- package/src/all/background_page/service/setup/parseSetupUrlService.js +3 -2
- package/src/all/background_page/service/setup/parseSetupUrlService.test.js +195 -24
- package/src/all/background_page/service/share/shareFoldersService.js +20 -36
- package/src/all/background_page/service/share/shareFoldersService.test.js +240 -4
- package/src/all/background_page/service/share/shareResourceService.test.js +4 -4
- package/src/all/background_page/service/tab/tabService.js +3 -2
- package/src/all/background_page/service/theme/findThemesService.js +38 -0
- package/src/all/background_page/service/theme/findThemesService.test.js +63 -0
- package/src/all/background_page/service/theme/updateThemeService.js +39 -0
- package/src/all/background_page/service/theme/updateThemeService.test.js +65 -0
- package/src/all/background_page/service/toolbar/toolbarService.js +33 -15
- package/src/all/background_page/service/toolbar/toolbarService.test.js +82 -6
- package/src/all/background_page/service/ui/browserTab.service.js +6 -4
- package/src/all/background_page/service/ui/browserTab.service.test.js +19 -6
- package/src/all/background_page/service/user/getOrFindMeService.js +6 -2
- package/src/all/background_page/service/user/getOrFindMeService.test.js +27 -2
- package/src/all/background_page/service/webIntegration/parseWebIntegrationUrlService.js +11 -6
- package/src/all/background_page/service/webIntegration/parseWebIntegrationUrlService.test.js +7 -9
- package/src/all/background_page/service/worker/workerService.js +42 -11
- package/src/all/background_page/service/worker/workerService.test.js +70 -2
- package/src/all/background_page/utils/format/formDataUtils.test.js +1 -1
- package/src/all/background_page/utils/openpgp/openpgpAssertions.js +1 -1
- package/src/all/contentScripts/js/app/App.js +2 -0
- package/src/all/contentScripts/js/controller/abortWebauthnSetupCeremonyContentScriptController.js +62 -0
- package/src/all/contentScripts/js/controller/abortWebauthnSetupCeremonyContentScriptController.test.js +44 -0
- package/src/all/contentScripts/js/controller/runWebauthnSetupCeremonyContentScriptController.js +65 -0
- package/src/all/contentScripts/js/controller/runWebauthnSetupCeremonyContentScriptController.test.js +70 -0
- package/src/all/contentScripts/js/event/webauthnSetupCeremonyEvents.js +33 -0
- package/src/all/contentScripts/js/service/webauthnSetupCeremonyContentScriptService.js +154 -0
- package/src/all/contentScripts/js/service/webauthnSetupCeremonyContentScriptService.test.js +252 -0
- package/src/all/locales/en-UK/common.json +0 -1
- package/src/all/webAccessibleResources/js/lib/port.js +106 -10
- package/src/all/webAccessibleResources/js/lib/port.test.js +174 -1
- package/src/all/webAccessibleResources/js/themes/stylesheet.js +1 -1
- package/src/chrome-mv3/index.js +6 -0
- package/src/chrome-mv3/manifest.json +3 -4
- package/src/chrome-mv3/serviceWorker/service/network/requestFetchOffscreenService.js +1 -1
- package/src/chrome-mv3/serviceWorker/service/network/responseFetchOffscreenService.js +7 -4
- package/src/firefox/manifest.json +2 -3
- package/src/safari/background_page/index.js +2 -1
- package/src/safari/background_page/service/cookies/cookiesService.js +9 -3
- package/src/safari/background_page/service/cookies/cookiesService.test.js +28 -1
- package/src/safari/manifest.json +2 -3
- package/test/matchers/toBeOpenpgpKeySignedBy.js +13 -14
- package/test/mocks/mockJsDomPolyfill.js +0 -2
- package/test/mocks/mockWebExtensionPolyfill.js +2 -4
- package/webpack/common-blocks.js +13 -13
- package/webpack/expectedBuildArtifacts.js +1 -1
- package/webpack/passboltEnvPlugin.js +1 -1
- package/webpack.common.config.js +2 -0
- package/webpack.config.js +4 -5
- package/webpack.safari-background-page.config.js +38 -31
- package/src/all/background_page/model/theme/themeModel.js +0 -66
- package/src/all/background_page/model/theme/themeModel.test.js +0 -73
- package/src/all/background_page/service/activeSession/findAndUpdateActiveSessionLocalStorageService.test.js +0 -776
- package/src/all/background_page/service/move/calculatePermissionsChangesForMoveService.js +0 -113
- package/src/all/background_page/service/move/calculatePermissionsChangesForMoveService.test.js +0 -158
- package/src/all/background_page/service/move/confirmMoveStrategyService.js +0 -42
- package/src/all/background_page/service/move/confirmMoveStrategyService.test.js +0 -67
- package/src/chrome/manifest.json +0 -52
- package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.test.js +0 -53
- package/webpack.chromium-mv2.config.js +0 -40
- /package/src/all/background_page/service/{move/calculatePermissionsChangesForMoveService.test.data.js → permission/calculatePermissionsChangesService.test.data.js} +0 -0
|
@@ -155,21 +155,25 @@ class FoldersCollection extends EntityV2Collection {
|
|
|
155
155
|
static getAllChildren(parentId, inputCollection, outputCollection) {
|
|
156
156
|
const children = inputCollection.folders.filter((item) => item.folderParentId === parentId);
|
|
157
157
|
if (children.length) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
} catch (error) {
|
|
161
|
-
console.error(error);
|
|
162
|
-
/*
|
|
163
|
-
* children are already in collection
|
|
164
|
-
* skip...
|
|
165
|
-
*/
|
|
166
|
-
}
|
|
158
|
+
// A child already collected through another branch is skipped, the rest of the batch is not.
|
|
159
|
+
outputCollection.pushMany(children, { ignoreInvalidEntity: true });
|
|
167
160
|
const childrenIds = children.map((child) => child.id);
|
|
168
161
|
childrenIds.forEach((id) => FoldersCollection.getAllChildren(id, inputCollection, outputCollection));
|
|
169
162
|
}
|
|
170
163
|
return outputCollection;
|
|
171
164
|
}
|
|
172
165
|
|
|
166
|
+
/**
|
|
167
|
+
* The folders nested under the given one that the operator owns, each branch stopping at the
|
|
168
|
+
* first folder they do not own. Leaving out the folders they do not own detaches those branches,
|
|
169
|
+
* so the search never reaches what sits below them.
|
|
170
|
+
* @param {string} parentId
|
|
171
|
+
* @returns {FoldersCollection}
|
|
172
|
+
*/
|
|
173
|
+
getOwnedDescendantsStoppingAtNotOwned(parentId) {
|
|
174
|
+
return this.filterByIsOwner().getAllChildren(parentId);
|
|
175
|
+
}
|
|
176
|
+
|
|
173
177
|
/**
|
|
174
178
|
*
|
|
175
179
|
* @param folderId
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.16.0
|
|
13
|
+
*/
|
|
14
|
+
import { defaultFolderDto } from "passbolt-styleguide/src/shared/models/entity/folder/folderEntity.test.data";
|
|
15
|
+
import {
|
|
16
|
+
ownerPermissionDto,
|
|
17
|
+
readPermissionDto,
|
|
18
|
+
} from "passbolt-styleguide/src/shared/models/entity/permission/permissionEntity.test.data";
|
|
19
|
+
import PermissionEntity from "passbolt-styleguide/src/shared/models/entity/permission/permissionEntity";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A folder DTO carrying an owner or read permission, for the given id and parent.
|
|
23
|
+
* @param {string} id The folder id.
|
|
24
|
+
* @param {string|null} folderParentId The parent folder id, or null for the root.
|
|
25
|
+
* @param {boolean} isOwner Whether the operator owns the folder.
|
|
26
|
+
* @returns {object}
|
|
27
|
+
*/
|
|
28
|
+
export const folderWithOwnershipDto = (id, folderParentId, isOwner) =>
|
|
29
|
+
defaultFolderDto({
|
|
30
|
+
id,
|
|
31
|
+
folder_parent_id: folderParentId,
|
|
32
|
+
permission: isOwner
|
|
33
|
+
? ownerPermissionDto({ aco: PermissionEntity.ACO_FOLDER, aco_foreign_key: id })
|
|
34
|
+
: readPermissionDto({ aco: PermissionEntity.ACO_FOLDER, aco_foreign_key: id }),
|
|
35
|
+
});
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "passbolt-styleguide/src/shared/models/entity/permission/permissionEntity.test.data";
|
|
23
23
|
import { v4 as uuidv4 } from "uuid";
|
|
24
24
|
import PermissionEntity from "passbolt-styleguide/src/shared/models/entity/permission/permissionEntity";
|
|
25
|
+
import { folderWithOwnershipDto } from "./foldersCollection.test.data";
|
|
25
26
|
|
|
26
27
|
describe("Folders collection entity", () => {
|
|
27
28
|
it("schema must validate", () => {
|
|
@@ -404,4 +405,63 @@ describe("Folders collection entity", () => {
|
|
|
404
405
|
expect(filteredResources.ids).toEqual([folder1Id, folder4Id]);
|
|
405
406
|
});
|
|
406
407
|
});
|
|
408
|
+
|
|
409
|
+
describe("::getOwnedDescendantsStoppingAtNotOwned", () => {
|
|
410
|
+
it("collects every descendant when the whole branch is owned", () => {
|
|
411
|
+
expect.assertions(2);
|
|
412
|
+
|
|
413
|
+
const rootId = uuidv4();
|
|
414
|
+
const childId = uuidv4();
|
|
415
|
+
const grandchildId = uuidv4();
|
|
416
|
+
const folders = new FoldersCollection([
|
|
417
|
+
folderWithOwnershipDto(rootId, null, true),
|
|
418
|
+
folderWithOwnershipDto(childId, rootId, true),
|
|
419
|
+
folderWithOwnershipDto(grandchildId, childId, true),
|
|
420
|
+
]);
|
|
421
|
+
|
|
422
|
+
const result = folders.getOwnedDescendantsStoppingAtNotOwned(rootId);
|
|
423
|
+
|
|
424
|
+
expect(result).toHaveLength(2);
|
|
425
|
+
expect(result.ids.sort()).toEqual([childId, grandchildId].sort());
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
it("excludes a not-owned folder and everything nested beneath it, even folders the operator owns", () => {
|
|
429
|
+
expect.assertions(2);
|
|
430
|
+
|
|
431
|
+
const rootId = uuidv4();
|
|
432
|
+
const notOwnedChildId = uuidv4();
|
|
433
|
+
const ownedGrandchildId = uuidv4();
|
|
434
|
+
const folders = new FoldersCollection([
|
|
435
|
+
folderWithOwnershipDto(rootId, null, true),
|
|
436
|
+
folderWithOwnershipDto(notOwnedChildId, rootId, false),
|
|
437
|
+
// Owned, but sitting under a folder the operator does not own. The branch already stopped there.
|
|
438
|
+
folderWithOwnershipDto(ownedGrandchildId, notOwnedChildId, true),
|
|
439
|
+
]);
|
|
440
|
+
|
|
441
|
+
const result = folders.getOwnedDescendantsStoppingAtNotOwned(rootId);
|
|
442
|
+
|
|
443
|
+
expect(result).toHaveLength(0);
|
|
444
|
+
expect(result.ids).not.toContain(ownedGrandchildId);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
it("gates per branch: a not-owned branch does not affect a sibling owned branch", () => {
|
|
448
|
+
expect.assertions(2);
|
|
449
|
+
|
|
450
|
+
const rootId = uuidv4();
|
|
451
|
+
const notOwnedBranchId = uuidv4();
|
|
452
|
+
const ownedBranchId = uuidv4();
|
|
453
|
+
const ownedBranchChildId = uuidv4();
|
|
454
|
+
const folders = new FoldersCollection([
|
|
455
|
+
folderWithOwnershipDto(rootId, null, true),
|
|
456
|
+
folderWithOwnershipDto(notOwnedBranchId, rootId, false),
|
|
457
|
+
folderWithOwnershipDto(ownedBranchId, rootId, true),
|
|
458
|
+
folderWithOwnershipDto(ownedBranchChildId, ownedBranchId, true),
|
|
459
|
+
]);
|
|
460
|
+
|
|
461
|
+
const result = folders.getOwnedDescendantsStoppingAtNotOwned(rootId);
|
|
462
|
+
|
|
463
|
+
expect(result.ids.sort()).toEqual([ownedBranchId, ownedBranchChildId].sort());
|
|
464
|
+
expect(result.ids).not.toContain(notOwnedBranchId);
|
|
465
|
+
});
|
|
466
|
+
});
|
|
407
467
|
});
|
|
@@ -114,6 +114,11 @@ export const logMeOnceCsvFile = [
|
|
|
114
114
|
'"Password 1","https://url1.com","Description 1","Folder 1","Username 1","Password 1",""',
|
|
115
115
|
].join("\r\n");
|
|
116
116
|
|
|
117
|
+
export const netwrixCsvFile = [
|
|
118
|
+
'"DataTags";"Description";"User name";"Password";"Internet address";"Email address"',
|
|
119
|
+
'"";"Password 1";"Username 1";"Password 1";"https://url1.com";""',
|
|
120
|
+
].join("\r\n");
|
|
121
|
+
|
|
117
122
|
export const KdbxCsvFile = [
|
|
118
123
|
'"Title","Username","URL","Password","Notes","Group","TOTP"',
|
|
119
124
|
'"Password 1","Username 1","https://url1.com","Password 1","Description 1","Folder 1","otpauth://totp/Password%201%3AUsername%201?secret=THISISASECRET&issuer=https%253A%252F%252Furl1.com&algorithm=SHA1&digits=6&period=30"',
|
|
@@ -46,6 +46,9 @@ class MfaEnabledProviderEntity extends Entity {
|
|
|
46
46
|
duo: {
|
|
47
47
|
type: "boolean",
|
|
48
48
|
},
|
|
49
|
+
webauthn: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
},
|
|
49
52
|
},
|
|
50
53
|
};
|
|
51
54
|
}
|
|
@@ -80,6 +83,14 @@ class MfaEnabledProviderEntity extends Entity {
|
|
|
80
83
|
return this._props.duo;
|
|
81
84
|
}
|
|
82
85
|
|
|
86
|
+
/**
|
|
87
|
+
* get the webauthn prop
|
|
88
|
+
* @returns {boolean|undefined}
|
|
89
|
+
*/
|
|
90
|
+
get webauthn() {
|
|
91
|
+
return this._props.webauthn;
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
/*
|
|
84
95
|
* ==================================================
|
|
85
96
|
* Static properties getters
|
|
@@ -31,6 +31,19 @@ describe("MfaEnabledProvider entity", () => {
|
|
|
31
31
|
expect(entity.duo).toEqual(dto.duo);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
+
it("constructor keeps the webauthn flag when provided", () => {
|
|
35
|
+
const dto = createMfaCombinedEnabledProviders({ webauthn: true });
|
|
36
|
+
const entity = new MfaEnabledProviderEntity(dto);
|
|
37
|
+
|
|
38
|
+
expect(entity.webauthn).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("constructor works without the webauthn flag", () => {
|
|
42
|
+
const entity = new MfaEnabledProviderEntity(createMfaCombinedEnabledProviders());
|
|
43
|
+
|
|
44
|
+
expect(entity.webauthn).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
|
|
34
47
|
it("constructor returns validation error if dto required fields are missing", () => {
|
|
35
48
|
try {
|
|
36
49
|
new MfaEnabledProviderEntity({});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import EntityV2 from "passbolt-styleguide/src/shared/models/entity/abstract/entityV2";
|
|
15
|
+
import { AAGUID_PATTERN } from "./webauthnSetupCeremonyEntity";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A WebAuthn credential registered by the user as MFA provider.
|
|
19
|
+
*/
|
|
20
|
+
class MfaWebauthnCredentialEntity extends EntityV2 {
|
|
21
|
+
/**
|
|
22
|
+
* Get the entity schema
|
|
23
|
+
* @returns {Object} schema
|
|
24
|
+
*/
|
|
25
|
+
static getSchema() {
|
|
26
|
+
return {
|
|
27
|
+
type: "object",
|
|
28
|
+
required: ["id", "credential_id", "aaguid", "name", "sign_count", "created", "modified"],
|
|
29
|
+
properties: {
|
|
30
|
+
id: {
|
|
31
|
+
type: "string",
|
|
32
|
+
format: "uuid",
|
|
33
|
+
},
|
|
34
|
+
credential_id: {
|
|
35
|
+
type: "string",
|
|
36
|
+
minLength: 1,
|
|
37
|
+
},
|
|
38
|
+
aaguid: {
|
|
39
|
+
type: "string",
|
|
40
|
+
pattern: AAGUID_PATTERN,
|
|
41
|
+
nullable: true,
|
|
42
|
+
},
|
|
43
|
+
name: {
|
|
44
|
+
type: "string",
|
|
45
|
+
maxLength: 255,
|
|
46
|
+
nullable: true,
|
|
47
|
+
},
|
|
48
|
+
sign_count: {
|
|
49
|
+
type: "integer",
|
|
50
|
+
minimum: 0,
|
|
51
|
+
},
|
|
52
|
+
last_used: {
|
|
53
|
+
type: "string",
|
|
54
|
+
format: "date-time",
|
|
55
|
+
nullable: true,
|
|
56
|
+
},
|
|
57
|
+
created: {
|
|
58
|
+
type: "string",
|
|
59
|
+
format: "date-time",
|
|
60
|
+
},
|
|
61
|
+
modified: {
|
|
62
|
+
type: "string",
|
|
63
|
+
format: "date-time",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @returns {string}
|
|
71
|
+
*/
|
|
72
|
+
get id() {
|
|
73
|
+
return this._props.id;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @returns {string}
|
|
78
|
+
*/
|
|
79
|
+
get credentialId() {
|
|
80
|
+
return this._props.credential_id;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @returns {string|null}
|
|
85
|
+
*/
|
|
86
|
+
get aaguid() {
|
|
87
|
+
return this._props.aaguid || null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @returns {string|null}
|
|
92
|
+
*/
|
|
93
|
+
get name() {
|
|
94
|
+
return this._props.name || null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @returns {number}
|
|
99
|
+
*/
|
|
100
|
+
get signCount() {
|
|
101
|
+
return this._props.sign_count;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @returns {string|null}
|
|
106
|
+
*/
|
|
107
|
+
get lastUsed() {
|
|
108
|
+
return this._props.last_used || null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @returns {string}
|
|
113
|
+
*/
|
|
114
|
+
get created() {
|
|
115
|
+
return this._props.created;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
121
|
+
get modified() {
|
|
122
|
+
return this._props.modified;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export default MfaWebauthnCredentialEntity;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import { v4 as uuidv4 } from "uuid";
|
|
15
|
+
|
|
16
|
+
export const defaultMfaWebauthnCredentialDto = (data = {}) => ({
|
|
17
|
+
id: uuidv4(),
|
|
18
|
+
credential_id: "AZv1kKjbTxOX8BRWmQE1bPQmnPX5Gm0ARgqVGaM_UZo",
|
|
19
|
+
aaguid: "adce0002-35bc-c60a-648b-0b25f1f05503",
|
|
20
|
+
name: "My passkey",
|
|
21
|
+
sign_count: 3,
|
|
22
|
+
last_used: "2026-09-10T10:00:00+00:00",
|
|
23
|
+
created: "2026-09-01T10:00:00+00:00",
|
|
24
|
+
modified: "2026-09-10T10:00:00+00:00",
|
|
25
|
+
...data,
|
|
26
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import EntitySchema from "passbolt-styleguide/src/shared/models/entity/abstract/entitySchema";
|
|
15
|
+
import * as assertEntityProperty from "passbolt-styleguide/test/assert/assertEntityProperty";
|
|
16
|
+
import MfaWebauthnCredentialEntity from "./mfaWebauthnCredentialEntity";
|
|
17
|
+
import { defaultMfaWebauthnCredentialDto } from "./mfaWebauthnCredentialEntity.test.data";
|
|
18
|
+
|
|
19
|
+
describe("MfaWebauthnCredentialEntity", () => {
|
|
20
|
+
describe("MfaWebauthnCredentialEntity::getSchema", () => {
|
|
21
|
+
it("schema must validate", () => {
|
|
22
|
+
EntitySchema.validateSchema(MfaWebauthnCredentialEntity.name, MfaWebauthnCredentialEntity.getSchema());
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("validates id property", () => {
|
|
26
|
+
assertEntityProperty.uuid(MfaWebauthnCredentialEntity, "id");
|
|
27
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "id");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("validates credential_id property", () => {
|
|
31
|
+
assertEntityProperty.string(MfaWebauthnCredentialEntity, "credential_id");
|
|
32
|
+
assertEntityProperty.minLength(MfaWebauthnCredentialEntity, "credential_id", 1);
|
|
33
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "credential_id");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("validates aaguid property", () => {
|
|
37
|
+
const successScenarios = [
|
|
38
|
+
assertEntityProperty.SCENARIO_UUID,
|
|
39
|
+
{ scenario: "a non RFC 4122 aaguid", value: "adce0002-35bc-c60a-648b-0b25f1f05503" },
|
|
40
|
+
];
|
|
41
|
+
const failScenarios = [
|
|
42
|
+
assertEntityProperty.SCENARIO_STRING,
|
|
43
|
+
{ scenario: "upper case hex", value: "ADCE0002-35BC-C60A-648B-0B25F1F05503" },
|
|
44
|
+
];
|
|
45
|
+
assertEntityProperty.assert(MfaWebauthnCredentialEntity, "aaguid", successScenarios, failScenarios, "pattern");
|
|
46
|
+
assertEntityProperty.nullable(MfaWebauthnCredentialEntity, "aaguid");
|
|
47
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "aaguid");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("validates name property", () => {
|
|
51
|
+
assertEntityProperty.string(MfaWebauthnCredentialEntity, "name");
|
|
52
|
+
assertEntityProperty.maxLength(MfaWebauthnCredentialEntity, "name", 255);
|
|
53
|
+
assertEntityProperty.nullable(MfaWebauthnCredentialEntity, "name");
|
|
54
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "name");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("validates sign_count property", () => {
|
|
58
|
+
assertEntityProperty.integer(MfaWebauthnCredentialEntity, "sign_count");
|
|
59
|
+
assertEntityProperty.minimum(MfaWebauthnCredentialEntity, "sign_count", 0);
|
|
60
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "sign_count");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("validates last_used property", () => {
|
|
64
|
+
assertEntityProperty.dateTime(MfaWebauthnCredentialEntity, "last_used");
|
|
65
|
+
assertEntityProperty.nullable(MfaWebauthnCredentialEntity, "last_used");
|
|
66
|
+
assertEntityProperty.notRequired(MfaWebauthnCredentialEntity, "last_used");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("validates created property", () => {
|
|
70
|
+
assertEntityProperty.dateTime(MfaWebauthnCredentialEntity, "created");
|
|
71
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "created");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("validates modified property", () => {
|
|
75
|
+
assertEntityProperty.dateTime(MfaWebauthnCredentialEntity, "modified");
|
|
76
|
+
assertEntityProperty.required(MfaWebauthnCredentialEntity, "modified");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("MfaWebauthnCredentialEntity::constructor", () => {
|
|
81
|
+
it("works if valid DTO is provided", () => {
|
|
82
|
+
expect.assertions(9);
|
|
83
|
+
const dto = defaultMfaWebauthnCredentialDto();
|
|
84
|
+
const entity = new MfaWebauthnCredentialEntity(dto);
|
|
85
|
+
expect(entity.toDto()).toEqual(dto);
|
|
86
|
+
expect(entity.id).toEqual(dto.id);
|
|
87
|
+
expect(entity.credentialId).toEqual(dto.credential_id);
|
|
88
|
+
expect(entity.aaguid).toEqual(dto.aaguid);
|
|
89
|
+
expect(entity.name).toEqual(dto.name);
|
|
90
|
+
expect(entity.signCount).toEqual(dto.sign_count);
|
|
91
|
+
expect(entity.lastUsed).toEqual(dto.last_used);
|
|
92
|
+
expect(entity.created).toEqual(dto.created);
|
|
93
|
+
expect(entity.modified).toEqual(dto.modified);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("exposes null for a never used, unnamed credential of an unknown authenticator", () => {
|
|
97
|
+
expect.assertions(3);
|
|
98
|
+
const dto = defaultMfaWebauthnCredentialDto({ aaguid: null, name: null, last_used: null });
|
|
99
|
+
const entity = new MfaWebauthnCredentialEntity(dto);
|
|
100
|
+
expect(entity.aaguid).toBeNull();
|
|
101
|
+
expect(entity.name).toBeNull();
|
|
102
|
+
expect(entity.lastUsed).toBeNull();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import EntityV2Collection from "passbolt-styleguide/src/shared/models/entity/abstract/entityV2Collection";
|
|
15
|
+
import MfaWebauthnCredentialEntity from "./mfaWebauthnCredentialEntity";
|
|
16
|
+
|
|
17
|
+
class MfaWebauthnCredentialsCollection extends EntityV2Collection {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
get entityClass() {
|
|
22
|
+
return MfaWebauthnCredentialEntity;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get the collection schema
|
|
27
|
+
* @returns {Object} schema
|
|
28
|
+
*/
|
|
29
|
+
static getSchema() {
|
|
30
|
+
return {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: MfaWebauthnCredentialEntity.getSchema(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
* @throws {EntityValidationError} If a credential already exists with the same id.
|
|
39
|
+
*/
|
|
40
|
+
validateBuildRules(item) {
|
|
41
|
+
this.assertNotExist("id", item._props.id);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @returns {Array<MfaWebauthnCredentialEntity>}
|
|
46
|
+
*/
|
|
47
|
+
get credentials() {
|
|
48
|
+
return this._items;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default MfaWebauthnCredentialsCollection;
|
package/src/all/background_page/model/entity/mfa/mfaWebauthnCredentialsCollection.test.data.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import { defaultMfaWebauthnCredentialDto } from "./mfaWebauthnCredentialEntity.test.data";
|
|
15
|
+
|
|
16
|
+
export const defaultMfaWebauthnCredentialsDtos = (count = 3, data = {}) => {
|
|
17
|
+
const dtos = [];
|
|
18
|
+
for (let i = 0; i < count; i++) {
|
|
19
|
+
dtos.push(defaultMfaWebauthnCredentialDto({ name: `Passkey ${i + 1}`, ...data }));
|
|
20
|
+
}
|
|
21
|
+
return dtos;
|
|
22
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import EntitySchema from "passbolt-styleguide/src/shared/models/entity/abstract/entitySchema";
|
|
15
|
+
import MfaWebauthnCredentialEntity from "./mfaWebauthnCredentialEntity";
|
|
16
|
+
import MfaWebauthnCredentialsCollection from "./mfaWebauthnCredentialsCollection";
|
|
17
|
+
import { defaultMfaWebauthnCredentialDto } from "./mfaWebauthnCredentialEntity.test.data";
|
|
18
|
+
import { defaultMfaWebauthnCredentialsDtos } from "./mfaWebauthnCredentialsCollection.test.data";
|
|
19
|
+
|
|
20
|
+
describe("MfaWebauthnCredentialsCollection", () => {
|
|
21
|
+
describe("MfaWebauthnCredentialsCollection::constructor", () => {
|
|
22
|
+
it("schema must validate", () => {
|
|
23
|
+
EntitySchema.validateSchema(MfaWebauthnCredentialsCollection.name, MfaWebauthnCredentialsCollection.getSchema());
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("works if valid DTOs are provided", () => {
|
|
27
|
+
expect.assertions(5);
|
|
28
|
+
const dtos = defaultMfaWebauthnCredentialsDtos(2);
|
|
29
|
+
const collection = new MfaWebauthnCredentialsCollection(dtos);
|
|
30
|
+
expect(collection).toHaveLength(2);
|
|
31
|
+
expect(collection.toDto()).toEqual(dtos);
|
|
32
|
+
expect(collection.credentials[0]).toBeInstanceOf(MfaWebauthnCredentialEntity);
|
|
33
|
+
expect(collection.credentials[0].id).toEqual(dtos[0].id);
|
|
34
|
+
expect(collection.credentials[1].id).toEqual(dtos[1].id);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("works with an empty array", () => {
|
|
38
|
+
expect.assertions(1);
|
|
39
|
+
expect(new MfaWebauthnCredentialsCollection([])).toHaveLength(0);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should throw if the collection schema does not validate", () => {
|
|
43
|
+
expect.assertions(1);
|
|
44
|
+
expect(() => new MfaWebauthnCredentialsCollection({})).toThrowEntityValidationError("items");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should throw if one of data item does not validate the entity schema", () => {
|
|
48
|
+
expect.assertions(1);
|
|
49
|
+
const dtos = [defaultMfaWebauthnCredentialDto(), defaultMfaWebauthnCredentialDto({ sign_count: "3" })];
|
|
50
|
+
expect(() => new MfaWebauthnCredentialsCollection(dtos)).toThrowCollectionValidationError("1.sign_count.type");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("should throw if one of data item does not validate the unique id build rule", () => {
|
|
54
|
+
expect.assertions(1);
|
|
55
|
+
const dto1 = defaultMfaWebauthnCredentialDto();
|
|
56
|
+
const dto2 = defaultMfaWebauthnCredentialDto({ id: dto1.id });
|
|
57
|
+
expect(() => new MfaWebauthnCredentialsCollection([dto1, dto2])).toThrowCollectionValidationError("1.id.unique");
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
import EntityV2 from "passbolt-styleguide/src/shared/models/entity/abstract/entityV2";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The organisation WebAuthn MFA settings relevant to the user; the API returns more fields than modelled here.
|
|
18
|
+
*/
|
|
19
|
+
class MfaWebauthnSettingsEntity extends EntityV2 {
|
|
20
|
+
/**
|
|
21
|
+
* Get the entity schema
|
|
22
|
+
* @returns {Object} schema
|
|
23
|
+
*/
|
|
24
|
+
static getSchema() {
|
|
25
|
+
return {
|
|
26
|
+
type: "object",
|
|
27
|
+
required: ["max_credentials_per_user"],
|
|
28
|
+
properties: {
|
|
29
|
+
max_credentials_per_user: {
|
|
30
|
+
type: "integer",
|
|
31
|
+
minimum: 1,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @returns {number}
|
|
39
|
+
*/
|
|
40
|
+
get maxCredentialsPerUser() {
|
|
41
|
+
return this._props.max_credentials_per_user;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default MfaWebauthnSettingsEntity;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
4
|
+
*
|
|
5
|
+
* Licensed under GNU Affero General Public License version 3 of the or any later version.
|
|
6
|
+
* For full copyright and license information, please see the LICENSE.txt
|
|
7
|
+
* Redistributions of files must retain the above copyright notice.
|
|
8
|
+
*
|
|
9
|
+
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
|
|
10
|
+
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
|
|
11
|
+
* @link https://www.passbolt.com Passbolt(tm)
|
|
12
|
+
* @since 5.17.0
|
|
13
|
+
*/
|
|
14
|
+
export const defaultMfaWebauthnSettingsDto = (data = {}) => ({
|
|
15
|
+
max_credentials_per_user: 10,
|
|
16
|
+
...data,
|
|
17
|
+
});
|