passbolt-browser-extension 5.14.2 → 5.15.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/.devcontainer/Dockerfile +1 -1
- package/.devcontainer/devcontainer.json +1 -1
- package/.github/workflows/codeql-analysis.yml +1 -1
- package/.github/workflows/release_candidate.yaml +1 -1
- package/CHANGELOG.md +81 -1
- package/RELEASE_NOTES.md +91 -4
- package/build-safari-extension/Passbolt-Safari-Extension/Passbolt - password manager.xcodeproj/project.pbxproj +8 -8
- package/package.json +7 -7
- package/src/all/background_page/pagemod/appBootstrapPagemod.js +15 -5
- package/src/all/background_page/pagemod/appBootstrapPagemod.test.js +17 -0
- package/src/all/background_page/service/accountRecovery/buildApprovedAccountRecoveryUserSettingEntityService.js +2 -2
- package/src/all/background_page/service/auth/startLoopAuthSessionCheckService.js +13 -2
- package/src/all/background_page/service/auth/startLoopAuthSessionCheckService.test.js +28 -0
- package/src/all/background_page/service/authenticationStatusService.js +3 -0
- package/src/all/background_page/service/authenticationStatusService.test.js +10 -0
- package/src/all/background_page/service/crypto/cryptoRandomValuesService.js +19 -0
- package/src/all/background_page/service/crypto/cryptoRandomValuesService.test.js +22 -0
- package/src/all/background_page/service/group/groupUpdateSecretsCryptoService.js +27 -5
- package/src/all/background_page/service/group/groupUpdateSecretsCryptoService.test.js +100 -0
- package/src/all/background_page/service/group/groupUpdateService.js +7 -3
- package/src/all/background_page/service/group/groupUpdateService.test.js +39 -0
- package/src/all/background_page/service/sessionKey/decryptSessionKeysBundlesService.test.js +4 -1
- package/src/all/background_page/service/siteSettings/findAndUpdateSiteSettingsLocalStorageService.js +9 -3
- package/src/all/background_page/service/siteSettings/findAndUpdateSiteSettingsLocalStorageService.test.js +18 -0
- package/src/all/background_page/service/siteSettings/getOrFindSiteSettingsService.js +10 -2
- package/src/all/background_page/service/siteSettings/getOrFindSiteSettingsService.test.js +42 -0
- package/src/all/background_page/utils/openpgp/openpgpAssertions.js +2 -2
- package/src/chrome/manifest.json +1 -1
- package/src/chrome-mv3/manifest.json +1 -1
- package/src/chrome-mv3/offscreens/service/group/addUsersToGroupOffscreenService.js +9 -0
- package/src/chrome-mv3/offscreens/service/group/addUsersToGroupOffscreenService.test.js +38 -0
- package/src/chrome-mv3/serviceWorker/service/addUsersToGroup/responseAddUsersToGroupOffscreenService.js +33 -1
- package/src/chrome-mv3/serviceWorker/service/addUsersToGroup/responseAddUsersToGroupOffscreenService.test.js +47 -0
- package/src/firefox/manifest.json +1 -1
- package/src/safari/manifest.json +1 -1
- package/webpack/passboltEnvPlugin.js +9 -10
package/.devcontainer/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM mcr.microsoft.com/devcontainers/typescript-node:22
|
|
1
|
+
FROM mcr.microsoft.com/devcontainers/typescript-node:22@sha256:4f634c449931ac2aff140f9fac5825413196e631ccc0eb7afd17033144253be4
|
|
2
2
|
|
|
3
3
|
RUN npm install -g @aikidosec/safe-chain \
|
|
4
4
|
&& install -d -o node -g node /home/node/.safe-chain \
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"service": "devcontainer",
|
|
6
6
|
"workspaceFolder": "/workspaces/passbolt-browser-extension",
|
|
7
7
|
"features": {
|
|
8
|
-
"ghcr.io/devcontainers/features/git:1": {}
|
|
8
|
+
"ghcr.io/devcontainers/features/git:1@sha256:fd75977de13a9979000e0e78baf949adb0ca71d2398995fa22e0a36d7e7e7fe2": {}
|
|
9
9
|
},
|
|
10
10
|
"customizations": {
|
|
11
11
|
"vscode": {
|
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
18
|
- name: Checkout repository
|
|
19
|
-
uses: actions/checkout@
|
|
19
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
20
20
|
with:
|
|
21
21
|
persist-credentials: false
|
|
22
22
|
# We must fetch at least the immediate parents so that if this is
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,84 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [5.15.0] - 2026-08-20
|
|
8
|
+
### Added
|
|
9
|
+
PB-53103 - AUTOFILL EPIC - Autofill improvements
|
|
10
|
+
PB-53105 - Add ShadowDomDictionary and InFormFieldDictionary
|
|
11
|
+
PB-53107 - Create ShadowRootResolverService
|
|
12
|
+
PB-53108 - Add ShadowRootCollectorService
|
|
13
|
+
PB-53109 - Add ShadowRootCacheService
|
|
14
|
+
PB-53110 - Add ShadowMutationObserverService
|
|
15
|
+
PB-53120 - Add ShadowDomQueryService
|
|
16
|
+
PB-53121 - Add ShadowDomFocusHealerService
|
|
17
|
+
PB-53122 - Add InFormFieldGeometryService
|
|
18
|
+
PB-53123 - Update InFormCallToActionField to use ShadowRootCacheService, ShadowDomQueryService and InFormFieldGeometryService
|
|
19
|
+
PB-53124 - Find username element through shadow doms if needed
|
|
20
|
+
PB-53125 - Switch from DomUtils to InFormFieldGeometryService in InformMenuField
|
|
21
|
+
PB-53126 - Listen for focus event on the whole page to detect missed inputs
|
|
22
|
+
PB-53127 - Refactor InFormManager to use previously created services
|
|
23
|
+
PB-53128 - Refactor DomUtils
|
|
24
|
+
PB-53574 - Shadow dom should solve duck-types as a shadow root
|
|
25
|
+
PB-53619 - Shadow dom piercing is missing on the autofill resolver
|
|
26
|
+
PB-53394 - Global new design of share dialog
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
PB-48042 - Sign-in with SSO secondary CTA alignment on sign-in with passphrase page
|
|
30
|
+
PB-52353 - Clicking on several items is not possible when filtering the grid by expired
|
|
31
|
+
PB-52539 - Left side bar alignment adjustments
|
|
32
|
+
PB-53329 - Discrepancy in data (group or member) display when we remove and add them again
|
|
33
|
+
PB-53819 - Fix height for share dialog badges and dropdowns
|
|
34
|
+
PB-53820 - Fix revert button disappearing at certain widths
|
|
35
|
+
PB-53921 - Fix application crash after creating a resource in a shared folder while transferring ownership
|
|
36
|
+
PB-53497 - Fix crash when is-authenticated endpoint response is not JSON
|
|
37
|
+
|
|
38
|
+
### Security
|
|
39
|
+
PB-53357 - Fix js-yaml GCVE-0-2026-59869 - HIGH CVSS3.1
|
|
40
|
+
PB-53358 - Fix brace-expansion GHSA-3jxr-9vmj-r5cp - HIGH CVSS4.0
|
|
41
|
+
PB-53386 - Potential Cross Site Scripting (XSS) via window.location.href (Low)
|
|
42
|
+
PB-53391 - Fix svgo GHSA-2p49-hgcm-8545 - HIGH CVSS3.1
|
|
43
|
+
PB-53392 - Fix fast-uri GHSA-4c8g-83qw-93j6 - HIGH CVSS3.1
|
|
44
|
+
PB-53401 - Fix shell-quote GHSA-395f-4hp3-45gv - HIGH CVSS4.0
|
|
45
|
+
PB-53402 - Fix websocket-driver GHSA-xv26-6w52-cph6 - CRITICAL CVSS4.0
|
|
46
|
+
PB-53403 - Fix postcss GHSA-r28c-9q8g-f849 - HIGH CVSS3.1
|
|
47
|
+
PB-53404 - Fix webpack-dev-server GHSA-m28w-2pqf-7qgj - MEDIUM CVSS3.1
|
|
48
|
+
PB-53405 - Fix body-parser GHSA-v422-hmwv-36x6 - LOW CVSS3.1
|
|
49
|
+
PB-53550 - Small upgrade for js-yaml (Low)
|
|
50
|
+
PB-53552 - Fix fast-uri GHSA-7p8r-x3mc-p8w7 - HIGH CVSS3.1
|
|
51
|
+
PB-53559 - Fix brace-expansion GHSA-mh99-v99m-4gvg - HIGH CVSS3.1
|
|
52
|
+
PB-53942 - Fix image-size GHSA-5p2g-fcmc-qvqq - HIGH CVSS4.0
|
|
53
|
+
PB-53357 - Fix js-yaml GCVE-0-2026-59869 - HIGH CVSS3.1
|
|
54
|
+
PB-53358 - Fix brace-expansion GHSA-3jxr-9vmj-r5cp - HIGH CVSS4.0
|
|
55
|
+
PB-53385 - Fix adm-zip GHSA-xcpc-8h2w-3j85 - HIGH CVSS3.1
|
|
56
|
+
PB-53391 - Fix svgo GHSA-2p49-hgcm-8545 - HIGH CVSS3.1
|
|
57
|
+
PB-53392 - Fix fast-uri GHSA-4c8g-83qw-93j6 - HIGH CVSS3.1
|
|
58
|
+
PB-53401 - Fix shell-quote GHSA-395f-4hp3-45gv - HIGH CVSS4.0
|
|
59
|
+
PB-53550 - Small upgrade for js-yaml (Low)
|
|
60
|
+
PB-53552 - Fix fast-uri GHSA-7p8r-x3mc-p8w7 - HIGH CVSS3.1
|
|
61
|
+
PB-53553 - Fix undici GHSA-4cwx-7wf7-3272 - HIGH CVSS3.1
|
|
62
|
+
PB-53559 - Fix brace-expansion GHSA-mh99-v99m-4gvg - HIGH CVSS3.1
|
|
63
|
+
PB-53940 - Small upgrade for @xmldom/xmldom (High)
|
|
64
|
+
|
|
65
|
+
### Maintenance
|
|
66
|
+
PB-53204 - Reverse passboltEnvPlugin logic
|
|
67
|
+
PB-53671 - Replace the forked secrets.js library with a native randomHex
|
|
68
|
+
PB-53764 - Update Storybook libraries in passbolt-styleguide to remove vulnerable dependencies while keeping the Storybook scripts functional
|
|
69
|
+
PB-53934 - Use correct version for github-pages-deploy-action
|
|
70
|
+
PB-53972 - Clean comment in ShareDialog
|
|
71
|
+
|
|
72
|
+
## [5.14.4] - 2026-08-10
|
|
73
|
+
### Fixed
|
|
74
|
+
- PB-53681: Safari applies URLs redirection on created resource too early
|
|
75
|
+
|
|
76
|
+
## [5.14.3] - 2026-08-03
|
|
77
|
+
### Fixed
|
|
78
|
+
- PB-53406: PCD: do not display when editing a shared resource metadata only
|
|
79
|
+
- PB-53471: PCD: creation of a shared resource in a non owned folder should display the PCD in read-only
|
|
80
|
+
- PB-53546: Fix in form menu integration disablement behaviour
|
|
81
|
+
|
|
82
|
+
### Maintenance
|
|
83
|
+
- PB-53384: Add logs for errors on the process "add user to group"
|
|
84
|
+
|
|
7
85
|
## [5.14.2] - 2026-07-27
|
|
8
86
|
### Fixed
|
|
9
87
|
- PB-53322: throttle permissions confirmation dialog requests
|
|
@@ -2925,7 +3003,9 @@ self registration settings option in the left-side bar
|
|
|
2925
3003
|
- AP: User with plugin installed
|
|
2926
3004
|
- LU: Logged in user
|
|
2927
3005
|
|
|
2928
|
-
[Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.
|
|
3006
|
+
[Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.4...HEAD
|
|
3007
|
+
[5.14.4]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.3...v5.14.4
|
|
3008
|
+
[5.14.3]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.2...v5.14.3
|
|
2929
3009
|
[5.14.2]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.1...v5.14.2
|
|
2930
3010
|
[5.14.1]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.0...v5.14.1
|
|
2931
3011
|
[5.14.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.13.4...v5.14.0
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,6 +1,93 @@
|
|
|
1
|
-
# v5.
|
|
1
|
+
# v5.15.0
|
|
2
|
+
Passbolt 5.15.0 improves form detection for autofill, makes permission changes easier to review, and adds several security and administration improvements. This release also introduces new session management tooling and additional safeguards for Passbolt Pro.
|
|
3
|
+
|
|
4
|
+
## Clearer permission confirmation changes
|
|
5
|
+
The permission confirmation dialog has been visually improved to make access changes clearer before they are applied. Users can now understand the impact of permission changes more clearly before applying them. New badges show whether permissions are being added, modified, or deleted.
|
|
6
|
+
|
|
7
|
+
Deleted permissions can also be rolled back to their original state before confirmation, making access changes easier to review and correct.
|
|
8
|
+
|
|
9
|
+
## Improved autofill
|
|
10
|
+
Passbolt 5.15.0 continues the process to improve the autofill feature in several phases. This first iteration improves detection on websites that were previously unsupported, enhancing the end-user experience by identifying complex forms and simplifying it.
|
|
11
|
+
|
|
12
|
+
Upcoming releases will have iterations focusing on reducing false positives and refining the classification further.
|
|
13
|
+
|
|
14
|
+
## Miscellaneous Improvements
|
|
15
|
+
### Database-backed sessions for Passbolt API (Beta)
|
|
16
|
+
|
|
17
|
+
Passbolt API now supports database-backed sessions in beta, helping improve API performance and simplify high-availability deployments without relying on third-party caching systems such as Redis. By removing file-based session locking, requests from the same user can run in parallel, while load-balanced deployments no longer require sticky sessions.
|
|
18
|
+
|
|
19
|
+
The feature must be enabled manually by a system administrator.
|
|
20
|
+
|
|
21
|
+
A new healthcheck now identifies the active session provider, helping administrators verify their session setup. A new purge command can clear stored sessions when needed, while the sessions table is created automatically if it is not already in place.
|
|
22
|
+
|
|
23
|
+
### Deleted user notifications
|
|
24
|
+
|
|
25
|
+
Administrators are now notified whenever any user is deleted, giving them better visibility into account removals across the organisation. Previously, notifications were sent only when an administrator was deleted.
|
|
26
|
+
|
|
27
|
+
## Conclusion
|
|
28
|
+
As usual, release 5.15.0 has dependency updates Many thanks to everyone who provided feedback, reported bugs, and contributed to making passbolt better!
|
|
29
|
+
|
|
30
|
+
## Changelogs
|
|
31
|
+
### Added
|
|
32
|
+
PB-53103 - AUTOFILL EPIC - Autofill improvements
|
|
33
|
+
PB-53105 - Add ShadowDomDictionary and InFormFieldDictionary
|
|
34
|
+
PB-53107 - Create ShadowRootResolverService
|
|
35
|
+
PB-53108 - Add ShadowRootCollectorService
|
|
36
|
+
PB-53109 - Add ShadowRootCacheService
|
|
37
|
+
PB-53110 - Add ShadowMutationObserverService
|
|
38
|
+
PB-53120 - Add ShadowDomQueryService
|
|
39
|
+
PB-53121 - Add ShadowDomFocusHealerService
|
|
40
|
+
PB-53122 - Add InFormFieldGeometryService
|
|
41
|
+
PB-53123 - Update InFormCallToActionField to use ShadowRootCacheService, ShadowDomQueryService and InFormFieldGeometryService
|
|
42
|
+
PB-53124 - Find username element through shadow doms if needed
|
|
43
|
+
PB-53125 - Switch from DomUtils to InFormFieldGeometryService in InformMenuField
|
|
44
|
+
PB-53126 - Listen for focus event on the whole page to detect missed inputs
|
|
45
|
+
PB-53127 - Refactor InFormManager to use previously created services
|
|
46
|
+
PB-53128 - Refactor DomUtils
|
|
47
|
+
PB-53574 - Shadow dom should solve duck-types as a shadow root
|
|
48
|
+
PB-53619 - Shadow dom piercing is missing on the autofill resolver
|
|
49
|
+
PB-53394 - Global new design of share dialog
|
|
2
50
|
|
|
3
51
|
### Fixed
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
52
|
+
PB-48042 - Sign-in with SSO secondary CTA alignment on sign-in with passphrase page
|
|
53
|
+
PB-52353 - Clicking on several items is not possible when filtering the grid by expired
|
|
54
|
+
PB-52539 - Left side bar alignment adjustments
|
|
55
|
+
PB-53329 - Discrepancy in data (group or member) display when we remove and add them again
|
|
56
|
+
PB-53819 - Fix height for share dialog badges and dropdowns
|
|
57
|
+
PB-53820 - Fix revert button disappearing at certain widths
|
|
58
|
+
PB-53921 - Fix application crash after creating a resource in a shared folder while transferring ownership
|
|
59
|
+
PB-53497 - Fix crash when is-authenticated endpoint response is not JSON
|
|
60
|
+
|
|
61
|
+
### Security
|
|
62
|
+
PB-53357 - Fix js-yaml GCVE-0-2026-59869 - HIGH CVSS3.1
|
|
63
|
+
PB-53358 - Fix brace-expansion GHSA-3jxr-9vmj-r5cp - HIGH CVSS4.0
|
|
64
|
+
PB-53386 - Potential Cross Site Scripting (XSS) via window.location.href (Low)
|
|
65
|
+
PB-53391 - Fix svgo GHSA-2p49-hgcm-8545 - HIGH CVSS3.1
|
|
66
|
+
PB-53392 - Fix fast-uri GHSA-4c8g-83qw-93j6 - HIGH CVSS3.1
|
|
67
|
+
PB-53401 - Fix shell-quote GHSA-395f-4hp3-45gv - HIGH CVSS4.0
|
|
68
|
+
PB-53402 - Fix websocket-driver GHSA-xv26-6w52-cph6 - CRITICAL CVSS4.0
|
|
69
|
+
PB-53403 - Fix postcss GHSA-r28c-9q8g-f849 - HIGH CVSS3.1
|
|
70
|
+
PB-53404 - Fix webpack-dev-server GHSA-m28w-2pqf-7qgj - MEDIUM CVSS3.1
|
|
71
|
+
PB-53405 - Fix body-parser GHSA-v422-hmwv-36x6 - LOW CVSS3.1
|
|
72
|
+
PB-53550 - Small upgrade for js-yaml (Low)
|
|
73
|
+
PB-53552 - Fix fast-uri GHSA-7p8r-x3mc-p8w7 - HIGH CVSS3.1
|
|
74
|
+
PB-53559 - Fix brace-expansion GHSA-mh99-v99m-4gvg - HIGH CVSS3.1
|
|
75
|
+
PB-53942 - Fix image-size GHSA-5p2g-fcmc-qvqq - HIGH CVSS4.0
|
|
76
|
+
PB-53357 - Fix js-yaml GCVE-0-2026-59869 - HIGH CVSS3.1
|
|
77
|
+
PB-53358 - Fix brace-expansion GHSA-3jxr-9vmj-r5cp - HIGH CVSS4.0
|
|
78
|
+
PB-53385 - Fix adm-zip GHSA-xcpc-8h2w-3j85 - HIGH CVSS3.1
|
|
79
|
+
PB-53391 - Fix svgo GHSA-2p49-hgcm-8545 - HIGH CVSS3.1
|
|
80
|
+
PB-53392 - Fix fast-uri GHSA-4c8g-83qw-93j6 - HIGH CVSS3.1
|
|
81
|
+
PB-53401 - Fix shell-quote GHSA-395f-4hp3-45gv - HIGH CVSS4.0
|
|
82
|
+
PB-53550 - Small upgrade for js-yaml (Low)
|
|
83
|
+
PB-53552 - Fix fast-uri GHSA-7p8r-x3mc-p8w7 - HIGH CVSS3.1
|
|
84
|
+
PB-53553 - Fix undici GHSA-4cwx-7wf7-3272 - HIGH CVSS3.1
|
|
85
|
+
PB-53559 - Fix brace-expansion GHSA-mh99-v99m-4gvg - HIGH CVSS3.1
|
|
86
|
+
PB-53940 - Small upgrade for @xmldom/xmldom (High)
|
|
87
|
+
|
|
88
|
+
### Maintenance
|
|
89
|
+
PB-53204 - Reverse passboltEnvPlugin logic
|
|
90
|
+
PB-53671 - Replace the forked secrets.js library with a native randomHex
|
|
91
|
+
PB-53764 - Update Storybook libraries in passbolt-styleguide to remove vulnerable dependencies while keeping the Storybook scripts functional
|
|
92
|
+
PB-53934 - Use correct version for github-pages-deploy-action
|
|
93
|
+
PB-53972 - Clean comment in ShareDialog
|
|
@@ -595,7 +595,7 @@
|
|
|
595
595
|
buildSettings = {
|
|
596
596
|
CODE_SIGN_ENTITLEMENTS = "Passbolt - password manager Extension/Passbolt - password manager Extension.entitlements";
|
|
597
597
|
CODE_SIGN_STYLE = Automatic;
|
|
598
|
-
CURRENT_PROJECT_VERSION =
|
|
598
|
+
CURRENT_PROJECT_VERSION = 9;
|
|
599
599
|
DEAD_CODE_STRIPPING = YES;
|
|
600
600
|
DEVELOPMENT_TEAM = UHX38H22ZT;
|
|
601
601
|
ENABLE_APP_SANDBOX = YES;
|
|
@@ -622,7 +622,7 @@
|
|
|
622
622
|
"@executable_path/../../../../Frameworks",
|
|
623
623
|
);
|
|
624
624
|
MACOSX_DEPLOYMENT_TARGET = 15.6;
|
|
625
|
-
MARKETING_VERSION = 5.
|
|
625
|
+
MARKETING_VERSION = 5.14.4;
|
|
626
626
|
OTHER_LDFLAGS = (
|
|
627
627
|
"-framework",
|
|
628
628
|
SafariServices,
|
|
@@ -641,7 +641,7 @@
|
|
|
641
641
|
buildSettings = {
|
|
642
642
|
CODE_SIGN_ENTITLEMENTS = "Passbolt - password manager Extension/Passbolt - password manager Extension.entitlements";
|
|
643
643
|
CODE_SIGN_STYLE = Automatic;
|
|
644
|
-
CURRENT_PROJECT_VERSION =
|
|
644
|
+
CURRENT_PROJECT_VERSION = 9;
|
|
645
645
|
DEAD_CODE_STRIPPING = YES;
|
|
646
646
|
DEVELOPMENT_TEAM = UHX38H22ZT;
|
|
647
647
|
ENABLE_APP_SANDBOX = YES;
|
|
@@ -668,7 +668,7 @@
|
|
|
668
668
|
"@executable_path/../../../../Frameworks",
|
|
669
669
|
);
|
|
670
670
|
MACOSX_DEPLOYMENT_TARGET = 15.6;
|
|
671
|
-
MARKETING_VERSION = 5.
|
|
671
|
+
MARKETING_VERSION = 5.14.4;
|
|
672
672
|
OTHER_LDFLAGS = (
|
|
673
673
|
"-framework",
|
|
674
674
|
SafariServices,
|
|
@@ -690,7 +690,7 @@
|
|
|
690
690
|
CODE_SIGN_ENTITLEMENTS = "Passbolt - password manager/Passbolt - password manager.entitlements";
|
|
691
691
|
CODE_SIGN_STYLE = Automatic;
|
|
692
692
|
COMBINE_HIDPI_IMAGES = YES;
|
|
693
|
-
CURRENT_PROJECT_VERSION =
|
|
693
|
+
CURRENT_PROJECT_VERSION = 9;
|
|
694
694
|
DEAD_CODE_STRIPPING = YES;
|
|
695
695
|
DEVELOPMENT_TEAM = UHX38H22ZT;
|
|
696
696
|
ENABLE_APP_SANDBOX = YES;
|
|
@@ -718,7 +718,7 @@
|
|
|
718
718
|
"@executable_path/../Frameworks",
|
|
719
719
|
);
|
|
720
720
|
MACOSX_DEPLOYMENT_TARGET = 15.6;
|
|
721
|
-
MARKETING_VERSION = 5.
|
|
721
|
+
MARKETING_VERSION = 5.14.4;
|
|
722
722
|
OTHER_LDFLAGS = (
|
|
723
723
|
"-framework",
|
|
724
724
|
SafariServices,
|
|
@@ -741,7 +741,7 @@
|
|
|
741
741
|
CODE_SIGN_ENTITLEMENTS = "Passbolt - password manager/Passbolt - password manager.entitlements";
|
|
742
742
|
CODE_SIGN_STYLE = Automatic;
|
|
743
743
|
COMBINE_HIDPI_IMAGES = YES;
|
|
744
|
-
CURRENT_PROJECT_VERSION =
|
|
744
|
+
CURRENT_PROJECT_VERSION = 9;
|
|
745
745
|
DEAD_CODE_STRIPPING = YES;
|
|
746
746
|
DEVELOPMENT_TEAM = UHX38H22ZT;
|
|
747
747
|
ENABLE_APP_SANDBOX = YES;
|
|
@@ -769,7 +769,7 @@
|
|
|
769
769
|
"@executable_path/../Frameworks",
|
|
770
770
|
);
|
|
771
771
|
MACOSX_DEPLOYMENT_TARGET = 15.6;
|
|
772
|
-
MARKETING_VERSION = 5.
|
|
772
|
+
MARKETING_VERSION = 5.14.4;
|
|
773
773
|
OTHER_LDFLAGS = (
|
|
774
774
|
"-framework",
|
|
775
775
|
SafariServices,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passbolt-browser-extension",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.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,10 +21,9 @@
|
|
|
21
21
|
"kdbxweb": "2.1.1",
|
|
22
22
|
"openpgp": "^6.1.1",
|
|
23
23
|
"papaparse": "^5.5.2",
|
|
24
|
-
"passbolt-styleguide": "^5.
|
|
24
|
+
"passbolt-styleguide": "^5.15.0",
|
|
25
25
|
"react": "^18.3.1",
|
|
26
26
|
"react-dom": "^18.3.1",
|
|
27
|
-
"secrets-passbolt": "github:passbolt/secrets.js#v2.0.1",
|
|
28
27
|
"uuid": "^14.0.0",
|
|
29
28
|
"validator": "^13.15.26",
|
|
30
29
|
"webextension-polyfill": "^0.10.0",
|
|
@@ -76,10 +75,11 @@
|
|
|
76
75
|
"webpack-cli": "^7.0.2"
|
|
77
76
|
},
|
|
78
77
|
"overrides": {
|
|
79
|
-
"@xmldom/xmldom": "0.8.
|
|
78
|
+
"@xmldom/xmldom": "0.8.14",
|
|
80
79
|
"uuid": "^14.0.0",
|
|
81
|
-
"shell-quote": "1.
|
|
82
|
-
"js-yaml": "^4.2.0"
|
|
80
|
+
"shell-quote": "1.10.0",
|
|
81
|
+
"js-yaml": "^4.2.0",
|
|
82
|
+
"adm-zip": "0.6.0"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "webpack",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"dev:watch:build:chromium-mv3": "npm run dev:build:chromium-mv3 -- -w",
|
|
98
98
|
"dev:watch:build:safari": "npm run dev:build:safari -- -w",
|
|
99
99
|
"lint": "npm run lint:lockfile && npm run lint:eslint",
|
|
100
|
-
"lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts npm
|
|
100
|
+
"lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts npm --allowed-schemes \"https:\" \"git+ssh:\" --empty-hostname false --allowed-urls \"git+ssh://git@github.com/passbolt/react-list.git#f2dc5551e8ec115b160538b4d9db51286e6d6f06\"",
|
|
101
101
|
"lint:eslint": "eslint src --max-warnings 0",
|
|
102
102
|
"lint:eslint-fix": "eslint --fix src",
|
|
103
103
|
"test": "npm run test:unit",
|
|
@@ -95,11 +95,21 @@ class AppBootstrap extends Pagemod {
|
|
|
95
95
|
* @returns {Promise<boolean>}
|
|
96
96
|
*/
|
|
97
97
|
async assertUserAuthenticated() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
let isAuthenticated = false;
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
const account = await GetActiveAccountService.get();
|
|
102
|
+
const apiClientOptions = BuildApiClientOptionsService.buildFromAccount(account);
|
|
103
|
+
const checkAuthStatusService = new CheckAuthStatusService(account, apiClientOptions);
|
|
104
|
+
|
|
105
|
+
const authStatus = await checkAuthStatusService.checkAuthStatus(true);
|
|
106
|
+
isAuthenticated = authStatus.isAuthenticated;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
// An error occured while checking the auth status
|
|
109
|
+
console.error(error);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return isAuthenticated;
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
|
|
@@ -24,6 +24,7 @@ import GetActiveAccountService from "../service/account/getActiveAccountService"
|
|
|
24
24
|
import OnlineSessionEntity from "passbolt-styleguide/src/shared/models/entity/session/onlineSessionEntity";
|
|
25
25
|
import AccountEntity from "../model/entity/account/accountEntity";
|
|
26
26
|
import { defaultAccountDto } from "../model/entity/account/accountEntity.test.data";
|
|
27
|
+
import PassboltBadResponseError from "../error/passboltBadResponseError";
|
|
27
28
|
|
|
28
29
|
const spyAddWorker = jest.spyOn(WorkersSessionStorage, "addWorker");
|
|
29
30
|
jest.spyOn(ScriptExecution.prototype, "injectPortname").mockImplementation(jest.fn());
|
|
@@ -113,6 +114,22 @@ describe("AppBootstrap", () => {
|
|
|
113
114
|
// expectations
|
|
114
115
|
expect(constraint).toBeFalsy();
|
|
115
116
|
});
|
|
117
|
+
|
|
118
|
+
it("Should not be able to attach a pagemod if the authentication status threw an error", async () => {
|
|
119
|
+
expect.assertions(1);
|
|
120
|
+
|
|
121
|
+
jest.spyOn(GetActiveAccountService, "get").mockImplementation(() => new AccountEntity(defaultAccountDto()));
|
|
122
|
+
// An API error occured
|
|
123
|
+
jest.spyOn(CheckAuthStatusService.prototype, "checkAuthStatus").mockRejectedValue(new PassboltBadResponseError());
|
|
124
|
+
jest.spyOn(UserSettings.prototype, "getDomain").mockImplementation(() => "https://passbolt.dev");
|
|
125
|
+
|
|
126
|
+
const result = await AppBootstrap.canBeAttachedTo({
|
|
127
|
+
frameId: Pagemod.TOP_FRAME_ID,
|
|
128
|
+
url: "https://passbolt.dev/app",
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
expect(result).toEqual(false);
|
|
132
|
+
});
|
|
116
133
|
});
|
|
117
134
|
|
|
118
135
|
describe("AppBootstrap::attachEvents", () => {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { OpenpgpAssertion } from "../../utils/openpgp/openpgpAssertions";
|
|
16
16
|
import EncryptMessageService from "../crypto/encryptMessageService";
|
|
17
17
|
import AccountRecoveryOrganizationPolicyEntity from "../../model/entity/accountRecovery/accountRecoveryOrganizationPolicyEntity";
|
|
18
|
-
import
|
|
18
|
+
import CryptoRandomValuesService from "../crypto/cryptoRandomValuesService";
|
|
19
19
|
import AccountRecoveryPrivateKeyPasswordEntity from "passbolt-styleguide/src/shared/models/entity/accountRecovery/accountRecoveryPrivateKeyPasswordEntity";
|
|
20
20
|
import AccountRecoveryPrivateKeyPasswordDecryptedDataEntity from "../../model/entity/accountRecovery/accountRecoveryPrivateKeyPasswordDecryptedDataEntity";
|
|
21
21
|
import AccountRecoveryUserSettingEntity from "passbolt-styleguide/src/shared/models/entity/accountRecovery/accountRecoveryUserSettingEntity";
|
|
@@ -39,7 +39,7 @@ class BuildApprovedAccountRecoveryUserSettingEntityService {
|
|
|
39
39
|
throw new Error("The provided organizationPolicy must be a valid AccountRecoveryOrganizationPolicyEntity.");
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const symmetricSecret =
|
|
42
|
+
const symmetricSecret = CryptoRandomValuesService.randomHex(SYMMETRIC_SECRET_BITS);
|
|
43
43
|
const accountRecoveryPrivateKeyDto = await this._encryptPrivateKey(symmetricSecret, decryptedPrivateKey);
|
|
44
44
|
const accountRecoveryPrivateKeyPasswordForOrganizationDto =
|
|
45
45
|
await this._encryptPrivateKeyPasswordsForOrganizationKey(
|
|
@@ -55,8 +55,19 @@ class StartLoopAuthSessionCheckService {
|
|
|
55
55
|
const account = await GetActiveAccountService.get();
|
|
56
56
|
const apiClientOptions = BuildApiClientOptionsService.buildFromAccount(account);
|
|
57
57
|
const checkAuthService = new CheckAuthStatusService(account, apiClientOptions);
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
|
|
59
|
+
let isAuthenticated = false;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const authStatus = await checkAuthService.checkAuthStatus(true);
|
|
63
|
+
isAuthenticated = authStatus.isAuthenticated;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
// An error occured while checking the auth status
|
|
66
|
+
console.error(error);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!isAuthenticated) {
|
|
60
71
|
PostLogoutService.exec();
|
|
61
72
|
}
|
|
62
73
|
}
|
|
@@ -18,6 +18,7 @@ import AccountEntity from "../../model/entity/account/accountEntity";
|
|
|
18
18
|
import { defaultAccountDto } from "../../model/entity/account/accountEntity.test.data";
|
|
19
19
|
import GetActiveAccountService from "../account/getActiveAccountService";
|
|
20
20
|
import OnlineSessionEntity from "passbolt-styleguide/src/shared/models/entity/session/onlineSessionEntity";
|
|
21
|
+
import PassboltBadResponseError from "../../error/passboltBadResponseError";
|
|
21
22
|
|
|
22
23
|
jest.useFakeTimers();
|
|
23
24
|
|
|
@@ -91,4 +92,31 @@ describe("StartLoopAuthSessionCheckService", () => {
|
|
|
91
92
|
expect(spyIsAuthenticated).toHaveBeenCalledTimes(1);
|
|
92
93
|
expect(spyOnPostLogout).toHaveBeenCalledTimes(1);
|
|
93
94
|
});
|
|
95
|
+
|
|
96
|
+
it("should not send logout event if the authentication status cannot be determined, and retry on the next alarm", async () => {
|
|
97
|
+
expect.assertions(4);
|
|
98
|
+
|
|
99
|
+
const spyIsAuthenticated = jest
|
|
100
|
+
.spyOn(CheckAuthStatusService.prototype, "checkAuthStatus")
|
|
101
|
+
.mockRejectedValue(new PassboltBadResponseError());
|
|
102
|
+
const spyOnPostLogout = jest.spyOn(PostLogoutService, "exec").mockImplementation(async () => {});
|
|
103
|
+
|
|
104
|
+
browser.alarms.onAlarm.addListener(
|
|
105
|
+
async (alarm) => await StartLoopAuthSessionCheckService.handleAuthStatusCheckAlarm(alarm),
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
await StartLoopAuthSessionCheckService.exec();
|
|
109
|
+
|
|
110
|
+
await jest.advanceTimersByTime(60000);
|
|
111
|
+
await Promise.resolve();
|
|
112
|
+
|
|
113
|
+
expect(spyIsAuthenticated).toHaveBeenCalledTimes(1);
|
|
114
|
+
expect(spyOnPostLogout).not.toHaveBeenCalled();
|
|
115
|
+
|
|
116
|
+
await jest.advanceTimersByTime(60000);
|
|
117
|
+
await Promise.resolve();
|
|
118
|
+
|
|
119
|
+
expect(spyIsAuthenticated).toHaveBeenCalledTimes(2);
|
|
120
|
+
expect(spyOnPostLogout).not.toHaveBeenCalled();
|
|
121
|
+
});
|
|
94
122
|
});
|
|
@@ -31,6 +31,9 @@ class AuthenticationStatusService extends AbstractService {
|
|
|
31
31
|
/**
|
|
32
32
|
* Check if the current user is authenticated.
|
|
33
33
|
* @returns {Promise<boolean>}
|
|
34
|
+
* @throws {PassboltBadResponseError} If the response can't be parsed
|
|
35
|
+
* @throws {MfaAuthenticationRequiredError} If there was an error during the MFA
|
|
36
|
+
* @throws {NotFoundError} If the server answered with 404
|
|
34
37
|
*/
|
|
35
38
|
async isAuthenticated() {
|
|
36
39
|
const url = this.apiClient.buildUrl(`${this.apiClient.baseUrl.toString()}/is-authenticated`, null);
|
|
@@ -17,6 +17,7 @@ import { mockApiResponse, mockApiResponseError, mockApiRedirectResponse } from "
|
|
|
17
17
|
import NotFoundError from "../error/notFoundError";
|
|
18
18
|
import { defaultApiClientOptions } from "passbolt-styleguide/src/shared/lib/apiClient/apiClientOptions.test.data";
|
|
19
19
|
import MfaAuthenticationRequiredError from "../error/mfaAuthenticationRequiredError";
|
|
20
|
+
import PassboltBadResponseError from "../error/passboltBadResponseError";
|
|
20
21
|
|
|
21
22
|
beforeAll(() => {
|
|
22
23
|
enableFetchMocks();
|
|
@@ -58,4 +59,13 @@ describe("AuthenticationStatusService::isAuthenticated", () => {
|
|
|
58
59
|
const authenticationStatusService = new AuthenticationStatusService(defaultApiClientOptions());
|
|
59
60
|
await expect(authenticationStatusService.isAuthenticated()).rejects.toThrow(MfaAuthenticationRequiredError);
|
|
60
61
|
});
|
|
62
|
+
|
|
63
|
+
it("should throw a PassboltBadResponseError if the response can't be parsed (e.g HTML error page, ...)", async () => {
|
|
64
|
+
expect.assertions(1);
|
|
65
|
+
|
|
66
|
+
mockIsAuthenticated(async () => "<html><body>502 Bad Gateway</body></html>");
|
|
67
|
+
const authenticationStatusService = new AuthenticationStatusService(defaultApiClientOptions());
|
|
68
|
+
|
|
69
|
+
await expect(authenticationStatusService.isAuthenticated()).rejects.toThrow(PassboltBadResponseError);
|
|
70
|
+
});
|
|
61
71
|
});
|
|
@@ -24,6 +24,25 @@ class CryptoRandomValuesService {
|
|
|
24
24
|
self.crypto.getRandomValues(buf);
|
|
25
25
|
return buf;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generate a random bits-length number as a hexadecimal string
|
|
30
|
+
*
|
|
31
|
+
* @param bits {number} The number of random bits to generate, an integer multiple of 8 between 8 and 65536.
|
|
32
|
+
* @returns {string} A non-zero hexadecimal string of bits/4 characters, leading zeros preserved.
|
|
33
|
+
* @throws {Error} If bits is not an integer multiple of 8 between 8 and 65536.
|
|
34
|
+
*/
|
|
35
|
+
static randomHex(bits) {
|
|
36
|
+
if (!Number.isInteger(bits) || bits % 8 !== 0 || bits < 8 || bits > 65536) {
|
|
37
|
+
throw new Error("Number of bits must be an integer multiple of 8 between 8 and 65536.");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let bytes;
|
|
41
|
+
do {
|
|
42
|
+
bytes = this.randomValuesArray(bits / 8);
|
|
43
|
+
} while (!bytes.some((byte) => byte !== 0)); // an all-zero secret is rejected
|
|
44
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
45
|
+
}
|
|
27
46
|
}
|
|
28
47
|
|
|
29
48
|
export default CryptoRandomValuesService;
|
|
@@ -20,4 +20,26 @@ describe("RandomValue service", () => {
|
|
|
20
20
|
const value = CryptoRandomValuesService.randomValuesArray(32);
|
|
21
21
|
expect(value.length).toEqual(32);
|
|
22
22
|
});
|
|
23
|
+
|
|
24
|
+
describe("::randomHex", () => {
|
|
25
|
+
it("should generate a non-zero hexadecimal string of the requested bits length", () => {
|
|
26
|
+
expect.assertions(3);
|
|
27
|
+
const hex = CryptoRandomValuesService.randomHex(512);
|
|
28
|
+
expect(hex).toHaveLength(128);
|
|
29
|
+
expect(hex).toMatch(/^[0-9a-f]+$/);
|
|
30
|
+
expect(hex).toMatch(/[^0]/);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should throw if bits is not an integer multiple of 8 between 8 and 65536", () => {
|
|
34
|
+
expect.assertions(7);
|
|
35
|
+
const expectedError = new Error("Number of bits must be an integer multiple of 8 between 8 and 65536.");
|
|
36
|
+
expect(() => CryptoRandomValuesService.randomHex("512")).toThrow(expectedError);
|
|
37
|
+
expect(() => CryptoRandomValuesService.randomHex(512.5)).toThrow(expectedError);
|
|
38
|
+
expect(() => CryptoRandomValuesService.randomHex(9)).toThrow(expectedError);
|
|
39
|
+
expect(() => CryptoRandomValuesService.randomHex(510)).toThrow(expectedError);
|
|
40
|
+
expect(() => CryptoRandomValuesService.randomHex(0)).toThrow(expectedError);
|
|
41
|
+
expect(() => CryptoRandomValuesService.randomHex(65544)).toThrow(expectedError);
|
|
42
|
+
expect(() => CryptoRandomValuesService.randomHex()).toThrow(expectedError);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
23
45
|
});
|
|
@@ -34,13 +34,17 @@ class GroupUpdateSecretsCryptoService {
|
|
|
34
34
|
* @returns {Promise<object>} Decrypted secrets organized as {[resourceId]: secretDecrypted, ...}
|
|
35
35
|
*/
|
|
36
36
|
static async decryptSecrets(privateKey, secretsCollection, onProgress) {
|
|
37
|
-
const result =
|
|
37
|
+
const result = {};
|
|
38
38
|
const collectionLength = secretsCollection.length;
|
|
39
39
|
|
|
40
40
|
for (let i = 0; i < collectionLength; i++) {
|
|
41
41
|
const secret = secretsCollection.items[i];
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
try {
|
|
43
|
+
const secretMessage = await OpenpgpAssertion.readMessageOrFail(secret.data);
|
|
44
|
+
result[secret.resourceId] = await DecryptMessageService.decrypt(secretMessage, privateKey);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new Error(`Unable to decrypt the secret of the resource (${secret.resourceId}).`, { cause: error });
|
|
47
|
+
}
|
|
44
48
|
|
|
45
49
|
await onProgress?.(i18n.t("Decrypting {{counter}}/{{total}}", { counter: i + 1, total: collectionLength }));
|
|
46
50
|
}
|
|
@@ -66,8 +70,26 @@ class GroupUpdateSecretsCryptoService {
|
|
|
66
70
|
const user_id = neededSecret.userId;
|
|
67
71
|
const resource_id = neededSecret.resourceId;
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
if (typeof decryptedSecrets[resource_id] === "undefined") {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`Unable to encrypt the secret of the resource (${resource_id}) for the user (${user_id}): no decrypted secret is available for this resource.`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (typeof usersPublicKeys[user_id] === "undefined") {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Unable to encrypt the secret of the resource (${resource_id}) for the user (${user_id}): no public key is available for this user.`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let data;
|
|
85
|
+
try {
|
|
86
|
+
const encryptionKey = await OpenpgpAssertion.readKeyOrFail(usersPublicKeys[user_id]);
|
|
87
|
+
data = await EncryptMessageService.encrypt(decryptedSecrets[resource_id], encryptionKey, [privateKey]);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
throw new Error(`Unable to encrypt the secret of the resource (${resource_id}) for the user (${user_id}).`, {
|
|
90
|
+
cause: error,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
71
93
|
|
|
72
94
|
const secret = new SecretEntity({ resource_id, user_id, data });
|
|
73
95
|
groupUpdateSecrets.push(secret);
|
|
@@ -41,6 +41,43 @@ describe("GroupUpdateSecretsCryptoService", () => {
|
|
|
41
41
|
expect(onProgress).toHaveBeenCalledTimes(1);
|
|
42
42
|
expect(onProgress).toHaveBeenCalledWith("Decrypting 1/1");
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
it("should throw an error identifying the resource when a secret cannot be decrypted", async () => {
|
|
46
|
+
expect.assertions(2);
|
|
47
|
+
|
|
48
|
+
const adaPublicKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.ada.public);
|
|
49
|
+
const secretsDtos = defaultResourcesSecretsDtos(1);
|
|
50
|
+
secretsDtos[0].data = await EncryptMessageService.encrypt(
|
|
51
|
+
JSON.stringify(plaintextSecretPasswordAndDescriptionDto()),
|
|
52
|
+
adaPublicKey,
|
|
53
|
+
);
|
|
54
|
+
const secrets = new GroupUpdateSecretsCollection(secretsDtos, { validate: false });
|
|
55
|
+
// Decrypt with a private key the secret was not encrypted for.
|
|
56
|
+
const wrongPrivateKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.betty.private_decrypted);
|
|
57
|
+
|
|
58
|
+
const promise = GroupUpdateSecretsCryptoService.decryptSecrets(wrongPrivateKey, secrets);
|
|
59
|
+
|
|
60
|
+
await expect(promise).rejects.toThrow(
|
|
61
|
+
`Unable to decrypt the secret of the resource (${secretsDtos[0].resource_id}).`,
|
|
62
|
+
);
|
|
63
|
+
await expect(promise).rejects.toHaveProperty("cause");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("should throw an error identifying the resource when a secret is not a valid openpgp message", async () => {
|
|
67
|
+
expect.assertions(2);
|
|
68
|
+
|
|
69
|
+
const secretsDtos = defaultResourcesSecretsDtos(1);
|
|
70
|
+
secretsDtos[0].data = "-----BEGIN PGP MESSAGE-----\n\nnot!valid!base64!!!\n-----END PGP MESSAGE-----";
|
|
71
|
+
const secrets = new GroupUpdateSecretsCollection(secretsDtos, { validate: false });
|
|
72
|
+
const privateKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.ada.private_decrypted);
|
|
73
|
+
|
|
74
|
+
const promise = GroupUpdateSecretsCryptoService.decryptSecrets(privateKey, secrets);
|
|
75
|
+
|
|
76
|
+
await expect(promise).rejects.toThrow(
|
|
77
|
+
`Unable to decrypt the secret of the resource (${secretsDtos[0].resource_id}).`,
|
|
78
|
+
);
|
|
79
|
+
await expect(promise).rejects.toHaveProperty("cause");
|
|
80
|
+
});
|
|
44
81
|
});
|
|
45
82
|
|
|
46
83
|
describe("::encryptSecrets", () => {
|
|
@@ -98,5 +135,68 @@ describe("GroupUpdateSecretsCryptoService", () => {
|
|
|
98
135
|
|
|
99
136
|
expect(result.items).toHaveLength(1);
|
|
100
137
|
});
|
|
138
|
+
|
|
139
|
+
it("should throw an error identifying the resource and user when no decrypted secret is available", async () => {
|
|
140
|
+
expect.assertions(1);
|
|
141
|
+
|
|
142
|
+
const userId = uuidv4();
|
|
143
|
+
const resourceId = uuidv4();
|
|
144
|
+
const decryptedSecrets = {}; // Missing the decrypted secret for the needed resource.
|
|
145
|
+
const neededSecrets = new NeededSecretsCollection([{ user_id: userId, resource_id: resourceId }], {
|
|
146
|
+
validate: false,
|
|
147
|
+
});
|
|
148
|
+
const usersPublicKeys = { [userId]: pgpKeys.betty.public };
|
|
149
|
+
const privateKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.ada.private_decrypted);
|
|
150
|
+
|
|
151
|
+
await expect(
|
|
152
|
+
GroupUpdateSecretsCryptoService.encryptSecrets(privateKey, usersPublicKeys, neededSecrets, decryptedSecrets),
|
|
153
|
+
).rejects.toThrow(
|
|
154
|
+
`Unable to encrypt the secret of the resource (${resourceId}) for the user (${userId}): no decrypted secret is available for this resource.`,
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("should throw an error identifying the resource and user when no public key is available", async () => {
|
|
159
|
+
expect.assertions(1);
|
|
160
|
+
|
|
161
|
+
const userId = uuidv4();
|
|
162
|
+
const resourceId = uuidv4();
|
|
163
|
+
const decryptedSecrets = { [resourceId]: JSON.stringify(plaintextSecretPasswordAndDescriptionDto()) };
|
|
164
|
+
const neededSecrets = new NeededSecretsCollection([{ user_id: userId, resource_id: resourceId }], {
|
|
165
|
+
validate: false,
|
|
166
|
+
});
|
|
167
|
+
const usersPublicKeys = {}; // Missing the public key for the needed user.
|
|
168
|
+
const privateKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.ada.private_decrypted);
|
|
169
|
+
|
|
170
|
+
await expect(
|
|
171
|
+
GroupUpdateSecretsCryptoService.encryptSecrets(privateKey, usersPublicKeys, neededSecrets, decryptedSecrets),
|
|
172
|
+
).rejects.toThrow(
|
|
173
|
+
`Unable to encrypt the secret of the resource (${resourceId}) for the user (${userId}): no public key is available for this user.`,
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("should throw an error identifying the resource and user when the recipient key is expired", async () => {
|
|
178
|
+
expect.assertions(2);
|
|
179
|
+
|
|
180
|
+
const userId = uuidv4();
|
|
181
|
+
const resourceId = uuidv4();
|
|
182
|
+
const decryptedSecrets = { [resourceId]: JSON.stringify(plaintextSecretPasswordAndDescriptionDto()) };
|
|
183
|
+
const neededSecrets = new NeededSecretsCollection([{ user_id: userId, resource_id: resourceId }], {
|
|
184
|
+
validate: false,
|
|
185
|
+
});
|
|
186
|
+
const usersPublicKeys = { [userId]: pgpKeys.expired.public };
|
|
187
|
+
const privateKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.ada.private_decrypted);
|
|
188
|
+
|
|
189
|
+
const promise = GroupUpdateSecretsCryptoService.encryptSecrets(
|
|
190
|
+
privateKey,
|
|
191
|
+
usersPublicKeys,
|
|
192
|
+
neededSecrets,
|
|
193
|
+
decryptedSecrets,
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
await expect(promise).rejects.toThrow(
|
|
197
|
+
`Unable to encrypt the secret of the resource (${resourceId}) for the user (${userId}).`,
|
|
198
|
+
);
|
|
199
|
+
await expect(promise).rejects.toHaveProperty("cause");
|
|
200
|
+
});
|
|
101
201
|
});
|
|
102
202
|
});
|
|
@@ -118,7 +118,7 @@ class GroupUpdateService {
|
|
|
118
118
|
* Encrypt a collection of needed secrets.
|
|
119
119
|
* @param {openpgp.PrivateKey} privateKey The logged in user private key
|
|
120
120
|
* @param {NeededSecretsCollection} neededSecretsCollection A collection of needed secret
|
|
121
|
-
* @param {
|
|
121
|
+
* @param {object} decryptedSecrets The decrypted secrets organized as {[resourceId]: secretDecrypted, ...}
|
|
122
122
|
* @returns {Promise<GroupUpdateSecretsCollection>}
|
|
123
123
|
* @private
|
|
124
124
|
*/
|
|
@@ -139,7 +139,7 @@ class GroupUpdateService {
|
|
|
139
139
|
* Decrypt a collection of secrets
|
|
140
140
|
* @param {openpgp.PrivateKey} privateKey The logged in user private key
|
|
141
141
|
* @param {GroupUpdateSecretsCollection} secretsCollection The collection of secrets to decrypt
|
|
142
|
-
* @returns {Promise<
|
|
142
|
+
* @returns {Promise<object>} The decrypted secrets organized as {[resourceId]: secretDecrypted, ...}
|
|
143
143
|
* @private
|
|
144
144
|
*/
|
|
145
145
|
async decryptSecrets(privateKey, secretsCollection) {
|
|
@@ -190,8 +190,12 @@ class GroupUpdateService {
|
|
|
190
190
|
await keyring.sync();
|
|
191
191
|
|
|
192
192
|
for (const userId of userIds) {
|
|
193
|
+
const publicKey = keyring.findPublic(userId);
|
|
194
|
+
if (!publicKey) {
|
|
195
|
+
throw new Error(`The public key of the user (${userId}) could not be found in the local keyring.`);
|
|
196
|
+
}
|
|
193
197
|
// Keep armored key to send it through a message for offscreen
|
|
194
|
-
userOpenpgpPublicKeys[userId] =
|
|
198
|
+
userOpenpgpPublicKeys[userId] = publicKey.armoredKey;
|
|
195
199
|
}
|
|
196
200
|
|
|
197
201
|
return userOpenpgpPublicKeys;
|
|
@@ -531,4 +531,43 @@ describe("GroupUpdateService", () => {
|
|
|
531
531
|
"The given parameter is not a valid string",
|
|
532
532
|
);
|
|
533
533
|
});
|
|
534
|
+
|
|
535
|
+
it("should throw an error identifying the user when their public key is missing from the keyring", async () => {
|
|
536
|
+
expect.assertions(1);
|
|
537
|
+
|
|
538
|
+
chrome.runtime.getManifest.mockImplementation(() => ({ manifest_version: 2 }));
|
|
539
|
+
|
|
540
|
+
const apiClientOptions = defaultApiClientOptions();
|
|
541
|
+
const account = new AccountEntity(defaultAccountDto());
|
|
542
|
+
const progressService = defaultProgressService({ goals: 10 });
|
|
543
|
+
|
|
544
|
+
const existingEntityDto = defaultGroupDto({}, { withGroupsUsers: 1 });
|
|
545
|
+
const updateGroupEntity = new GroupEntity({ ...existingEntityDto });
|
|
546
|
+
|
|
547
|
+
const newUser = new GroupUserEntity(createGroupUser({ group_id: existingEntityDto.id }));
|
|
548
|
+
updateGroupEntity._groups_users._items = [...updateGroupEntity._groups_users.items, newUser];
|
|
549
|
+
|
|
550
|
+
const secrets = defaultResourcesSecretsDtos(1);
|
|
551
|
+
const adaPublicKey = await OpenpgpAssertion.readKeyOrFail(pgpKeys.ada.public);
|
|
552
|
+
secrets[0].data = await EncryptMessageService.encrypt(
|
|
553
|
+
JSON.stringify(plaintextSecretPasswordAndDescriptionDto()),
|
|
554
|
+
adaPublicKey,
|
|
555
|
+
);
|
|
556
|
+
const needed_secrets = [{ user_id: newUser._props.user_id, resource_id: secrets[0].resource_id }];
|
|
557
|
+
const groupUpdateDryRunResultDto = { needed_secrets, secrets };
|
|
558
|
+
|
|
559
|
+
const service = new GroupUpdateService(apiClientOptions, account, progressService);
|
|
560
|
+
|
|
561
|
+
jest.spyOn(service.groupModel, "getById").mockImplementation(async () => new GroupEntity(existingEntityDto));
|
|
562
|
+
jest
|
|
563
|
+
.spyOn(service.groupModel, "updateDryRun")
|
|
564
|
+
.mockImplementation(async () => new GroupUpdateDryRunResultEntity(groupUpdateDryRunResultDto));
|
|
565
|
+
jest.spyOn(Keyring.prototype, "sync").mockImplementation(async () => {});
|
|
566
|
+
// The user's public key is absent from the local keyring.
|
|
567
|
+
jest.spyOn(Keyring.prototype, "findPublic").mockImplementation(() => undefined);
|
|
568
|
+
|
|
569
|
+
await expect(service.exec(updateGroupEntity, "ada@passbolt.com")).rejects.toThrow(
|
|
570
|
+
`The public key of the user (${newUser._props.user_id}) could not be found in the local keyring.`,
|
|
571
|
+
);
|
|
572
|
+
});
|
|
534
573
|
});
|
|
@@ -90,7 +90,10 @@ describe("DecryptSessionKeysBundlesService", () => {
|
|
|
90
90
|
//bypassing entity checks for the unit test
|
|
91
91
|
sessionKeysBundleEntity._props.data = "Test";
|
|
92
92
|
|
|
93
|
-
const expectedCauseError = new Error("The message should be a valid openpgp message."
|
|
93
|
+
const expectedCauseError = new Error("The message should be a valid openpgp message.", {
|
|
94
|
+
cause: new Error("Misformed armored text"),
|
|
95
|
+
});
|
|
96
|
+
|
|
94
97
|
const expectedError = new Error(
|
|
95
98
|
`Unable to decrypt the metadata session key bundle (${sessionKeysBundleEntity.id}) using the user key.`,
|
|
96
99
|
{ cause: expectedCauseError },
|
package/src/all/background_page/service/siteSettings/findAndUpdateSiteSettingsLocalStorageService.js
CHANGED
|
@@ -60,10 +60,16 @@ export default class FindAndUpdateSiteSettingsLocalStorageService {
|
|
|
60
60
|
|
|
61
61
|
// Authenticated sessions persist to SiteSettingsLocalStorage (the offline-mode store);
|
|
62
62
|
// Anonymous sessions only get the in-memory runtime cache below.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
try {
|
|
64
|
+
const activeSession = await this.checkAuthStatusService.checkAuthStatus();
|
|
65
|
+
if (activeSession.isAuthenticated) {
|
|
66
|
+
await this.siteSettingsLocalStorage.set(siteSettings);
|
|
67
|
+
}
|
|
68
|
+
} catch (error) {
|
|
69
|
+
// An error occured while checking the auth status
|
|
70
|
+
console.error(error);
|
|
66
71
|
}
|
|
72
|
+
|
|
67
73
|
/*
|
|
68
74
|
* PB-53134:
|
|
69
75
|
* Set a cache of site setting without account id as a key to get the cache in AppEmailValidatorService
|
|
@@ -20,6 +20,7 @@ import SiteSettingsLocalStorage from "../local_storage/siteSettingsLocalStorage"
|
|
|
20
20
|
import SiteSettingsRuntimeCache from "./siteSettingsRuntimeCache";
|
|
21
21
|
import FindAndUpdateSiteSettingsLocalStorageService from "./findAndUpdateSiteSettingsLocalStorageService";
|
|
22
22
|
import OnlineSessionEntity from "passbolt-styleguide/src/shared/models/entity/session/onlineSessionEntity";
|
|
23
|
+
import PassboltBadResponseError from "../../error/passboltBadResponseError";
|
|
23
24
|
|
|
24
25
|
const readBrowserStorage = async (storageKey) => {
|
|
25
26
|
const data = await browser.storage.local.get([storageKey]);
|
|
@@ -87,6 +88,23 @@ describe("FindAndUpdateSiteSettingsLocalStorageService", () => {
|
|
|
87
88
|
expect(await readBrowserStorage(service.siteSettingsLocalStorage.storageKey)).toBeUndefined();
|
|
88
89
|
expect(SiteSettingsLocalStorage._runtimeCachedData[account.id]).toBeUndefined();
|
|
89
90
|
});
|
|
91
|
+
|
|
92
|
+
it("should handle API errors as if the user is not authenticated", async () => {
|
|
93
|
+
expect.assertions(4);
|
|
94
|
+
|
|
95
|
+
const dto = defaultProSiteSettings();
|
|
96
|
+
|
|
97
|
+
// An API error occured
|
|
98
|
+
jest.spyOn(service.checkAuthStatusService, "checkAuthStatus").mockRejectedValue(new PassboltBadResponseError());
|
|
99
|
+
jest.spyOn(service.findSiteSettingsService, "findSiteSettings").mockResolvedValue(new SiteSettingsEntity(dto));
|
|
100
|
+
|
|
101
|
+
const result = await service.findAndUpdateAll();
|
|
102
|
+
|
|
103
|
+
expect(result.toDto()).toEqual(dto);
|
|
104
|
+
expect(SiteSettingsRuntimeCache.get()).toEqual(dto);
|
|
105
|
+
expect(await readBrowserStorage(service.siteSettingsLocalStorage.storageKey)).toBeUndefined();
|
|
106
|
+
expect(SiteSettingsLocalStorage._runtimeCachedData[account.id]).toBeUndefined();
|
|
107
|
+
});
|
|
90
108
|
});
|
|
91
109
|
|
|
92
110
|
describe("::findAndUpdateAll — concurrency", () => {
|
|
@@ -54,9 +54,17 @@ export default class GetOrFindSiteSettingsService {
|
|
|
54
54
|
*/
|
|
55
55
|
async getOrFind(refreshCache = true) {
|
|
56
56
|
if (!refreshCache) {
|
|
57
|
-
|
|
57
|
+
let isAuthenticated = false;
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
try {
|
|
60
|
+
const activeSession = await this.checkAuthStatusService.checkAuthStatus();
|
|
61
|
+
isAuthenticated = activeSession.isAuthenticated;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
// An error occured while checking the auth status
|
|
64
|
+
console.error(error);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (isAuthenticated) {
|
|
60
68
|
const lsDto = await this.siteSettingsLocalStorage.get();
|
|
61
69
|
if (lsDto) {
|
|
62
70
|
const siteSettings = new SiteSettingsEntity(lsDto);
|
|
@@ -21,6 +21,7 @@ import SiteSettingsRuntimeCache from "./siteSettingsRuntimeCache";
|
|
|
21
21
|
import GetOrFindSiteSettingsService from "./getOrFindSiteSettingsService";
|
|
22
22
|
import OnlineSessionEntity from "passbolt-styleguide/src/shared/models/entity/session/onlineSessionEntity";
|
|
23
23
|
import CheckAuthStatusService from "../auth/checkAuthStatusService";
|
|
24
|
+
import PassboltBadResponseError from "../../error/passboltBadResponseError";
|
|
24
25
|
|
|
25
26
|
beforeEach(() => {
|
|
26
27
|
jest.clearAllMocks();
|
|
@@ -172,4 +173,45 @@ describe("GetOrFindSiteSettingsService", () => {
|
|
|
172
173
|
expect(result.toDto()).toEqual(dto);
|
|
173
174
|
});
|
|
174
175
|
});
|
|
176
|
+
|
|
177
|
+
describe("::getOrFind (refreshCache=false) — authentication status unavailable", () => {
|
|
178
|
+
beforeEach(() => {
|
|
179
|
+
// An API error occured
|
|
180
|
+
jest.spyOn(CheckAuthStatusService.prototype, "checkAuthStatus").mockRejectedValue(new PassboltBadResponseError());
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("should return the runtime cache when populated when there is an API error", async () => {
|
|
184
|
+
expect.assertions(3);
|
|
185
|
+
|
|
186
|
+
const dto = defaultProSiteSettings();
|
|
187
|
+
SiteSettingsRuntimeCache.set(new SiteSettingsEntity(dto));
|
|
188
|
+
|
|
189
|
+
const localStorageSpy = jest.spyOn(service.siteSettingsLocalStorage, "get");
|
|
190
|
+
const apiSpy = jest.spyOn(
|
|
191
|
+
service.findAndUpdateSiteSettingsLocalStorageService.findSiteSettingsService,
|
|
192
|
+
"findSiteSettings",
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const result = await service.getOrFind(false);
|
|
196
|
+
|
|
197
|
+
expect(result.toDto()).toEqual(dto);
|
|
198
|
+
expect(localStorageSpy).not.toHaveBeenCalled();
|
|
199
|
+
expect(apiSpy).not.toHaveBeenCalled();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("should call the API when cache is empty when there is an API error", async () => {
|
|
203
|
+
expect.assertions(2);
|
|
204
|
+
|
|
205
|
+
const dto = defaultProSiteSettings();
|
|
206
|
+
|
|
207
|
+
const apiSpy = jest
|
|
208
|
+
.spyOn(service.findAndUpdateSiteSettingsLocalStorageService.findSiteSettingsService, "findSiteSettings")
|
|
209
|
+
.mockResolvedValue(new SiteSettingsEntity(dto));
|
|
210
|
+
|
|
211
|
+
const result = await service.getOrFind(false);
|
|
212
|
+
|
|
213
|
+
expect(apiSpy).toHaveBeenCalledTimes(1);
|
|
214
|
+
expect(result.toDto()).toEqual(dto);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
175
217
|
});
|
|
@@ -37,7 +37,7 @@ const readKeyOrFail = async (armoredKey) => {
|
|
|
37
37
|
return await openpgp.readKey({ armoredKey: armoredKey });
|
|
38
38
|
} catch (error) {
|
|
39
39
|
console.error(error);
|
|
40
|
-
throw new Error(i18n.t("The key should be a valid openpgp armored key string."));
|
|
40
|
+
throw new Error(i18n.t("The key should be a valid openpgp armored key string."), { cause: error });
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -121,7 +121,7 @@ const readMessageOrFail = async (message) => {
|
|
|
121
121
|
return await openpgp.readMessage({ armoredMessage: message });
|
|
122
122
|
} catch (error) {
|
|
123
123
|
console.error(error);
|
|
124
|
-
throw new Error(i18n.t("The message should be a valid openpgp message."));
|
|
124
|
+
throw new Error(i18n.t("The message should be a valid openpgp message."), { cause: error });
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
|
package/src/chrome/manifest.json
CHANGED
|
@@ -104,10 +104,19 @@ export default class AddUsersToGroupOffscreenService {
|
|
|
104
104
|
*/
|
|
105
105
|
static handleErrorResponse(error) {
|
|
106
106
|
console.error(error);
|
|
107
|
+
// Serialize the full error (including its cause chain) so the underlying openpgp reason is not
|
|
108
|
+
// lost when crossing the offscreen boundary. getOwnPropertyNames captures message/stack/cause.
|
|
109
|
+
let serializedError;
|
|
110
|
+
try {
|
|
111
|
+
serializedError = JSON.stringify(error, Object.getOwnPropertyNames(error));
|
|
112
|
+
} catch {
|
|
113
|
+
serializedError = undefined;
|
|
114
|
+
}
|
|
107
115
|
return {
|
|
108
116
|
data: {
|
|
109
117
|
name: error?.name,
|
|
110
118
|
message: error?.message || "AddUsersToGroupOffscreenService: an unexpected error occurred",
|
|
119
|
+
error: serializedError,
|
|
111
120
|
},
|
|
112
121
|
type: ADD_USERS_TO_GROUP_OFFSCREEN_RESPONSE_TYPE_ERROR,
|
|
113
122
|
target: SEND_MESSAGE_TARGET_ADD_USERS_TO_GROUP_OFFSCREEN_RESPONSE_HANDLER,
|
|
@@ -103,6 +103,44 @@ describe("AddUsersToGroupOffscreenService", () => {
|
|
|
103
103
|
|
|
104
104
|
expect(result).toStrictEqual(expectedResult);
|
|
105
105
|
});
|
|
106
|
+
|
|
107
|
+
it("should carry the contextual message and the serialized cause when a secret cannot be decrypted", async () => {
|
|
108
|
+
expect.assertions(4);
|
|
109
|
+
|
|
110
|
+
const account = new AccountEntity(defaultAccountDto());
|
|
111
|
+
|
|
112
|
+
const existingEntityDto = defaultGroupDto({}, { withGroupsUsers: 1 });
|
|
113
|
+
const updateGroupEntity = new GroupEntity({ ...existingEntityDto });
|
|
114
|
+
|
|
115
|
+
const newUser = new GroupUserEntity(createGroupUser({ group_id: existingEntityDto.id }));
|
|
116
|
+
updateGroupEntity._groups_users._items = [...updateGroupEntity._groups_users.items, newUser];
|
|
117
|
+
|
|
118
|
+
const secrets = defaultResourcesSecretsDtos(1);
|
|
119
|
+
// A secret that keeps the armor delimiters but has a corrupted body: fails inside the decrypt loop.
|
|
120
|
+
secrets[0].data = "-----BEGIN PGP MESSAGE-----\n\nnot!valid!base64!!!\n-----END PGP MESSAGE-----";
|
|
121
|
+
const needed_secrets = [{ user_id: newUser._props.user_id, resource_id: secrets[0].resource_id }];
|
|
122
|
+
const groupUpdateDryRunEntity = new GroupUpdateDryRunResultEntity({ needed_secrets, secrets });
|
|
123
|
+
|
|
124
|
+
const result = await AddUsersToGroupOffscreenService.handleRequest({
|
|
125
|
+
requestId: "11111111-1111-4111-8111-111111111111",
|
|
126
|
+
addUsersToGroupContent: {
|
|
127
|
+
privateKey: {
|
|
128
|
+
armoredKey: account.userPrivateArmoredKey,
|
|
129
|
+
passphrase: "ada@passbolt.com",
|
|
130
|
+
},
|
|
131
|
+
secrets: groupUpdateDryRunEntity.secrets.toDto(),
|
|
132
|
+
neededSecrets: groupUpdateDryRunEntity.neededSecrets.toDto(),
|
|
133
|
+
usersPublicKeys: { [newUser._props.user_id]: pgpKeys.betty.public },
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
expect(result.type).toEqual(ADD_USERS_TO_GROUP_OFFSCREEN_RESPONSE_TYPE_ERROR);
|
|
138
|
+
expect(result.data.message).toEqual(`Unable to decrypt the secret of the resource (${secrets[0].resource_id}).`);
|
|
139
|
+
// The serialized error preserves the underlying openpgp reason as its cause.
|
|
140
|
+
const serialized = JSON.parse(result.data.error);
|
|
141
|
+
expect(serialized.message).toEqual(`Unable to decrypt the secret of the resource (${secrets[0].resource_id}).`);
|
|
142
|
+
expect(serialized.cause).toBeDefined();
|
|
143
|
+
});
|
|
106
144
|
});
|
|
107
145
|
|
|
108
146
|
describe("::handleProgressResponse", () => {
|
|
@@ -49,10 +49,42 @@ export default class ResponseAddUsersToGroupOffscreenService {
|
|
|
49
49
|
if (type === ADD_USERS_TO_GROUP_OFFSCREEN_RESPONSE_TYPE_SUCCESS) {
|
|
50
50
|
callbacks.resolve(data);
|
|
51
51
|
} else {
|
|
52
|
-
callbacks.reject(
|
|
52
|
+
callbacks.reject(ResponseAddUsersToGroupOffscreenService.rebuildError(data));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Rebuild the error thrown in the offscreen document from its serialized form.
|
|
58
|
+
* The contextual message (carrying the resource/user ids) is always restored; the original name and
|
|
59
|
+
* the underlying cause (e.g. the openpgp reason) are restored when the serialized error is present.
|
|
60
|
+
* @param {{name: string, message: string, error: string}} data The error response data.
|
|
61
|
+
* @returns {Error}
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
static rebuildError(data) {
|
|
65
|
+
const error = new Error(data.message);
|
|
66
|
+
if (data.name) {
|
|
67
|
+
error.name = data.name;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (data.error) {
|
|
71
|
+
try {
|
|
72
|
+
const serialized = JSON.parse(data.error);
|
|
73
|
+
if (serialized?.cause) {
|
|
74
|
+
error.cause = new Error(serialized.cause.message);
|
|
75
|
+
if (serialized.cause.name) {
|
|
76
|
+
error.cause.name = serialized.cause.name;
|
|
77
|
+
}
|
|
78
|
+
error.cause.stack = serialized.cause.stack;
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
// Ignore a malformed serialized error and keep the message-only error.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return error;
|
|
86
|
+
}
|
|
87
|
+
|
|
56
88
|
/**
|
|
57
89
|
* Handle progress message offscreen response.
|
|
58
90
|
* @param {object} message.
|
|
@@ -47,6 +47,53 @@ describe("ResponseAddUsersToGroupOffscreenService", () => {
|
|
|
47
47
|
expect(callbacks.reject).toHaveBeenCalledTimes(1);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
it("should rebuild the error preserving the contextual message, the name and the underlying cause", () => {
|
|
51
|
+
expect.assertions(4);
|
|
52
|
+
|
|
53
|
+
const id = crypto.randomUUID();
|
|
54
|
+
const callbacks = defaultCallbacks();
|
|
55
|
+
|
|
56
|
+
const cause = new Error("Error decrypting message: No decryption key packets found");
|
|
57
|
+
const original = new Error("Unable to decrypt the secret of the resource (resource-id).", { cause });
|
|
58
|
+
original.name = "GroupUpdateError";
|
|
59
|
+
const message = errorAddUsersToGroupResponseMessage({
|
|
60
|
+
id,
|
|
61
|
+
data: {
|
|
62
|
+
name: original.name,
|
|
63
|
+
message: original.message,
|
|
64
|
+
error: JSON.stringify(original, Object.getOwnPropertyNames(original)),
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
ResponseAddUsersToGroupOffscreenService.handleAddUsersToGroupResponse(message, callbacks);
|
|
69
|
+
|
|
70
|
+
const rebuiltError = callbacks.reject.mock.calls[0][0];
|
|
71
|
+
expect(rebuiltError.message).toEqual("Unable to decrypt the secret of the resource (resource-id).");
|
|
72
|
+
expect(rebuiltError.name).toEqual("GroupUpdateError");
|
|
73
|
+
expect(rebuiltError.cause).toBeInstanceOf(Error);
|
|
74
|
+
expect(rebuiltError.cause.message).toEqual("Error decrypting message: No decryption key packets found");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("should rebuild a message-only error when no serialized error is provided", () => {
|
|
78
|
+
expect.assertions(2);
|
|
79
|
+
|
|
80
|
+
const id = crypto.randomUUID();
|
|
81
|
+
const callbacks = defaultCallbacks();
|
|
82
|
+
|
|
83
|
+
const message = errorAddUsersToGroupResponseMessage({
|
|
84
|
+
id,
|
|
85
|
+
data: { message: "Unable to encrypt the secret of the resource (resource-id) for the user (user-id)." },
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
ResponseAddUsersToGroupOffscreenService.handleAddUsersToGroupResponse(message, callbacks);
|
|
89
|
+
|
|
90
|
+
const rebuiltError = callbacks.reject.mock.calls[0][0];
|
|
91
|
+
expect(rebuiltError.message).toEqual(
|
|
92
|
+
"Unable to encrypt the secret of the resource (resource-id) for the user (user-id).",
|
|
93
|
+
);
|
|
94
|
+
expect(rebuiltError.cause).toBeUndefined();
|
|
95
|
+
});
|
|
96
|
+
|
|
50
97
|
it("should clear the request progress service once the response is handled", () => {
|
|
51
98
|
expect.assertions(1);
|
|
52
99
|
|
package/src/safari/manifest.json
CHANGED
|
@@ -14,27 +14,26 @@
|
|
|
14
14
|
const path = require("path");
|
|
15
15
|
const webpack = require("webpack");
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Defaults applied when the corresponding process.env entry is unset. They mirror
|
|
20
|
-
// the legacy config.json.debug values so `NODE_ENV=development` builds get the
|
|
21
|
-
// dev-friendly configuration without any host configuration.
|
|
17
|
+
// Defaults applied when the corresponding process.env entry is unset.
|
|
18
|
+
// We use 'no debug' values by default and only enable them when we are in development mode.
|
|
22
19
|
const DEBUG_DEFAULTS = {
|
|
23
|
-
PASSBOLT_DEBUG: "
|
|
24
|
-
PASSBOLT_LOG_LEVEL: "
|
|
25
|
-
PASSBOLT_LOG_CONSOLE: "
|
|
20
|
+
PASSBOLT_DEBUG: "false",
|
|
21
|
+
PASSBOLT_LOG_LEVEL: "0",
|
|
22
|
+
PASSBOLT_LOG_CONSOLE: "false",
|
|
26
23
|
};
|
|
27
24
|
|
|
25
|
+
const PASSBOLT_ENV_KEYS = Object.keys(DEBUG_DEFAULTS);
|
|
26
|
+
|
|
28
27
|
module.exports = function buildPassboltEnvPlugin() {
|
|
29
28
|
const isDevelopment = process.env.NODE_ENV === "development";
|
|
30
29
|
|
|
31
30
|
if (isDevelopment) {
|
|
31
|
+
require("dotenv").config({ path: path.resolve(__dirname, "..", ".env") });
|
|
32
|
+
} else {
|
|
32
33
|
// Strip any inherited shell value so EnvironmentPlugin falls back to defaults.
|
|
33
34
|
for (const key of PASSBOLT_ENV_KEYS) {
|
|
34
35
|
delete process.env[key];
|
|
35
36
|
}
|
|
36
|
-
} else {
|
|
37
|
-
require("dotenv").config({ path: path.resolve(__dirname, "..", ".env") });
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
return new webpack.EnvironmentPlugin(DEBUG_DEFAULTS);
|