passbolt-browser-extension 5.13.0-alpha.1 → 5.13.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/.github/ISSUE_TEMPLATE/bug_report.md +30 -22
- package/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/CHANGELOG.md +76 -0
- package/CONTRIBUTING.md +1 -12
- package/README.md +5 -16
- package/SECURITY.md +7 -0
- package/package.json +2 -2
- package/src/all/background_page/controller/export/exportResourcesFileController.test.js +7 -2
- package/src/all/background_page/controller/resource/findAllByIdsForDisplayPermissionsController.test.js +8 -3
- package/src/all/background_page/controller/resource/findAllIdsByIsSharedWithGroupController.test.js +9 -4
- package/src/all/background_page/controller/resourceLocalStorage/resourceUpdateLocalStorageController.test.js +5 -2
- package/src/all/background_page/controller/subscription/createSubscriptionKeyController.js +63 -0
- package/src/all/background_page/controller/subscription/createSubscriptionKeyController.test.js +56 -0
- package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.js +55 -0
- package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.test.js +50 -0
- package/src/all/background_page/event/appEvents.js +25 -0
- package/src/all/background_page/model/keyring.js +52 -17
- package/src/all/background_page/model/keyring.test.js +110 -0
- package/src/all/background_page/model/user/userModel.js +3 -4
- package/src/all/background_page/model/user/userModel.test.js +1 -3
- package/src/all/background_page/service/api/abstract/abstractService.js +3 -17
- package/src/all/background_page/service/api/edition/passboltEditionApiService.js +64 -0
- package/src/all/background_page/service/api/edition/passboltEditionApiService.test.js +99 -0
- package/src/all/background_page/service/api/group/groupApiService.js +2 -13
- package/src/all/background_page/service/api/resource/resourceService.js +18 -12
- package/src/all/background_page/service/group/findGroupsService.js +3 -7
- package/src/all/background_page/service/group/findGroupsService.test.js +9 -14
- package/src/all/background_page/service/resource/create/resourceCreateService.test.js +3 -2
- package/src/all/background_page/service/resource/export/exportResourcesService.test.js +13 -4
- package/src/all/background_page/service/resource/findAndUpdateResourcesLocalStorageService.test.js +35 -28
- package/src/all/background_page/service/resource/findResourcesService.js +78 -2
- package/src/all/background_page/service/resource/findResourcesService.test.data.js +1 -1
- package/src/all/background_page/service/resource/findResourcesService.test.js +90 -31
- package/src/all/background_page/service/resource/getOrFindResourcesService.test.js +18 -8
- package/src/all/background_page/service/subscription/createSubscriptionKeyService.js +57 -0
- package/src/all/background_page/service/subscription/createSubscriptionKeyService.test.js +111 -0
- package/src/all/background_page/service/subscription/deleteSubscriptionKeyService.js +35 -0
- package/src/all/background_page/service/subscription/deleteSubscriptionKeyService.test.js +55 -0
- package/src/all/background_page/utils/assertions.js +1 -0
- package/src/all/locales/ko-KR/common.json +1 -1
- package/src/chrome/manifest.json +1 -1
- package/src/chrome-mv3/manifest.json +1 -1
- package/src/firefox/manifest.json +2 -2
- package/src/safari/manifest.json +2 -2
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
name: Report a bug
|
|
3
|
+
about: Report a bug in the Passbolt browser extension.
|
|
4
|
+
title: ""
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
<!--
|
|
10
|
+
PLEASE READ
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
- feature requests: https://community.passbolt.com/c/backlog
|
|
7
|
-
- issues related to an installation: https://community.passbolt.com/c/installation-issues
|
|
8
|
-
- general questions: https://community.passbolt.com/c/uncategorized
|
|
12
|
+
This tracker is only for browser extension bugs. For anything else:
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
- Security issues: https://www.passbolt.com/docs/contribute/security/vulnerability/
|
|
15
|
+
- Feature requests: https://community.passbolt.com/c/backlog
|
|
16
|
+
- Installation issues: https://community.passbolt.com/c/installation-issues
|
|
17
|
+
- General questions: https://community.passbolt.com/c/uncategorized
|
|
13
18
|
|
|
14
|
-
If you are certain this is a
|
|
19
|
+
If you are certain this is a browser extension bug, please fill in the format below.
|
|
20
|
+
-->
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-- etc.: OTHER RELEVANT PLATFORM INFO
|
|
22
|
+
* Browser extension version: <!-- e.g. 5.13.0 -->
|
|
23
|
+
* API edition & version: <!-- e.g. CE 5.12.0 -->
|
|
24
|
+
* Environment
|
|
25
|
+
* Client: <!-- browser and OS, e.g. Chrome 148.1 on Ubuntu 26.04 -->
|
|
26
|
+
* Server: <!-- e.g. Debian 13, Docker latest-ce, or Passbolt Cloud -->
|
|
22
27
|
|
|
23
|
-
### What you did
|
|
24
|
-
EXPLAIN WHAT YOU DID, PREFERABLY WITH CODE EXAMPLES, HERE.
|
|
28
|
+
### What you did?
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
EXPLAIN WHAT IS ACTUALLY HAPPENING, HERE.
|
|
30
|
+
<!-- Explain what you did, preferably with steps or code examples. -->
|
|
28
31
|
|
|
29
|
-
### What
|
|
30
|
-
|
|
32
|
+
### What happened?
|
|
33
|
+
|
|
34
|
+
<!-- Explain what actually happened. -->
|
|
35
|
+
|
|
36
|
+
### What you expected to happen?
|
|
37
|
+
|
|
38
|
+
<!-- Explain what you expected instead. -->
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Request a feature or change
|
|
4
|
+
url: https://community.passbolt.com/c/backlog
|
|
5
|
+
about: Suggest and vote on features in the community forum.
|
|
6
|
+
- name: Get installation help
|
|
7
|
+
url: https://community.passbolt.com/c/installation-issues
|
|
8
|
+
about: Ask installation and configuration questions in the community forum.
|
|
9
|
+
- name: Ask a question
|
|
10
|
+
url: https://community.passbolt.com/c/uncategorized
|
|
11
|
+
about: Ask usage questions in the community forum.
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,82 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [5.13.0] - 2026-06-11
|
|
8
|
+
### Added
|
|
9
|
+
PB-51594 Move findAllForActionLogController and test to the correct location
|
|
10
|
+
PB-48516 Build process improvement - Webpack
|
|
11
|
+
PB-51534 Update group edit call in groupApiService to contain "my_group_user" as urlOptions
|
|
12
|
+
PB-51580 PCD 1.1 - Migrate SearchUsersAndGroupsController off ShareModel
|
|
13
|
+
PB-51585 PCD 1.2 - Migrate resourceCreateService ShareModel usage to ShareResourceService
|
|
14
|
+
PB-51586 PCD 1.3 - Move passbolt.share.get-folders to controller pattern
|
|
15
|
+
PB-51587 PCD 1.4 - Clear ShareModel
|
|
16
|
+
PB-51588 PCD 1.5 - Migrate MoveFolderController off FolderModel
|
|
17
|
+
PB-51589 PCD 1.6 - Migrate MoveOneFolderService off FolderModel
|
|
18
|
+
PB-51590 PCD 1.7 - Migrate MoveResourcesService off FolderModel + ResourceModel
|
|
19
|
+
PB-51782 PCD 2.01 - Create SynchroniseKeyringController and binding
|
|
20
|
+
PB-51783 PCD 2.02 - Create KeyringServiceWorkerService
|
|
21
|
+
PB-51785 PCD 2.04 - Create GetOrFindGroupService
|
|
22
|
+
PB-51786 PCD 2.05 - Create GetOrFindGroupController and binding
|
|
23
|
+
PB-51787 PCD 2.06 - Create GetOrFindGroupsUsersService
|
|
24
|
+
PB-51788 PCD 2.07 - Create GetOrFindGroupsUsersController and binding
|
|
25
|
+
PB-51789 PCD 2.08 - Create GetOrFindUsersService
|
|
26
|
+
PB-51790 PCD 2.09 - Create GetOrFindUsersController and binding
|
|
27
|
+
PB-51791 PCD 2.10 - Add new methods getByIds, getGroupsUsersByGropuId on GroupServiceWorkerService
|
|
28
|
+
PB-51999 PCD 2.10.B - Consolidate UserEntity between browser extension and styleguide
|
|
29
|
+
PB-52000 PCD 2.10.C - Move GroupEntity + GroupsCollection to the styleguide
|
|
30
|
+
PB-51792 PCD 2.11 - Create UserServiceWorkerService
|
|
31
|
+
PB-51793 PCD 2.12 - Create PermissionServiceWorkerService
|
|
32
|
+
PB-51794 PCD 2.13 - Create SearchUsersAndGroupsService
|
|
33
|
+
PB-51795 PCD 2.14 - Refactor ShareService into ShareApiService
|
|
34
|
+
PB-51796 PCD 2.15 - Update GroupApiService to support the new filter
|
|
35
|
+
PB-51798 PCD 2.17 - Update FindAndUpdateGroupsLocalStorageService to add a method findForLocalStorageByIds
|
|
36
|
+
PB-51799 PCD 2.18 - Align UserLocalStorage to add memory cache
|
|
37
|
+
PB-51800 PCD 2.19 - Rename UserService to UserApiService
|
|
38
|
+
PB-52047 CE/PRO upgrade
|
|
39
|
+
PB-49605 Grid columns min-width
|
|
40
|
+
PB-51808 PCD 2.27 - Create UserPermissionItem
|
|
41
|
+
PB-51809 PCD 2.28 - Create GroupUserPermissionItem
|
|
42
|
+
PB-47929 PAG - WP1.1 Add pagination support to ResourceService
|
|
43
|
+
PB-47930 PAG - WP1.2 Paginate resource fetch for updating local storage in FindResourceService
|
|
44
|
+
PB-52056 Add create method to SubscriptionKeyServiceWorkerService
|
|
45
|
+
PB-52057 Add delete method to SubscriptionKeyServiceWorkerService
|
|
46
|
+
PB-52058 Adapt EditSubscriptionKey to be customizable
|
|
47
|
+
PB-52061 Adapt DisplaySubscriptionKeyTeasing to handle upgrade from app
|
|
48
|
+
PB-52064 Create ConfirmDowngradeSubscriptionDialog
|
|
49
|
+
PB-52062 Adapt DisplaySubscriptionKey to handle downgrading
|
|
50
|
+
PB-52128 DisplaySubscriptionKey new layout
|
|
51
|
+
|
|
52
|
+
### Security
|
|
53
|
+
PB-51937 Fix ws GHSA-58qx-3vcg-4xpx - MEDIUM CVSS3.1
|
|
54
|
+
PB-51938 Fix brace-expansion GHSA-jxxr-4gwj-5jf2 - MEDIUM CVSS3.1
|
|
55
|
+
PB-52029 Fix tmp GHSA-ph9p-34f9-6g65 - HIGH CVSS4.0
|
|
56
|
+
PB-51532 Include GitLab file from ci-definitions repo
|
|
57
|
+
PB-51642 Fix fast-uri GHSA-q3j6-qgpj-74h6 - HIGH CVSS3.1
|
|
58
|
+
PB-51643 Fix @babel/plugin-transform-modules-systemjs GHSA-fv7c-fp4j-7gwp - HIGH CVSS3.1
|
|
59
|
+
PB-51940 Fix qs GHSA-q8mj-m7cp-5q26 - MEDIUM CVSS4.0
|
|
60
|
+
PB-52030 Fix webpack-dev-server GHSA-79cf-xcqc-c78w - MEDIUM CVSS3.1
|
|
61
|
+
PB-51698 Use correct passbolt repo names in safe-chain whitelist
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
PB-52148 CSP is blocking upload to TOTP QRCode on Firefox
|
|
65
|
+
PB-50949 Fix MetadataKeysSettingsLocalStorageContext and MetadataTypesSettingsLocalStorageContext entity issue on storage changes
|
|
66
|
+
PB-52047 Fix Passbolt Pro Edition wording
|
|
67
|
+
PB-52156 Fix password preview button min-width
|
|
68
|
+
|
|
69
|
+
### Maintenance
|
|
70
|
+
PB-48560 Use NODE_ENV for webpack mode config
|
|
71
|
+
PB-48564 Remove grunt-header
|
|
72
|
+
PB-48528 Transpile LESS from webpack
|
|
73
|
+
PB-48558 Extract translations directly from webpack
|
|
74
|
+
PB-48559 Remove rimraf
|
|
75
|
+
PB-49064 Remove Grunt
|
|
76
|
+
PB-48516 Replace eval sourcemap by inline
|
|
77
|
+
PB-48516 Prevent br tags to be added in translations.
|
|
78
|
+
PB-48516 Remove duplicated translations
|
|
79
|
+
PB-51793: Add PermissionServiceWorkerService and transfer Permission entity and collection on styleguide
|
|
80
|
+
PB-51160 Update Firefox manifest to avoid Mozilla warnings
|
|
81
|
+
PB-52155 Update github issue template
|
|
82
|
+
|
|
7
83
|
## [5.12.2] - 2026-05-19
|
|
8
84
|
### Fixed
|
|
9
85
|
- PB-51648 Fix add user to group reducing set timeout
|
package/CONTRIBUTING.md
CHANGED
|
@@ -15,18 +15,7 @@ There are a few guidelines that we need contributors to follow so that we have a
|
|
|
15
15
|
|
|
16
16
|
### Reporting a security Issue
|
|
17
17
|
|
|
18
|
-
If you've found a security related issue in Passbolt, please don't open an issue
|
|
19
|
-
Instead contact us at security@passbolt.com. In the spirit of responsible disclosure we ask that the reporter keep the
|
|
20
|
-
issue confidential until we announce it.
|
|
21
|
-
|
|
22
|
-
The passbolt team will take the following actions:
|
|
23
|
-
- Try to first reproduce the issue and confirm the vulnerability.
|
|
24
|
-
- Acknowledge to the reporter that we’ve received the issue and are working on a fix.
|
|
25
|
-
- Get a fix/patch prepared and create associated automated tests.
|
|
26
|
-
- Prepare a post describing the vulnerability, and the possible exploits.
|
|
27
|
-
- Release new versions of all affected major versions.
|
|
28
|
-
- Prominently feature the problem in the release announcement.
|
|
29
|
-
- Provide credits in the release announcement to the reporter if they so desire.
|
|
18
|
+
If you've found a security related issue in Passbolt, please don't open an issue on GitHub. Follow our responsible disclosure process: https://www.passbolt.com/docs/contribute/security/vulnerability/.
|
|
30
19
|
|
|
31
20
|
### Reporting a bug
|
|
32
21
|
Please only use github for bugs or pull request.
|
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
/_/ \__,_/____/____/_.___/\____/_/\__/
|
|
6
6
|
|
|
7
7
|
Open source password manager for teams
|
|
8
|
-
(c)
|
|
8
|
+
(c) 2026 Passbolt SA
|
|
9
9
|
https://www.passbolt.com
|
|
10
10
|
|
|
11
11
|
## License
|
|
12
12
|
|
|
13
13
|
Passbolt - Open source password manager for teams
|
|
14
14
|
|
|
15
|
-
(c)
|
|
15
|
+
(c) 2026 Passbolt SA
|
|
16
16
|
|
|
17
17
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
|
18
18
|
Public License (AGPL) as published by the Free Software Foundation version 3.
|
|
@@ -54,22 +54,11 @@ such as auto filling your passwords when visiting known websites.
|
|
|
54
54
|
|
|
55
55
|
# Contributing
|
|
56
56
|
|
|
57
|
-
Please check
|
|
57
|
+
Please check [CONTRIBUTING.md](CONTRIBUTING.md) for more information about how to get involved.
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Reporting a security Issue
|
|
60
60
|
|
|
61
|
-
If you've found a security related issue in Passbolt, please don't open an issue
|
|
62
|
-
Instead contact us at security@passbolt.com. In the spirit of responsible disclosure we ask that the reporter keep the
|
|
63
|
-
issue confidential until we announce it.
|
|
64
|
-
|
|
65
|
-
The passbolt team will take the following actions:
|
|
66
|
-
- Try to first reproduce the issue and confirm the vulnerability.
|
|
67
|
-
- Acknowledge to the reporter that we’ve received the issue and are working on a fix.
|
|
68
|
-
- Get a fix/patch prepared and create associated automated tests.
|
|
69
|
-
- Prepare a post describing the vulnerability, and the possible exploits.
|
|
70
|
-
- Release new versions of all affected major versions.
|
|
71
|
-
- Prominently feature the problem in the release announcement.
|
|
72
|
-
- Provide credits in the release announcement to the reporter if they so desire.
|
|
61
|
+
If you've found a security related issue in Passbolt, please don't open an issue on GitHub. Follow our responsible disclosure process: https://www.passbolt.com/docs/contribute/security/vulnerability/.
|
|
73
62
|
|
|
74
63
|
# Quick how-to for developers
|
|
75
64
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
For general information about security at Passbolt, see https://www.passbolt.com/security
|
|
4
|
+
|
|
5
|
+
## Reporting a security issue
|
|
6
|
+
|
|
7
|
+
If you've found a security issue in Passbolt, please do not open a public issue. Follow our responsible disclosure process: https://www.passbolt.com/docs/contribute/security/vulnerability/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passbolt-browser-extension",
|
|
3
|
-
"version": "5.13.0
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"copyright": "Copyright 2025 Passbolt SA",
|
|
6
6
|
"description": "Passbolt web extension for the open source password manager for teams",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"kdbxweb": "2.1.1",
|
|
22
22
|
"openpgp": "^6.1.1",
|
|
23
23
|
"papaparse": "^5.5.2",
|
|
24
|
-
"passbolt-styleguide": "^5.13.0
|
|
24
|
+
"passbolt-styleguide": "^5.13.0",
|
|
25
25
|
"react": "^18.3.1",
|
|
26
26
|
"react-dom": "^18.3.1",
|
|
27
27
|
"secrets-passbolt": "github:passbolt/secrets.js#v2.0.1",
|
|
@@ -50,6 +50,7 @@ import { resourceCollectionV4ToExport } from "../../service/resource/export/expo
|
|
|
50
50
|
import { defaultDecryptedSharedMetadataKeysDtos } from "passbolt-styleguide/src/shared/models/entity/metadata/metadataKeysCollection.test.data";
|
|
51
51
|
import MetadataKeysCollection from "passbolt-styleguide/src/shared/models/entity/metadata/metadataKeysCollection";
|
|
52
52
|
import GetOrFindMetadataKeysService from "../../service/metadata/getOrFindMetadataKeysService";
|
|
53
|
+
import { mockPassboltResponse } from "passbolt-styleguide/test/mocks/mockApiResponse";
|
|
53
54
|
|
|
54
55
|
beforeEach(async () => {
|
|
55
56
|
await MockExtension.withConfiguredAccount();
|
|
@@ -112,7 +113,9 @@ describe("ExportResourcesFileController", () => {
|
|
|
112
113
|
folder_parent_id: foldersDto[0].id,
|
|
113
114
|
totp: defaultTotpDto({ secret_key: "THISISASECRET" }),
|
|
114
115
|
});
|
|
115
|
-
jest
|
|
116
|
+
jest
|
|
117
|
+
.spyOn(ResourceService.prototype, "findAll")
|
|
118
|
+
.mockImplementation(() => mockPassboltResponse(resourceCollectionV4));
|
|
116
119
|
const result = await controller.exec(file);
|
|
117
120
|
|
|
118
121
|
const blobFile = new Blob([result.file], { type: "text/csv" });
|
|
@@ -169,7 +172,9 @@ describe("ExportResourcesFileController", () => {
|
|
|
169
172
|
});
|
|
170
173
|
|
|
171
174
|
const exportResourcesFileEntity = new ExportResourcesFileEntity(file);
|
|
172
|
-
jest
|
|
175
|
+
jest
|
|
176
|
+
.spyOn(ResourceService.prototype, "findAll")
|
|
177
|
+
.mockImplementation(() => mockPassboltResponse(resourceCollectionV4));
|
|
173
178
|
await getKDBXContent(exportResourcesFileEntity, new ResourcesCollection(resourceCollectionV4));
|
|
174
179
|
|
|
175
180
|
const result = await controller.exec(file);
|
|
@@ -19,12 +19,12 @@ import { multipleResourceDtos } from "../../service/resource/findResourcesServic
|
|
|
19
19
|
import FindAllByIdsForDisplayPermissionsController from "./findAllByIdsForDisplayPermissionsController";
|
|
20
20
|
import ResourcesCollection from "../../model/entity/resource/resourcesCollection";
|
|
21
21
|
import { pgpKeys } from "passbolt-styleguide/test/fixture/pgpKeys/keys";
|
|
22
|
-
import ResourceService from "../../service/api/resource/resourceService";
|
|
23
22
|
import { v4 as uuidv4 } from "uuid";
|
|
24
23
|
import { TEST_RESOURCE_TYPE_V5_DEFAULT } from "passbolt-styleguide/src/shared/models/entity/resourceType/resourceTypeEntity.test.data";
|
|
25
24
|
import { METADATA_KEY_TYPE_USER_KEY } from "../../model/entity/resource/resourceEntity";
|
|
26
25
|
import { defaultResourceDto } from "passbolt-styleguide/src/shared/models/entity/resource/resourceEntity.test.data";
|
|
27
26
|
import { metadata } from "passbolt-styleguide/test/fixture/encryptedMetadata/metadata";
|
|
27
|
+
import { mockPassboltResponse } from "passbolt-styleguide/test/mocks/mockApiResponse";
|
|
28
28
|
|
|
29
29
|
describe("FindAllByIdsForDisplayPermissionsController", () => {
|
|
30
30
|
let controller, worker;
|
|
@@ -46,7 +46,9 @@ describe("FindAllByIdsForDisplayPermissionsController", () => {
|
|
|
46
46
|
|
|
47
47
|
const resourcesDto = multipleResourceDtos();
|
|
48
48
|
const resourceIds = resourcesDto.map((resource) => resource.id);
|
|
49
|
-
jest
|
|
49
|
+
jest
|
|
50
|
+
.spyOn(controller.findResourcesService.resourceService, "findAll")
|
|
51
|
+
.mockImplementation(() => mockPassboltResponse(resourcesDto));
|
|
50
52
|
jest
|
|
51
53
|
.spyOn(controller.findResourcesService.decryptMetadataService, "decryptAllFromForeignModels")
|
|
52
54
|
.mockImplementation((collection) => collection);
|
|
@@ -73,7 +75,10 @@ describe("FindAllByIdsForDisplayPermissionsController", () => {
|
|
|
73
75
|
}),
|
|
74
76
|
];
|
|
75
77
|
const resourceIds = resourcesDto.map((resource) => resource.id);
|
|
76
|
-
jest
|
|
78
|
+
jest
|
|
79
|
+
.spyOn(controller.findResourcesService.resourceService, "findAll")
|
|
80
|
+
.mockImplementation(() => mockPassboltResponse(resourcesDto));
|
|
81
|
+
|
|
77
82
|
jest.spyOn(controller.getPassphraseService, "getPassphrase").mockReturnValue(pgpKeys.ada.passphrase);
|
|
78
83
|
|
|
79
84
|
const result = await controller.exec(resourceIds);
|
package/src/all/background_page/controller/resource/findAllIdsByIsSharedWithGroupController.test.js
CHANGED
|
@@ -28,6 +28,7 @@ import { METADATA_KEY_TYPE_USER_KEY } from "../../model/entity/resource/resource
|
|
|
28
28
|
import { defaultResourceDto } from "passbolt-styleguide/src/shared/models/entity/resource/resourceEntity.test.data";
|
|
29
29
|
import { metadata } from "passbolt-styleguide/test/fixture/encryptedMetadata/metadata";
|
|
30
30
|
import { pgpKeys } from "passbolt-styleguide/test/fixture/pgpKeys/keys";
|
|
31
|
+
import { mockPassboltResponse } from "passbolt-styleguide/test/mocks/mockApiResponse";
|
|
31
32
|
|
|
32
33
|
describe("FindAllIdsByIsSharedWithGroupController", () => {
|
|
33
34
|
let controller, worker, groupId;
|
|
@@ -52,7 +53,9 @@ describe("FindAllIdsByIsSharedWithGroupController", () => {
|
|
|
52
53
|
|
|
53
54
|
const resourceCollectionDto = multipleResourceDtos();
|
|
54
55
|
const expectedResult = new ResourcesCollection(resourceCollectionDto).extract("id");
|
|
55
|
-
jest
|
|
56
|
+
jest
|
|
57
|
+
.spyOn(ResourceService.prototype, "findAll")
|
|
58
|
+
.mockImplementation(() => mockPassboltResponse(resourceCollectionDto));
|
|
56
59
|
|
|
57
60
|
await controller._exec(groupId);
|
|
58
61
|
|
|
@@ -78,7 +81,9 @@ describe("FindAllIdsByIsSharedWithGroupController", () => {
|
|
|
78
81
|
|
|
79
82
|
const resourceCollectionDto = multipleResourceDtos();
|
|
80
83
|
const expectedResult = new ResourcesCollection(resourceCollectionDto).extract("id");
|
|
81
|
-
jest
|
|
84
|
+
jest
|
|
85
|
+
.spyOn(ResourceService.prototype, "findAll")
|
|
86
|
+
.mockImplementation(() => mockPassboltResponse(resourceCollectionDto));
|
|
82
87
|
jest.spyOn(FindAndUpdateResourcesLocalStorage.prototype, "findAndUpdateByIsSharedWithGroup");
|
|
83
88
|
|
|
84
89
|
const resourceIds = await controller.exec(groupId);
|
|
@@ -102,7 +107,7 @@ describe("FindAllIdsByIsSharedWithGroupController", () => {
|
|
|
102
107
|
}),
|
|
103
108
|
];
|
|
104
109
|
jest.spyOn(controller.findAndUpdateResourcesLocalStorage, "findAndUpdateByIsSharedWithGroup");
|
|
105
|
-
jest.spyOn(ResourceService.prototype, "findAll").mockImplementation(() => resourcesDto);
|
|
110
|
+
jest.spyOn(ResourceService.prototype, "findAll").mockImplementation(() => mockPassboltResponse(resourcesDto));
|
|
106
111
|
jest.spyOn(controller.getPassphraseService, "getPassphrase").mockReturnValue(pgpKeys.ada.passphrase);
|
|
107
112
|
|
|
108
113
|
const result = await controller.exec(groupId);
|
|
@@ -118,7 +123,7 @@ describe("FindAllIdsByIsSharedWithGroupController", () => {
|
|
|
118
123
|
it("Should allow a group to not include any resources", async () => {
|
|
119
124
|
expect.assertions(2);
|
|
120
125
|
|
|
121
|
-
jest.spyOn(ResourceService.prototype, "findAll").mockImplementation(() => []);
|
|
126
|
+
jest.spyOn(ResourceService.prototype, "findAll").mockImplementation(() => mockPassboltResponse([]));
|
|
122
127
|
const resourceIds = await controller.exec(groupId);
|
|
123
128
|
|
|
124
129
|
expect(resourceIds.length).toEqual(0);
|
|
@@ -27,6 +27,7 @@ import { TEST_RESOURCE_TYPE_V5_DEFAULT } from "passbolt-styleguide/src/shared/mo
|
|
|
27
27
|
import { METADATA_KEY_TYPE_USER_KEY } from "../../model/entity/resource/resourceEntity";
|
|
28
28
|
import { v4 as uuidv4 } from "uuid";
|
|
29
29
|
import { metadata } from "passbolt-styleguide/test/fixture/encryptedMetadata/metadata";
|
|
30
|
+
import { mockPassboltResponse } from "passbolt-styleguide/test/mocks/mockApiResponse";
|
|
30
31
|
|
|
31
32
|
describe("ResourceUpdateLocalStorageController", () => {
|
|
32
33
|
let controller, worker;
|
|
@@ -73,14 +74,16 @@ describe("ResourceUpdateLocalStorageController", () => {
|
|
|
73
74
|
it("requests the user passphrase whenever the decryption of the metadata requires it and try to load the data again", async () => {
|
|
74
75
|
expect.assertions(4);
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
const resources = [
|
|
77
78
|
defaultResourceDto({
|
|
78
79
|
resource_type_id: TEST_RESOURCE_TYPE_V5_DEFAULT,
|
|
79
80
|
metadata_key_type: METADATA_KEY_TYPE_USER_KEY,
|
|
80
81
|
metadata_key_id: uuidv4(),
|
|
81
82
|
metadata: metadata.withAdaKey.encryptedMetadata[0],
|
|
82
83
|
}),
|
|
83
|
-
]
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
jest.spyOn(ResourceService.prototype, "findAll").mockImplementation(() => mockPassboltResponse(resources));
|
|
84
87
|
jest.spyOn(ResourceTypeService.prototype, "findAll").mockImplementation(() => resourceTypesCollectionDto());
|
|
85
88
|
jest.spyOn(GetPassphraseService.prototype, "requestPassphrase").mockImplementation(() => pgpKeys.ada.passphrase);
|
|
86
89
|
jest.spyOn(PassphraseStorageService, "set").mockImplementation(() => {});
|
|
@@ -0,0 +1,63 @@
|
|
|
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.13.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import UpdateSubscriptionEntity from "../../model/entity/subscription/update/updateSubscriptionEntity";
|
|
16
|
+
import PostLogoutService from "../../service/auth/postLogoutService";
|
|
17
|
+
import CreateSubscriptionKeyService from "../../service/subscription/createSubscriptionKeyService";
|
|
18
|
+
|
|
19
|
+
export default class CreateSubscriptionKeyController {
|
|
20
|
+
/**
|
|
21
|
+
* @constructor
|
|
22
|
+
* @param {Worker} worker
|
|
23
|
+
* @param {string} requestId
|
|
24
|
+
* @param {ApiClientOptions} apiClientOptions
|
|
25
|
+
*/
|
|
26
|
+
constructor(worker, requestId, apiClientOptions) {
|
|
27
|
+
this.worker = worker;
|
|
28
|
+
this.requestId = requestId;
|
|
29
|
+
|
|
30
|
+
this.createSubscriptionService = new CreateSubscriptionKeyService(apiClientOptions);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Controller executor
|
|
35
|
+
* @returns {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
async _exec() {
|
|
38
|
+
try {
|
|
39
|
+
const result = await this.exec.apply(this, arguments);
|
|
40
|
+
this.worker.port.emit(this.requestId, "SUCCESS", result);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(error);
|
|
43
|
+
this.worker.port.emit(this.requestId, "ERROR", error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Create the subscription key (upgrade CE to PRO).
|
|
49
|
+
* @param {{ data: string }} subscriptionKeyDto The new subscription key
|
|
50
|
+
* @returns {Promise<SubscriptionEntity>} The subscription key
|
|
51
|
+
* @throws {Error} Throws an error when encountering any network error
|
|
52
|
+
* @throws {ValidationError} Throws an error if subscriptionKeyDto format is incorrect
|
|
53
|
+
* @throws {PassboltSubscriptionError} Throws `PassboltSubscriptionError` when subscription is already expired or user limit reached
|
|
54
|
+
*/
|
|
55
|
+
async exec(subscriptionKeyDto) {
|
|
56
|
+
const subscriptionKeyEntity = new UpdateSubscriptionEntity(subscriptionKeyDto);
|
|
57
|
+
const subscriptionEntity = await this.createSubscriptionService.create(subscriptionKeyEntity);
|
|
58
|
+
|
|
59
|
+
await PostLogoutService.exec();
|
|
60
|
+
|
|
61
|
+
return subscriptionEntity;
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/all/background_page/controller/subscription/createSubscriptionKeyController.test.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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.13.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import SubscriptionEntity from "passbolt-styleguide/src/shared/models/entity/subscription/subscriptionEntity";
|
|
16
|
+
import { defaultApiClientOptions } from "passbolt-styleguide/src/shared/lib/apiClient/apiClientOptions.test.data";
|
|
17
|
+
import { mockSubscriptionUpdated } from "passbolt-styleguide/src/react-extension/components/Administration/DisplaySubscriptionKey/DisplaySubscriptionKey.test.data";
|
|
18
|
+
|
|
19
|
+
import CreateSubscriptionKeyController from "./createSubscriptionKeyController";
|
|
20
|
+
import PostLogoutService from "../../service/auth/postLogoutService";
|
|
21
|
+
|
|
22
|
+
describe("CreateSubscriptionKeyController", () => {
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
jest.clearAllMocks();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("::exec", () => {
|
|
28
|
+
it("should create the subscription key and log the user out", async () => {
|
|
29
|
+
expect.assertions(3);
|
|
30
|
+
|
|
31
|
+
const controller = new CreateSubscriptionKeyController(null, null, defaultApiClientOptions());
|
|
32
|
+
jest
|
|
33
|
+
.spyOn(controller.createSubscriptionService, "create")
|
|
34
|
+
.mockResolvedValue(new SubscriptionEntity(mockSubscriptionUpdated));
|
|
35
|
+
jest.spyOn(PostLogoutService, "exec").mockImplementation(async () => {});
|
|
36
|
+
|
|
37
|
+
const result = await controller.exec({ data: mockSubscriptionUpdated.data });
|
|
38
|
+
|
|
39
|
+
expect(result).toEqual(new SubscriptionEntity(mockSubscriptionUpdated));
|
|
40
|
+
expect(controller.createSubscriptionService.create).toHaveBeenCalledTimes(1);
|
|
41
|
+
expect(PostLogoutService.exec).toHaveBeenCalledTimes(1);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("should not catch errors", async () => {
|
|
45
|
+
expect.assertions(2);
|
|
46
|
+
|
|
47
|
+
const expectedError = new Error("Something went wrong!");
|
|
48
|
+
const controller = new CreateSubscriptionKeyController(null, null, defaultApiClientOptions());
|
|
49
|
+
jest.spyOn(controller.createSubscriptionService, "create").mockRejectedValue(expectedError);
|
|
50
|
+
jest.spyOn(PostLogoutService, "exec").mockImplementation(async () => {});
|
|
51
|
+
|
|
52
|
+
await expect(controller.exec({ data: mockSubscriptionUpdated.data })).rejects.toStrictEqual(expectedError);
|
|
53
|
+
expect(PostLogoutService.exec).not.toHaveBeenCalled();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
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.13.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import PostLogoutService from "../../service/auth/postLogoutService";
|
|
16
|
+
import DeleteSubscriptionKeyService from "../../service/subscription/deleteSubscriptionKeyService";
|
|
17
|
+
|
|
18
|
+
export default class DeleteSubscriptionKeyController {
|
|
19
|
+
/**
|
|
20
|
+
* @constructor
|
|
21
|
+
* @param {Worker} worker
|
|
22
|
+
* @param {string} requestId
|
|
23
|
+
* @param {ApiClientOptions} apiClientOptions
|
|
24
|
+
*/
|
|
25
|
+
constructor(worker, requestId, apiClientOptions) {
|
|
26
|
+
this.worker = worker;
|
|
27
|
+
this.requestId = requestId;
|
|
28
|
+
|
|
29
|
+
this.deleteSubscriptionService = new DeleteSubscriptionKeyService(apiClientOptions);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Controller executor
|
|
34
|
+
* @returns Promise<void>
|
|
35
|
+
*/
|
|
36
|
+
async _exec() {
|
|
37
|
+
try {
|
|
38
|
+
const result = await this.exec.apply(this, arguments);
|
|
39
|
+
this.worker.port.emit(this.requestId, "SUCCESS", result);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error(error);
|
|
42
|
+
this.worker.port.emit(this.requestId, "ERROR", error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Delete the subscription key (downgrade PRO to CE).
|
|
48
|
+
* @returns {Promise<void>}
|
|
49
|
+
* @throws {Error} Throws an error when encountering any network or server error
|
|
50
|
+
*/
|
|
51
|
+
async exec() {
|
|
52
|
+
await this.deleteSubscriptionService.delete();
|
|
53
|
+
await PostLogoutService.exec();
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/all/background_page/controller/subscription/deleteSubscriptionKeyController.test.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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.13.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { defaultApiClientOptions } from "passbolt-styleguide/src/shared/lib/apiClient/apiClientOptions.test.data";
|
|
16
|
+
|
|
17
|
+
import DeleteSubscriptionKeyController from "./deleteSubscriptionKeyController";
|
|
18
|
+
import PostLogoutService from "../../service/auth/postLogoutService";
|
|
19
|
+
|
|
20
|
+
describe("DeleteSubscriptionKeyController", () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
jest.clearAllMocks();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("::exec", () => {
|
|
26
|
+
it("should delete the subscription key and log the user out", async () => {
|
|
27
|
+
expect.assertions(3);
|
|
28
|
+
|
|
29
|
+
const controller = new DeleteSubscriptionKeyController(null, null, defaultApiClientOptions());
|
|
30
|
+
jest.spyOn(controller.deleteSubscriptionService, "delete").mockResolvedValue(undefined);
|
|
31
|
+
jest.spyOn(PostLogoutService, "exec").mockImplementation(async () => {});
|
|
32
|
+
|
|
33
|
+
await expect(controller.exec()).resolves.toBeUndefined();
|
|
34
|
+
expect(controller.deleteSubscriptionService.delete).toHaveBeenCalledTimes(1);
|
|
35
|
+
expect(PostLogoutService.exec).toHaveBeenCalledTimes(1);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should not catch errors", async () => {
|
|
39
|
+
expect.assertions(2);
|
|
40
|
+
|
|
41
|
+
const expectedError = new Error("Something went wrong!");
|
|
42
|
+
const controller = new DeleteSubscriptionKeyController(null, null, defaultApiClientOptions());
|
|
43
|
+
jest.spyOn(controller.deleteSubscriptionService, "delete").mockRejectedValue(expectedError);
|
|
44
|
+
jest.spyOn(PostLogoutService, "exec").mockImplementation(async () => {});
|
|
45
|
+
|
|
46
|
+
await expect(controller.exec()).rejects.toStrictEqual(expectedError);
|
|
47
|
+
expect(PostLogoutService.exec).not.toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|