passbolt-browser-extension 5.16.1 → 5.17.0
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/CHANGELOG.md +105 -1
- package/RELEASE_NOTES.md +94 -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 +10 -10
- 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 +2 -4
- package/package.json +10 -7
- 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/informCallToActionController/informCallToActionController.js +4 -2
- package/src/all/background_page/controller/informCallToActionController/informCallToActionController.test.js +4 -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/setup/completeSetupController.js +4 -0
- package/src/all/background_page/controller/setup/completeSetupController.test.js +5 -1
- package/src/all/background_page/error/webauthnAlreadyRunningCeremonyError.js +24 -0
- 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/folderEvents.js +5 -4
- package/src/all/background_page/event/informCallToActionEvents.js +3 -2
- package/src/all/background_page/event/mfaEvents.js +38 -1
- package/src/all/background_page/event/resourceEvents.js +9 -5
- package/src/all/background_page/index.js +16 -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/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/userAndGroupSearchResultEntity/userAndGroupSearchResultEntity.js +1 -1
- package/src/all/background_page/model/entity/userAndGroupSearchResultEntity/userAndGroupSearchResultEntity.test.js +19 -1
- package/src/all/background_page/pagemod/accountRecoveryBootstrapPagemod.test.js +1 -1
- package/src/all/background_page/pagemod/appBootstrapPagemod.js +2 -1
- package/src/all/background_page/pagemod/appBootstrapPagemod.test.js +8 -8
- package/src/all/background_page/pagemod/authBootstrapPagemod.test.js +1 -1
- 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/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.test.js +1 -1
- 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/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/auth/postLoginService.js +2 -1
- package/src/all/background_page/service/auth/postLoginService.test.js +1 -1
- 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/extension/onExtensionUpdateAvailableService.test.js +2 -6
- 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 +2 -0
- package/src/all/background_page/service/localStorage/localStorageService.test.js +3 -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/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/getOrFindOfflineSettingsService.js +2 -1
- package/src/all/background_page/service/offline/getOrFindOfflineSettingsService.test.js +23 -0
- 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 +2 -1
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.js +2 -1
- package/src/all/background_page/service/resourceType/getOrFindResourceTypesService.test.js +19 -0
- 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/share/shareFoldersService.js +20 -36
- package/src/all/background_page/service/share/shareFoldersService.test.js +236 -0
- package/src/all/background_page/service/tab/tabService.js +3 -2
- package/src/all/background_page/service/toolbar/toolbarService.js +13 -5
- 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 +2 -1
- package/src/all/background_page/service/user/getOrFindMeService.test.js +17 -0
- 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/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/chrome/manifest.json +2 -3
- package/src/chrome-mv3/index.js +6 -0
- package/src/chrome-mv3/manifest.json +3 -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/mocks/mockWebExtensionPolyfill.js +2 -4
- 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/all/background_page/service/{move/calculatePermissionsChangesForMoveService.test.data.js → permission/calculatePermissionsChangesService.test.data.js} +0 -0
|
@@ -21,6 +21,7 @@ import MockPort from "passbolt-styleguide/src/react-extension/test/mock/MockPort
|
|
|
21
21
|
import { anonymousSiteSettings } from "passbolt-styleguide/src/shared/models/entity/siteSettings/siteSettingsEntity.test.data";
|
|
22
22
|
import SiteSettingsEntity from "passbolt-styleguide/src/shared/models/entity/siteSettings/siteSettingsEntity";
|
|
23
23
|
import GetOrFindSiteSettingsService from "../../service/siteSettings/getOrFindSiteSettingsService";
|
|
24
|
+
import PermissionsCollection from "passbolt-styleguide/src/shared/models/entity/permission/permissionsCollection";
|
|
24
25
|
|
|
25
26
|
describe("MoveResourcesController", () => {
|
|
26
27
|
beforeEach(() => {
|
|
@@ -29,7 +30,7 @@ describe("MoveResourcesController", () => {
|
|
|
29
30
|
.mockImplementation(() => new SiteSettingsEntity(anonymousSiteSettings()));
|
|
30
31
|
});
|
|
31
32
|
it("Should ask the user's passphrase and call the move service", async () => {
|
|
32
|
-
expect.assertions(
|
|
33
|
+
expect.assertions(4);
|
|
33
34
|
|
|
34
35
|
const worker = { port: new MockPort() };
|
|
35
36
|
const account = new AccountEntity(defaultAccountDto());
|
|
@@ -41,13 +42,52 @@ describe("MoveResourcesController", () => {
|
|
|
41
42
|
const spyOnMoveResourceExec = jest.spyOn(controller.moveResourcesService, "moveAll");
|
|
42
43
|
|
|
43
44
|
spyOnGetPassphrase.mockImplementation(async () => pgpKeys.ada.passphrase);
|
|
44
|
-
spyOnMoveResourceExec.mockImplementation(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
spyOnMoveResourceExec.mockImplementation(
|
|
46
|
+
async (resourceIds, destinationFolderId, confirmedPermissions, passphrase) => {
|
|
47
|
+
expect(resourceIds).toStrictEqual(expectedResourceIds);
|
|
48
|
+
expect(destinationFolderId).toStrictEqual(expectedDestinationFolderId);
|
|
49
|
+
expect(confirmedPermissions).toEqual(new Map());
|
|
50
|
+
expect(passphrase).toStrictEqual(pgpKeys.ada.passphrase);
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
await controller.exec(expectedResourceIds, expectedDestinationFolderId);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("converts the per-resource permissions DTO map into a Map of PermissionsCollection passed to the move service", async () => {
|
|
58
|
+
expect.assertions(4);
|
|
59
|
+
|
|
60
|
+
const worker = { port: new MockPort() };
|
|
61
|
+
const account = new AccountEntity(defaultAccountDto());
|
|
62
|
+
const resourceId = uuidv4();
|
|
63
|
+
const resourceIds = [resourceId, uuidv4()];
|
|
64
|
+
const destinationFolderId = uuidv4();
|
|
65
|
+
// Sent as an object keyed by item id, each carrying the permissions that resource ends up with.
|
|
66
|
+
const permissionsDto = {
|
|
67
|
+
[resourceId]: [
|
|
68
|
+
{ aro: "User", aro_foreign_key: uuidv4(), aco: "Resource", aco_foreign_key: resourceId, type: 15 },
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const controller = new MoveResourcesController(worker, null, defaultApiClientOptions(), account);
|
|
73
|
+
jest.spyOn(controller.getPassphraseService, "getPassphrase").mockImplementation(async () => pgpKeys.ada.passphrase);
|
|
74
|
+
jest
|
|
75
|
+
.spyOn(controller.verifyOrTrustMetadataKeyService, "verifyTrustedOrTrustNewMetadataKey")
|
|
76
|
+
.mockImplementation(jest.fn);
|
|
77
|
+
jest.spyOn(controller.moveResourcesService, "moveAll").mockImplementation(jest.fn);
|
|
78
|
+
|
|
79
|
+
await controller.exec(resourceIds, destinationFolderId, permissionsDto);
|
|
49
80
|
|
|
50
|
-
|
|
81
|
+
expect(controller.moveResourcesService.moveAll).toHaveBeenCalledWith(
|
|
82
|
+
resourceIds,
|
|
83
|
+
destinationFolderId,
|
|
84
|
+
expect.any(Map),
|
|
85
|
+
pgpKeys.ada.passphrase,
|
|
86
|
+
);
|
|
87
|
+
const confirmedPermissions = controller.moveResourcesService.moveAll.mock.calls[0][2];
|
|
88
|
+
expect(confirmedPermissions.get(resourceId)).toBeInstanceOf(PermissionsCollection);
|
|
89
|
+
expect(confirmedPermissions.get(resourceId).items).toHaveLength(1);
|
|
90
|
+
expect(confirmedPermissions.get(resourceId).items[0].type).toBe(15);
|
|
51
91
|
});
|
|
52
92
|
|
|
53
93
|
it("Should assert the given resourcesIds is an array of UUIDs", async () => {
|
|
@@ -73,4 +113,25 @@ describe("MoveResourcesController", () => {
|
|
|
73
113
|
"The destinationFolderId should be a valid UUID",
|
|
74
114
|
);
|
|
75
115
|
});
|
|
116
|
+
|
|
117
|
+
it("returns the skipped resource ids reported by the move service", async () => {
|
|
118
|
+
expect.assertions(1);
|
|
119
|
+
|
|
120
|
+
const worker = { port: new MockPort() };
|
|
121
|
+
const account = new AccountEntity(defaultAccountDto());
|
|
122
|
+
const resourceIds = [uuidv4(), uuidv4()];
|
|
123
|
+
const destinationFolderId = uuidv4();
|
|
124
|
+
const skippedResourceIds = [resourceIds[0]];
|
|
125
|
+
|
|
126
|
+
const controller = new MoveResourcesController(worker, null, defaultApiClientOptions(), account);
|
|
127
|
+
jest.spyOn(controller.getPassphraseService, "getPassphrase").mockImplementation(async () => pgpKeys.ada.passphrase);
|
|
128
|
+
jest
|
|
129
|
+
.spyOn(controller.verifyOrTrustMetadataKeyService, "verifyTrustedOrTrustNewMetadataKey")
|
|
130
|
+
.mockImplementation(jest.fn);
|
|
131
|
+
jest.spyOn(controller.moveResourcesService, "moveAll").mockResolvedValue({ skippedResourceIds });
|
|
132
|
+
|
|
133
|
+
const result = await controller.exec(resourceIds, destinationFolderId);
|
|
134
|
+
|
|
135
|
+
expect(result).toStrictEqual({ skippedResourceIds });
|
|
136
|
+
});
|
|
76
137
|
});
|
|
@@ -17,6 +17,7 @@ import SetupModel from "../../model/setup/setupModel";
|
|
|
17
17
|
import AccountRecoverEntity from "../../model/entity/account/accountRecoverEntity";
|
|
18
18
|
import AccountEntity from "../../model/entity/account/accountEntity";
|
|
19
19
|
import FindAccountTemporaryService from "../../service/account/findAccountTemporaryService";
|
|
20
|
+
import ToolbarService from "../../service/toolbar/toolbarService";
|
|
20
21
|
|
|
21
22
|
class CompleteRecoverController {
|
|
22
23
|
/**
|
|
@@ -59,6 +60,9 @@ class CompleteRecoverController {
|
|
|
59
60
|
);
|
|
60
61
|
await this.setupModel.completeRecover(temporaryAccount.account);
|
|
61
62
|
await this.accountModel.add(accountRecovered);
|
|
63
|
+
|
|
64
|
+
// For Edge to avoid a double click on the QA icon when the account is set
|
|
65
|
+
ToolbarService.setQuickaccessPopup();
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
|
|
@@ -22,6 +22,7 @@ import User from "../../model/user";
|
|
|
22
22
|
import { OpenpgpAssertion } from "../../utils/openpgp/openpgpAssertions";
|
|
23
23
|
import Keyring from "../../model/keyring";
|
|
24
24
|
import AccountTemporarySessionStorageService from "../../service/sessionStorage/accountTemporarySessionStorageService";
|
|
25
|
+
import ToolbarService from "../../service/toolbar/toolbarService";
|
|
25
26
|
|
|
26
27
|
// Reset the modules before each test.
|
|
27
28
|
beforeEach(() => {
|
|
@@ -38,11 +39,12 @@ describe("CompleteRecoverController", () => {
|
|
|
38
39
|
null,
|
|
39
40
|
defaultApiClientOptions(),
|
|
40
41
|
);
|
|
42
|
+
jest.spyOn(ToolbarService, "setQuickaccessPopup").mockImplementation(() => {});
|
|
41
43
|
|
|
42
44
|
// Mock API complete request.
|
|
43
45
|
fetch.doMockOnce(() => mockApiResponse());
|
|
44
46
|
|
|
45
|
-
expect.assertions(
|
|
47
|
+
expect.assertions(10);
|
|
46
48
|
await controller.exec();
|
|
47
49
|
const user = User.getInstance().get();
|
|
48
50
|
expect(user.id).toStrictEqual(account.userId);
|
|
@@ -64,6 +66,8 @@ describe("CompleteRecoverController", () => {
|
|
|
64
66
|
expect(keyringPrivateFingerprint).toStrictEqual(accountPrivateFingerprint);
|
|
65
67
|
expect(keyringPublicFingerprint).toStrictEqual(accountPublicFingerprint);
|
|
66
68
|
expect(keyringPublicFingerprint).toStrictEqual(keyringPrivateFingerprint);
|
|
69
|
+
|
|
70
|
+
expect(ToolbarService.setQuickaccessPopup).toHaveBeenCalledTimes(1);
|
|
67
71
|
});
|
|
68
72
|
|
|
69
73
|
it("Should not add the account to the local storage if the complete API request fails.", async () => {
|
|
@@ -17,6 +17,7 @@ import SetupModel from "../../model/setup/setupModel";
|
|
|
17
17
|
import AccountEntity from "../../model/entity/account/accountEntity";
|
|
18
18
|
import AccountSetupEntity from "../../model/entity/account/accountSetupEntity";
|
|
19
19
|
import FindAccountTemporaryService from "../../service/account/findAccountTemporaryService";
|
|
20
|
+
import ToolbarService from "../../service/toolbar/toolbarService";
|
|
20
21
|
|
|
21
22
|
class CompleteSetupController {
|
|
22
23
|
/**
|
|
@@ -57,6 +58,9 @@ class CompleteSetupController {
|
|
|
57
58
|
const accountSetup = new AccountEntity(temporaryAccount.account.toDto(AccountSetupEntity.ALL_CONTAIN_OPTIONS));
|
|
58
59
|
await this.setupModel.completeSetup(temporaryAccount.account);
|
|
59
60
|
await this.accountModel.add(accountSetup);
|
|
61
|
+
|
|
62
|
+
// For Edge to avoid a double click on the QA icon when the account is set
|
|
63
|
+
ToolbarService.setQuickaccessPopup();
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -22,6 +22,7 @@ import User from "../../model/user";
|
|
|
22
22
|
import Keyring from "../../model/keyring";
|
|
23
23
|
import { OpenpgpAssertion } from "../../utils/openpgp/openpgpAssertions";
|
|
24
24
|
import AccountTemporarySessionStorageService from "../../service/sessionStorage/accountTemporarySessionStorageService";
|
|
25
|
+
import ToolbarService from "../../service/toolbar/toolbarService";
|
|
25
26
|
|
|
26
27
|
// Reset the modules before each test.
|
|
27
28
|
beforeEach(() => {
|
|
@@ -38,11 +39,12 @@ describe("CompleteSetupController", () => {
|
|
|
38
39
|
null,
|
|
39
40
|
defaultApiClientOptions(),
|
|
40
41
|
);
|
|
42
|
+
jest.spyOn(ToolbarService, "setQuickaccessPopup").mockImplementation(() => {});
|
|
41
43
|
|
|
42
44
|
// Mock API complete request.
|
|
43
45
|
fetch.doMockOnce(() => mockApiResponse());
|
|
44
46
|
|
|
45
|
-
expect.assertions(
|
|
47
|
+
expect.assertions(10);
|
|
46
48
|
await controller.exec();
|
|
47
49
|
const user = User.getInstance().get();
|
|
48
50
|
expect(user.id).toStrictEqual(account.userId);
|
|
@@ -64,6 +66,8 @@ describe("CompleteSetupController", () => {
|
|
|
64
66
|
expect(keyringPrivateFingerprint).toStrictEqual(accountPrivateFingerprint);
|
|
65
67
|
expect(keyringPublicFingerprint).toStrictEqual(accountPublicFingerprint);
|
|
66
68
|
expect(keyringPublicFingerprint).toStrictEqual(keyringPrivateFingerprint);
|
|
69
|
+
|
|
70
|
+
expect(ToolbarService.setQuickaccessPopup).toHaveBeenCalledTimes(1);
|
|
67
71
|
});
|
|
68
72
|
|
|
69
73
|
it("Should not add the account to the local storage if the complete API request fails.", async () => {
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Another WebAuthn ceremony is already running and therefore a new one cannot be started
|
|
17
|
+
*/
|
|
18
|
+
export default class WebauthnAlreadyRunningCeremonyError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "Another Webauthn ceremony is running.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnAlreadyRunningCeremonyError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The authenticator is already registered for this user (DOMException InvalidStateError, authenticator listed in excludeCredentials).
|
|
17
|
+
*/
|
|
18
|
+
class WebauthnAuthenticatorAlreadyRegisteredError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "The authenticator is already registered.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnAuthenticatorAlreadyRegisteredError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default WebauthnAuthenticatorAlreadyRegisteredError;
|
|
@@ -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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The ceremony was superseded by a new one begun by the extension.
|
|
17
|
+
*/
|
|
18
|
+
class WebauthnCeremonyAbortedError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "The passkey ceremony was aborted.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnCeremonyAbortedError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default WebauthnCeremonyAbortedError;
|
|
@@ -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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The passkey prompt was cancelled by the user or timed out (DOMException NotAllowedError, browsers do not distinguish both cases).
|
|
17
|
+
*/
|
|
18
|
+
class WebauthnCeremonyCancelledError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "The passkey prompt was cancelled or timed out.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnCeremonyCancelledError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default WebauthnCeremonyCancelledError;
|
|
@@ -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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Any other failure of the passkey ceremony, the message carries the original error name and message.
|
|
17
|
+
*/
|
|
18
|
+
class WebauthnCeremonyError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "The passkey ceremony failed.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnCeremonyError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default WebauthnCeremonyError;
|
|
@@ -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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A ceremony result or finish was received without a matching, unexpired ceremony record.
|
|
17
|
+
*/
|
|
18
|
+
class WebauthnCeremonyNotFoundError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "No pending passkey ceremony found.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnCeremonyNotFoundError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default WebauthnCeremonyNotFoundError;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The TLS certificate is invalid or untrusted therefore the WebAuthn ceremonies are blocked by the browser.
|
|
17
|
+
*/
|
|
18
|
+
export default class WebauthnTLSCertificateError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
message = message || "The TLS certificate is invalid.";
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "WebauthnTLSCertificateError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 MfaSetupHandleWebauthnCeremonyResultController from "../controller/mfaSetup/MfaSetupHandleWebauthnCeremonyResultController";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Listens the app bootstrap content script events
|
|
18
|
+
* @param {Worker} worker
|
|
19
|
+
*/
|
|
20
|
+
const listen = function (worker) {
|
|
21
|
+
/*
|
|
22
|
+
* Whenever the content script has finished a WebAuthn setup ceremony
|
|
23
|
+
* @listens passbolt.app-bootstrap.webauthn-ceremony-result
|
|
24
|
+
* @param resultDto {object} The ceremony result
|
|
25
|
+
*/
|
|
26
|
+
worker.port.on("passbolt.app-bootstrap.webauthn-ceremony-result", async (resultDto) => {
|
|
27
|
+
const controller = new MfaSetupHandleWebauthnCeremonyResultController(worker);
|
|
28
|
+
await controller._exec(resultDto);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const AppBootstrapEvents = { listen };
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { AppBootstrapEvents } from "./appBootstrapEvents";
|
|
15
|
+
import MfaSetupHandleWebauthnCeremonyResultController from "../controller/mfaSetup/MfaSetupHandleWebauthnCeremonyResultController";
|
|
16
|
+
|
|
17
|
+
describe("AppBootstrapEvents", () => {
|
|
18
|
+
it("dispatches the webauthn ceremony result to its controller", async () => {
|
|
19
|
+
expect.assertions(2);
|
|
20
|
+
const listeners = {};
|
|
21
|
+
const worker = { port: { on: jest.fn((name, callback) => (listeners[name] = callback)) }, tab: { id: 1 } };
|
|
22
|
+
jest.spyOn(MfaSetupHandleWebauthnCeremonyResultController.prototype, "_exec").mockResolvedValue();
|
|
23
|
+
const resultDto = { id: "8e3874ae-4b40-590b-968a-418f704b9d9a", status: "error", error: {} };
|
|
24
|
+
|
|
25
|
+
AppBootstrapEvents.listen(worker);
|
|
26
|
+
await listeners["passbolt.app-bootstrap.webauthn-ceremony-result"](resultDto);
|
|
27
|
+
|
|
28
|
+
expect(worker.port.on).toHaveBeenCalledTimes(1);
|
|
29
|
+
expect(MfaSetupHandleWebauthnCeremonyResultController.prototype._exec).toHaveBeenCalledWith(resultDto);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -93,16 +93,17 @@ const listen = function (worker, apiClientOptions, account) {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
/*
|
|
96
|
-
*
|
|
96
|
+
* Move a folder, and apply the permissions the operator confirmed when there are any.
|
|
97
97
|
*
|
|
98
|
-
* @listens passbolt.folders.move-
|
|
98
|
+
* @listens passbolt.folders.move-by-id
|
|
99
99
|
* @param {uuid} requestId The request identifier
|
|
100
100
|
* @param {string} folderId The folder id to move
|
|
101
101
|
* @param {string} destinationFolderId The destination folder id
|
|
102
|
+
* @param {Object<string, Array<object>>|null} permissionsDto The permissions the operator confirmed, keyed by item id. Null to keep the permissions as they are.
|
|
102
103
|
*/
|
|
103
|
-
worker.port.on("passbolt.folders.move-by-id", async (requestId, folderId, destinationFolderId) => {
|
|
104
|
+
worker.port.on("passbolt.folders.move-by-id", async (requestId, folderId, destinationFolderId, permissionsDto) => {
|
|
104
105
|
const controller = new MoveFolderController(worker, requestId, apiClientOptions, account);
|
|
105
|
-
await controller.
|
|
106
|
+
await controller._exec(folderId, destinationFolderId, permissionsDto);
|
|
106
107
|
});
|
|
107
108
|
};
|
|
108
109
|
|
|
@@ -48,10 +48,11 @@ const listen = function (worker, apiClientOptions, account) {
|
|
|
48
48
|
* Whenever the in-form call-to-action is executed
|
|
49
49
|
* @listens passbolt.in-form-cta.execute
|
|
50
50
|
* @param requestId {uuid} The request identifier
|
|
51
|
+
* @param applicationId {uuid} The identifier of the call-to-action that was clicked
|
|
51
52
|
*/
|
|
52
|
-
worker.port.on("passbolt.in-form-cta.execute", async (requestId) => {
|
|
53
|
+
worker.port.on("passbolt.in-form-cta.execute", async (requestId, applicationId) => {
|
|
53
54
|
const informCallToActionController = new InformCallToActionController(worker, apiClientOptions, account);
|
|
54
|
-
await informCallToActionController.execute(requestId);
|
|
55
|
+
await informCallToActionController.execute(requestId, applicationId);
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
/*
|
|
@@ -22,13 +22,20 @@ import MfaSetupRemoveProviderController from "../controller/mfaSetup/MfaSetupRem
|
|
|
22
22
|
import MfaSetupVerifyYubikeyCodeController from "../controller/mfaSetup/MfaSetupVerifyYubikeyCodeController";
|
|
23
23
|
import MfaSetupGetTotpCodeController from "../controller/mfaSetup/MfaSetupGetTotpCodeController";
|
|
24
24
|
import GetStartedWithDuoController from "../controller/mfaSetup/GetStartedWithDuoController";
|
|
25
|
+
import MfaSetupBeginWebauthnCeremonyController from "../controller/mfaSetup/MfaSetupBeginWebauthnCeremonyController";
|
|
26
|
+
import MfaSetupFinishWebauthnCeremonyController from "../controller/mfaSetup/MfaSetupFinishWebauthnCeremonyController";
|
|
27
|
+
import MfaSetupAbortWebauthnCeremonyController from "../controller/mfaSetup/MfaSetupAbortWebauthnCeremonyController";
|
|
28
|
+
import MfaSetupGetWebauthnCredentialsController from "../controller/mfaSetup/MfaSetupGetWebauthnCredentialsController";
|
|
29
|
+
import MfaSetupDeleteWebauthnCredentialController from "../controller/mfaSetup/MfaSetupDeleteWebauthnCredentialController";
|
|
30
|
+
import MfaSetupGetWebauthnSettingsController from "../controller/mfaSetup/MfaSetupGetWebauthnSettingsController";
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
33
|
* Listens to the MFA events
|
|
28
34
|
* @param {Worker} worker The worker
|
|
29
35
|
* @param {ApiClientOptions} apiClientOptions The api client options
|
|
36
|
+
* @param {AccountEntity} account The account
|
|
30
37
|
*/
|
|
31
|
-
const listen = function (worker, apiClientOptions) {
|
|
38
|
+
const listen = function (worker, apiClientOptions, account) {
|
|
32
39
|
worker.port.on("passbolt.mfa-policy.has-user-postponed-user-setting-invitation", async (requestId) => {
|
|
33
40
|
const controller = new HasUserPostponedUserSettingInvitationMFAPolicyController(worker, requestId);
|
|
34
41
|
await controller._exec();
|
|
@@ -78,6 +85,36 @@ const listen = function (worker, apiClientOptions) {
|
|
|
78
85
|
const controller = new GetStartedWithDuoController(worker, requestId, apiClientOptions);
|
|
79
86
|
await controller._exec();
|
|
80
87
|
});
|
|
88
|
+
|
|
89
|
+
worker.port.on("passbolt.mfa-setup.begin-webauthn-ceremony", async (requestId) => {
|
|
90
|
+
const controller = new MfaSetupBeginWebauthnCeremonyController(worker, requestId, apiClientOptions, account);
|
|
91
|
+
await controller._exec();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
worker.port.on("passbolt.mfa-setup.finish-webauthn-ceremony", async (requestId, name) => {
|
|
95
|
+
const controller = new MfaSetupFinishWebauthnCeremonyController(worker, requestId, apiClientOptions, account);
|
|
96
|
+
await controller._exec(name);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
worker.port.on("passbolt.mfa-setup.abort-webauthn-ceremony", async (requestId) => {
|
|
100
|
+
const controller = new MfaSetupAbortWebauthnCeremonyController(worker, requestId, apiClientOptions, account);
|
|
101
|
+
await controller._exec();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
worker.port.on("passbolt.mfa-setup.get-webauthn-credentials", async (requestId) => {
|
|
105
|
+
const controller = new MfaSetupGetWebauthnCredentialsController(worker, requestId, apiClientOptions);
|
|
106
|
+
await controller._exec();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
worker.port.on("passbolt.mfa-setup.delete-webauthn-credential", async (requestId, id) => {
|
|
110
|
+
const controller = new MfaSetupDeleteWebauthnCredentialController(worker, requestId, apiClientOptions);
|
|
111
|
+
await controller._exec(id);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
worker.port.on("passbolt.mfa-setup.get-webauthn-settings", async (requestId) => {
|
|
115
|
+
const controller = new MfaSetupGetWebauthnSettingsController(worker, requestId, apiClientOptions);
|
|
116
|
+
await controller._exec();
|
|
117
|
+
});
|
|
81
118
|
};
|
|
82
119
|
|
|
83
120
|
export const MfaEvents = { listen };
|
|
@@ -150,13 +150,17 @@ const listen = function (worker, apiClientOptions, account) {
|
|
|
150
150
|
*
|
|
151
151
|
* @listens passbolt.resources.move-by-ids
|
|
152
152
|
* @param {uuid} requestId The request identifier
|
|
153
|
-
* @param {string} destinationFolderId The destination folder id
|
|
154
153
|
* @param {string} resourcesIds The resources ids to move
|
|
154
|
+
* @param {string} destinationFolderId The destination folder id
|
|
155
|
+
* @param {Object<string, Array<object>>|null} permissionsDto The permissions the operator confirmed, keyed by resource id. Null to keep the permissions as they are.
|
|
155
156
|
*/
|
|
156
|
-
worker.port.on(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
worker.port.on(
|
|
158
|
+
"passbolt.resources.move-by-ids",
|
|
159
|
+
async (requestId, resourcesIds, destinationFolderId, permissionsDto) => {
|
|
160
|
+
const controller = new MoveResourcesController(worker, requestId, apiClientOptions, account);
|
|
161
|
+
await controller._exec(resourcesIds, destinationFolderId, permissionsDto);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
160
164
|
|
|
161
165
|
/*
|
|
162
166
|
* Update the local storage for resources in the specified parent folder.
|
|
@@ -12,12 +12,22 @@ import OnExtensionUpdateAvailableService from "./service/extension/onExtensionUp
|
|
|
12
12
|
import GlobalAlarmService from "./service/alarm/globalAlarmService";
|
|
13
13
|
import OnStartUpService from "./service/extension/onStartUpService";
|
|
14
14
|
import ToolbarService from "./service/toolbar/toolbarService";
|
|
15
|
+
import User from "./model/user";
|
|
15
16
|
|
|
16
17
|
const main = async () => {
|
|
17
18
|
/**
|
|
18
19
|
* Load all system requirement
|
|
19
20
|
*/
|
|
20
21
|
await SystemRequirementService.get();
|
|
22
|
+
|
|
23
|
+
const user = User.getInstance();
|
|
24
|
+
if (user.isValid()) {
|
|
25
|
+
/*
|
|
26
|
+
* Use for Edge mainly as 'openPopup' does not work (see ToolbarService.handleIconToolbarClicked).
|
|
27
|
+
* When browser started, it avoids users to click twice on the QA icon to show it.
|
|
28
|
+
*/
|
|
29
|
+
ToolbarService.setQuickaccessPopup();
|
|
30
|
+
}
|
|
21
31
|
};
|
|
22
32
|
|
|
23
33
|
main();
|
|
@@ -76,3 +86,9 @@ browser.tabs.onActivated.addListener(ToolbarService.handleSuggestedResourcesOnAc
|
|
|
76
86
|
* Handle suggested resources on toolbar icon
|
|
77
87
|
*/
|
|
78
88
|
browser.windows.onFocusChanged.addListener(ToolbarService.handleSuggestedResourcesOnFocusedWindow);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Handle click on the toolbar icon
|
|
92
|
+
* This handler is called only when the popup URL of the QA is not defined.
|
|
93
|
+
*/
|
|
94
|
+
browser.browserAction.onClicked.addListener(ToolbarService.handleIconToolbarClicked);
|
|
@@ -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
|