passbolt-browser-extension 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/Gruntfile.js +1 -1
- package/RELEASE_NOTES.md +29 -48
- package/package.json +5 -5
- package/src/all/background_page/controller/clipboard/cancelClipboardContentFlushController.js +51 -0
- package/src/all/background_page/controller/clipboard/cancelClipboardContentFlushController.test.js +46 -0
- package/src/all/background_page/controller/clipboard/copyTemporarilyToClipboardController.js +53 -0
- package/src/all/background_page/controller/clipboard/copyTemporarilyToClipboardController.test.js +47 -0
- package/src/all/background_page/controller/clipboard/{clipboardController.js → copyToClipboardController.js} +8 -8
- package/src/all/background_page/controller/clipboard/copyToClipboardController.test.js +47 -0
- package/src/all/background_page/controller/extension/getExtensionVersionController.test.js +1 -1
- package/src/all/background_page/controller/metadata/getOrFindMetadataKeysSettingsController.js +53 -0
- package/src/all/background_page/controller/metadata/getOrFindMetadataKeysSettingsController.test.js +106 -0
- package/src/all/background_page/controller/user/deleteDryRunUserController.js +73 -0
- package/src/all/background_page/controller/user/deleteDryRunUserController.test.js +129 -0
- package/src/all/background_page/controller/user/deleteUserController.js +76 -0
- package/src/all/background_page/controller/user/deleteUserController.test.js +141 -0
- package/src/all/background_page/event/actionLogEvents.js +5 -12
- package/src/all/background_page/event/appEvents.js +33 -0
- package/src/all/background_page/event/findAllForActionLogController.js +58 -0
- package/src/all/background_page/event/findAllForActionLogController.test.js +43 -0
- package/src/all/background_page/event/quickAccessEvents.js +32 -0
- package/src/all/background_page/event/userEvents.js +7 -20
- package/src/all/background_page/event/webIntegrationEvents.js +11 -0
- package/src/all/background_page/model/actionLog/{actionLogModel.js → findActionLogService.js} +25 -5
- package/src/all/background_page/model/actionLog/findActionLogService.test.js +61 -0
- package/src/all/background_page/model/comment/commentModel.js +5 -5
- package/src/all/background_page/model/entity/actionLog/actionLogsCollection.test.data.js +18 -0
- package/src/all/background_page/model/entity/actionLog/defaultActionLogEntity.test.data.js +34 -0
- package/src/all/background_page/model/import/resources/resourcesKdbxImportParser.test.js +0 -1
- package/src/all/background_page/model/user/userModel.js +0 -60
- package/src/all/background_page/pagemod/appPagemod.js +0 -2
- package/src/all/background_page/pagemod/appPagemod.test.js +2 -6
- package/src/all/background_page/service/alarm/globalAlarmService.js +2 -0
- package/src/all/background_page/service/api/actionLog/{actionLogService.js → actionLogApiService.js} +5 -4
- package/src/all/background_page/service/api/actionLog/actionLogApiService.test.js +55 -0
- package/src/all/background_page/service/api/comment/{commentService.js → commentApiService.js} +6 -7
- package/src/all/background_page/service/api/comment/commentApiService.test.js +122 -0
- package/src/all/background_page/service/auth/postLogoutService.js +2 -0
- package/src/all/background_page/service/auth/postLogoutService.test.js +4 -1
- package/src/all/background_page/service/browser/browserService.js +22 -0
- package/src/all/background_page/service/clipboard/clipboardProviderService.js +40 -0
- package/src/all/background_page/service/clipboard/clipboardProviderService.test.js +61 -0
- package/src/all/background_page/service/clipboard/copyToClipboardService.js +123 -0
- package/src/all/background_page/service/clipboard/copyToClipboardService.test.js +174 -0
- package/src/all/background_page/service/user/deleteUserService.js +97 -0
- package/src/all/background_page/service/user/deleteUserService.test.js +178 -0
- package/src/chrome/manifest.json +1 -1
- package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.js +31 -0
- package/src/chrome/polyfill/clipboard/edgeBackgroundPageClipboardService.test.js +51 -0
- package/src/chrome-mv3/index.js +3 -3
- package/src/chrome-mv3/manifest.json +1 -1
- package/src/chrome-mv3/offscreens/{fetch.html → offscreen.html} +1 -1
- package/src/chrome-mv3/offscreens/{fetch.js → offscreen.js} +2 -2
- package/src/chrome-mv3/offscreens/service/clipboard/writeClipobardOffscreenService.js +54 -0
- package/src/chrome-mv3/offscreens/service/clipboard/writeClipobardOffscreenService.test.js +56 -0
- package/src/chrome-mv3/offscreens/service/network/fetchOffscreenService.js +36 -44
- package/src/chrome-mv3/offscreens/service/network/fetchOffscreenService.test.data.js +0 -1
- package/src/chrome-mv3/offscreens/service/network/fetchOffscreenService.test.js +90 -120
- package/src/chrome-mv3/offscreens/service/offscreen/handleOffscreenRequestService.js +85 -0
- package/src/chrome-mv3/offscreens/service/offscreen/handleOffscreenRequestService.test.js +99 -0
- package/src/chrome-mv3/polyfill/clipboardOffscreenPolyfill.js +19 -0
- package/src/chrome-mv3/serviceWorker/service/clipboard/requestClipboardOffscreenService.js +51 -0
- package/src/chrome-mv3/serviceWorker/service/clipboard/requestClipboardOffscreenService.test.js +70 -0
- package/src/chrome-mv3/serviceWorker/service/clipboard/responseClipboardOffscreenService.js +25 -0
- package/src/chrome-mv3/serviceWorker/service/clipboard/responseClipboardOffscreenService.test.data.js +21 -0
- package/src/chrome-mv3/serviceWorker/service/clipboard/responseClipboardOffscreenService.test.js +33 -0
- package/src/chrome-mv3/serviceWorker/service/network/requestFetchOffscreenService.js +25 -50
- package/src/chrome-mv3/serviceWorker/service/network/requestFetchOffscreenService.test.js +16 -39
- package/src/chrome-mv3/serviceWorker/service/network/responseFetchOffscreenService.js +14 -45
- package/src/chrome-mv3/serviceWorker/service/network/responseFetchOffscreenService.test.js +5 -37
- package/src/chrome-mv3/serviceWorker/service/offscreen/createOffscreenDocumentService.js +43 -0
- package/src/chrome-mv3/serviceWorker/service/offscreen/createOffscreenDocumentService.test.js +48 -0
- package/src/chrome-mv3/serviceWorker/service/offscreen/handleOffscreenResponseService.js +119 -0
- package/src/chrome-mv3/serviceWorker/service/offscreen/handleOffscreenResponseService.test.js +159 -0
- package/src/firefox/manifest.json +1 -1
- package/src/safari/manifest.json +1 -1
- package/test/jest.setup.js +4 -0
- package/test/mocks/mockNavigatorClipboard.js +40 -0
- package/test/mocks/mockWebExtensionPolyfill.js +2 -1
- package/{webpack-offscreens.fetch.config.js → webpack-offscreens.config.js} +1 -1
- package/webpack.service-worker.config.js +1 -0
- package/src/all/background_page/controller/clipboard/clipboardController.test.js +0 -68
- package/src/all/background_page/event/clipboardEvents.js +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [5.3.2] - 2025-07-17
|
|
8
|
+
### Added
|
|
9
|
+
- PB-25265 Flush clipboard strategy
|
|
10
|
+
- PB-43095 Display the metadata issue in the HealthCheck served by the UI
|
|
11
|
+
- PB-43403 Search resources should take into account available custom fields information in the web application
|
|
12
|
+
|
|
13
|
+
### Improved
|
|
14
|
+
- PB-43474 As LU I should be able to clear the search field with a button
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- PB-43916 Fix hitting the key enter on the search fields
|
|
18
|
+
- PB-43996 Users should access encrypted metadata section of the administration guide on the help site when clicking on the documentation CTA from the sidebar
|
|
19
|
+
|
|
20
|
+
### Maintenance
|
|
21
|
+
- PB-43491 The resource activities should use a service worker service to request the service worker
|
|
22
|
+
- PB-43496 The user should be notified if an error occurs while displaying additional resource activities
|
|
23
|
+
- PB-43501 Cover ActionLogService API service and rename class as per naming convention
|
|
24
|
+
- PB-43502 Move logic of ActionLogModel into FindActionLogService
|
|
25
|
+
- PB-43506 Move logic of event passbolt.actionlogs.find-all-for into its dedicated Controller
|
|
26
|
+
- PB-43738 Create DeleteUserService to call the userService deleteDryRun
|
|
27
|
+
- PB-43739 Create DeleteDryRunUserController to call the DeleteUserService
|
|
28
|
+
- PB-43750 An unexpected error should be displayed on delete user
|
|
29
|
+
- PB-43904 Add a service to request or send data CommentsServiceWorkerService
|
|
30
|
+
- PB-43907 Add tests for commentService API service and rename the service class as per naming convention
|
|
31
|
+
- PB-43938 Create a GetOrFindMetadataKeysSettingsController to retrieve the metadata keys settings
|
|
32
|
+
- PB-43940 Create a MetadataKeysSettingsLocalStorageContextProvider to retrieve the metadata keys settings
|
|
33
|
+
|
|
7
34
|
## [5.3.0] - 2025-06-09
|
|
8
35
|
|
|
9
36
|
### Added
|
|
@@ -2278,7 +2305,9 @@ self registration settings option in the left-side bar
|
|
|
2278
2305
|
- AP: User with plugin installed
|
|
2279
2306
|
- LU: Logged in user
|
|
2280
2307
|
|
|
2281
|
-
[Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.2
|
|
2308
|
+
[Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.3.2...HEAD
|
|
2309
|
+
[5.3.2]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.3.0...v5.3.2
|
|
2310
|
+
[5.3.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.2.0...v5.3.0
|
|
2282
2311
|
[5.2.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.1.1...v5.2.0
|
|
2283
2312
|
[5.1.1]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.1.0...v5.1.1
|
|
2284
2313
|
[5.1.0]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.0.1...v5.1.0
|
package/Gruntfile.js
CHANGED
|
@@ -119,7 +119,7 @@ module.exports = function (grunt) {
|
|
|
119
119
|
service_worker: {
|
|
120
120
|
files: [
|
|
121
121
|
{ expand: true, cwd: path.src_chrome_mv3, src: 'serviceWorker.js', dest: path.build + 'serviceWorker' },
|
|
122
|
-
{ expand: true, cwd: `${path.src_chrome_mv3}/offscreens`, src: '
|
|
122
|
+
{ expand: true, cwd: `${path.src_chrome_mv3}/offscreens`, src: 'offscreen.html', dest: `${path.build}/offscreens` },
|
|
123
123
|
]
|
|
124
124
|
},
|
|
125
125
|
web_accessible_resources: {
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,56 +1,37 @@
|
|
|
1
|
-
Release song: https://www.youtube.com/watch?v
|
|
1
|
+
Release song: https://www.youtube.com/watch?v=-GxmblM_jss
|
|
2
2
|
|
|
3
|
-
Passbolt
|
|
3
|
+
Passbolt v5.3.2 is a security release designed to strengthen the security posture of your organization. It introduces a clipboard flushing feature, adds safeguards around SSO settings, and addresses issues related to encrypted metadata.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The new clipboard flush timer lets you copy secrets just long enough to use them; clipboard data is automatically cleared when the countdown (30s) expires, significantly reducing the risk of accidental exposure or leaks from forgotten clipboard content.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Additionally, SSO admin-settings edit endpoints of self-hosted instances can now be locked, reducing potential exposure to scans if an administrator account is compromised. You can verify if this protection is active, and get instructions on how to set it up, by running the health check via the server command line.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This update also resolves several encrypted metadata issues, moving the feature closer to general availability. Organizations can now enable encrypted metadata even if users have imported their own more complex keys (e.g. keys that were set to expire at some point), streamlining adoption for advanced users. Admin changes are smoother too: if the original metadata-enabling administrator leaves, newly invited users will still receive the metadata key automatically, removing the need for manual distribution. Lastly, users who owned shared resources using the new encrypted metadata format can now be deleted without issue, as ownership transfer is now handled correctly during the deletion process.
|
|
10
|
+
|
|
11
|
+
A big thank you to all testers who helped refine these features. If you’re new to any of them, we welcome your feedback on the community forum or through your usual support channels!
|
|
10
12
|
|
|
11
13
|
### Added
|
|
12
|
-
- PB-
|
|
13
|
-
- PB-
|
|
14
|
-
- PB-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- PB-
|
|
18
|
-
- PB-43279 Update the Secret Entities
|
|
19
|
-
- PB-43283 Display a new entry the create/edit dialog to set custom fields on the left sidebar and the menu
|
|
20
|
-
- PB-43284 Create the CustomFieldForm for the create/edit dialog
|
|
21
|
-
- PB-43285 Handle the CustomFieldForm warnings and limitation
|
|
22
|
-
- PB-43286 Update create/edit resource to select secret custom fields for a standalone custom fields
|
|
23
|
-
- PB-43287 Display the Custom Fields section on the right sidebar
|
|
24
|
-
- PB-43289 Display standalone custom fields in the component DisplayResourceCreationMenu
|
|
25
|
-
- PB-43290 Display standalone custom fields in the component DisplayResourcesWorkspaceMainMenu
|
|
26
|
-
- PB-43291 Display the URIs section in the right sidebar
|
|
27
|
-
- PB-43374 Add validation on keys and values of each elements of custom fields for the resource form entity
|
|
28
|
-
- PB-43377 Add set collection into entity v2
|
|
29
|
-
- PB-43145 Find a list of resources based on IDs and that are suitable for local storage from the API
|
|
30
|
-
- PB-43146 Find a list of resources based on a parent folder id and that are suitable for the local storage from the API
|
|
31
|
-
- PB-43133 Display padding below tags in resource workspace left sidebar
|
|
32
|
-
- PB-42185 The folder caret that expands or collapses folders in the tree should have a larger clickable area to make it easier to use
|
|
33
|
-
- PB-43222 Improve the group dialog to match the new share dimensions
|
|
34
|
-
- PB-43147 Find and update resources based on parent folder id for the local storage
|
|
35
|
-
- PB-43148 Create a connector for finding resources based on a parent id for the styleguide to call it later
|
|
36
|
-
- PB-43149 Create a ResourcesServiceWorkerService to call the service worker for resource related operations
|
|
37
|
-
- PB-43150 Implement the optimised call in the Styleguide when filtering by a folder
|
|
38
|
-
- PB-43151 Optimise the data retrieved from the API such that updates are not done if unnecessary
|
|
39
|
-
- PB-43156 Clarify implications for backups and other devices before changing the passphrase in the user settings workspace
|
|
40
|
-
- PB-43489 Display unexpected error if there is any issue during the secret decryption
|
|
14
|
+
- PB-25265 Flush clipboard strategy
|
|
15
|
+
- PB-43095 Display the metadata issue in the HealthCheck served by the UI
|
|
16
|
+
- PB-43403 Search resources should take into account available custom fields information in the web application
|
|
17
|
+
|
|
18
|
+
### Improved
|
|
19
|
+
- PB-43474 As LU I should be able to clear the search field with a button
|
|
41
20
|
|
|
42
21
|
### Fixed
|
|
43
|
-
- PB-
|
|
44
|
-
- PB-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- PB-
|
|
48
|
-
- PB-
|
|
49
|
-
- PB-
|
|
50
|
-
- PB-
|
|
51
|
-
- PB-
|
|
52
|
-
- PB-
|
|
53
|
-
- PB-
|
|
54
|
-
- PB-
|
|
55
|
-
- PB-
|
|
56
|
-
- PB-
|
|
22
|
+
- PB-43916 Fix hitting the key enter on the search fields
|
|
23
|
+
- PB-43996 Users should access encrypted metadata section of the administration guide on the help site when clicking on the documentation CTA from the sidebar
|
|
24
|
+
|
|
25
|
+
### Maintenance
|
|
26
|
+
- PB-43491 The resource activities should use a service worker service to request the service worker
|
|
27
|
+
- PB-43496 The user should be notified if an error occurs while displaying additional resource activities
|
|
28
|
+
- PB-43501 Cover ActionLogService API service and rename class as per naming convention
|
|
29
|
+
- PB-43502 Move logic of ActionLogModel into FindActionLogService
|
|
30
|
+
- PB-43506 Move logic of event passbolt.actionlogs.find-all-for into its dedicated Controller
|
|
31
|
+
- PB-43738 Create DeleteUserService to call the userService deleteDryRun
|
|
32
|
+
- PB-43739 Create DeleteDryRunUserController to call the DeleteUserService
|
|
33
|
+
- PB-43750 An unexpected error should be displayed on delete user
|
|
34
|
+
- PB-43904 Add a service to request or send data CommentsServiceWorkerService
|
|
35
|
+
- PB-43907 Add tests for commentService API service and rename the service class as per naming convention
|
|
36
|
+
- PB-43938 Create a GetOrFindMetadataKeysSettingsController to retrieve the metadata keys settings
|
|
37
|
+
- PB-43940 Create a MetadataKeysSettingsLocalStorageContextProvider to retrieve the metadata keys settings
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passbolt-browser-extension",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
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",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"locutus": "~2.0.9",
|
|
23
23
|
"openpgp": "^6.1.1",
|
|
24
24
|
"papaparse": "^5.5.2",
|
|
25
|
-
"passbolt-styleguide": "^5.3.
|
|
25
|
+
"passbolt-styleguide": "^5.3.2",
|
|
26
26
|
"react": "17.0.2",
|
|
27
27
|
"react-dom": "17.0.2",
|
|
28
28
|
"secrets-passbolt": "github:passbolt/secrets.js#v2.0.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "npx grunt build",
|
|
82
82
|
"build:background-page": "webpack --config webpack.background-page.config.js",
|
|
83
|
-
"build:service-worker": "webpack --config webpack.service-worker.config.js; webpack --config webpack-offscreens.
|
|
83
|
+
"build:service-worker": "webpack --config webpack.service-worker.config.js; webpack --config webpack-offscreens.config.js",
|
|
84
84
|
"build:content-scripts": "npm run build:content-scripts:app; npm run build:content-scripts:browser-integration; npm run build:content-scripts:public-website",
|
|
85
85
|
"build:content-scripts:app": "webpack --config webpack-content-scripts.config.js",
|
|
86
86
|
"build:content-scripts:browser-integration": "webpack --config webpack-content-scripts.browser-integration.config.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"build:web-accessible-resources:app": "webpack --config webpack-data.config.js; webpack --config webpack-data.download.config.js",
|
|
90
90
|
"build:web-accessible-resources:browser-integration": "webpack --config webpack-data.in-form-call-to-action.config.js; webpack --config webpack-data.in-form-menu.config.js",
|
|
91
91
|
"dev:build:background-page": "webpack --env debug=true --config webpack.background-page.config.js",
|
|
92
|
-
"dev:build:service-worker": "webpack --env debug=true --config webpack.service-worker.config.js; webpack --env debug=true --config webpack-offscreens.
|
|
92
|
+
"dev:build:service-worker": "webpack --env debug=true --config webpack.service-worker.config.js; webpack --env debug=true --config webpack-offscreens.config.js",
|
|
93
93
|
"dev:build:content-scripts": "npm run dev:build:content-scripts:app; npm run dev:build:content-scripts:browser-integration; npm run dev:build:content-scripts:public-website",
|
|
94
94
|
"dev:build:content-scripts:app": "webpack --env debug=true --config webpack-content-scripts.config.js",
|
|
95
95
|
"dev:build:content-scripts:browser-integration": "webpack --env debug=true --config webpack-content-scripts.browser-integration.config.js",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"lint:eslint-fix": "eslint -c .eslintrc.json --ext js --ext jsx --fix src",
|
|
113
113
|
"i18n:externalize": "i18next -c ./i18next-parser.config.js",
|
|
114
114
|
"test": "npm run test:unit",
|
|
115
|
-
"test:unit": "jest --no-cache ./src/all/ ./src/chrome-mv3/",
|
|
115
|
+
"test:unit": "jest --no-cache ./src/all/ ./src/chrome-mv3/ ./src/chrome/",
|
|
116
116
|
"test:coverage": "jest --no-cache ./src/all/ ./src/chrome-mv3/ --coverage",
|
|
117
117
|
"test:ci:coverage": "npm run test:coverage -- --runInBand"
|
|
118
118
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.3.2
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import CopyToClipboardService from "../../service/clipboard/copyToClipboardService";
|
|
16
|
+
|
|
17
|
+
export default class CancelClipboardContentFlushController {
|
|
18
|
+
/**
|
|
19
|
+
* CancelClipboardContentFlushController constructor
|
|
20
|
+
* @param {Worker} worker
|
|
21
|
+
* @param {string} requestId uuid
|
|
22
|
+
*/
|
|
23
|
+
constructor(worker, requestId) {
|
|
24
|
+
this.worker = worker;
|
|
25
|
+
this.requestId = requestId;
|
|
26
|
+
this.copyToClipboardService = new CopyToClipboardService();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Wrapper of exec function to run it with worker.
|
|
31
|
+
* @return {Promise<void>}
|
|
32
|
+
*/
|
|
33
|
+
async _exec() {
|
|
34
|
+
try {
|
|
35
|
+
await this.exec();
|
|
36
|
+
this.worker.port.emit(this.requestId, "SUCCESS");
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error(error);
|
|
39
|
+
this.worker.port.emit(this.requestId, "ERROR", error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Cancel flushing of the clipboard content
|
|
45
|
+
*
|
|
46
|
+
* @return {Promise<void>}
|
|
47
|
+
*/
|
|
48
|
+
async exec() {
|
|
49
|
+
await this.copyToClipboardService.clearAlarm();
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/all/background_page/controller/clipboard/cancelClipboardContentFlushController.test.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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.3.2
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {v4 as uuidv4} from 'uuid';
|
|
16
|
+
import CancelClipboardContentFlushController from './cancelClipboardContentFlushController';
|
|
17
|
+
|
|
18
|
+
describe('CancelClipboardContentFlushController', () => {
|
|
19
|
+
describe('constructor', () => {
|
|
20
|
+
it('should set the worker and requestId properties', () => {
|
|
21
|
+
expect.assertions(2);
|
|
22
|
+
|
|
23
|
+
const worker = {port: {}};
|
|
24
|
+
const requestId = uuidv4();
|
|
25
|
+
const controller = new CancelClipboardContentFlushController(worker, requestId);
|
|
26
|
+
|
|
27
|
+
expect(controller.worker).toBe(worker);
|
|
28
|
+
expect(controller.requestId).toBe(requestId);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('exec', () => {
|
|
33
|
+
it('should call copyTemporarily of the right service', async() => {
|
|
34
|
+
expect.assertions(1);
|
|
35
|
+
|
|
36
|
+
const toCopy = "text";
|
|
37
|
+
const controller = new CancelClipboardContentFlushController();
|
|
38
|
+
|
|
39
|
+
jest.spyOn(controller.copyToClipboardService, "clearAlarm").mockImplementation(() => {});
|
|
40
|
+
|
|
41
|
+
await controller.exec(toCopy);
|
|
42
|
+
|
|
43
|
+
expect(controller.copyToClipboardService.clearAlarm).toHaveBeenCalledTimes(1);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
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.3.2
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import CopyToClipboardService from "../../service/clipboard/copyToClipboardService";
|
|
16
|
+
|
|
17
|
+
export default class CopyTemporarilyToClipboardController {
|
|
18
|
+
/**
|
|
19
|
+
* CopyTemporarilyToClipboardController constructor
|
|
20
|
+
* @param {Worker} worker
|
|
21
|
+
* @param {string} requestId uuid
|
|
22
|
+
*/
|
|
23
|
+
constructor(worker, requestId) {
|
|
24
|
+
this.worker = worker;
|
|
25
|
+
this.requestId = requestId;
|
|
26
|
+
this.copyToClipboardService = new CopyToClipboardService();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Wrapper of exec function to run it with worker.
|
|
31
|
+
* @param text {string} The text to copy
|
|
32
|
+
* @return {Promise<void>}
|
|
33
|
+
*/
|
|
34
|
+
async _exec(text) {
|
|
35
|
+
try {
|
|
36
|
+
await this.exec(text);
|
|
37
|
+
this.worker.port.emit(this.requestId, "SUCCESS");
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(error);
|
|
40
|
+
this.worker.port.emit(this.requestId, "ERROR", error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Temporarily copy text to clipboard
|
|
46
|
+
*
|
|
47
|
+
* @param text {string} The text to copy
|
|
48
|
+
* @return {Promise<void>}
|
|
49
|
+
*/
|
|
50
|
+
async exec(text) {
|
|
51
|
+
await this.copyToClipboardService.copyTemporarily(text);
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/all/background_page/controller/clipboard/copyTemporarilyToClipboardController.test.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
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.3.2
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {v4 as uuidv4} from 'uuid';
|
|
16
|
+
import CopyTemporarilyToClipboardController from './copyTemporarilyToClipboardController';
|
|
17
|
+
|
|
18
|
+
describe('CopyTemporarilyToClipboardController', () => {
|
|
19
|
+
describe('constructor', () => {
|
|
20
|
+
it('should set the worker and requestId properties', () => {
|
|
21
|
+
expect.assertions(2);
|
|
22
|
+
|
|
23
|
+
const worker = {port: {}};
|
|
24
|
+
const requestId = uuidv4();
|
|
25
|
+
const controller = new CopyTemporarilyToClipboardController(worker, requestId);
|
|
26
|
+
|
|
27
|
+
expect(controller.worker).toBe(worker);
|
|
28
|
+
expect(controller.requestId).toBe(requestId);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('exec', () => {
|
|
33
|
+
it('should call copyTemporarily of the right service', async() => {
|
|
34
|
+
expect.assertions(2);
|
|
35
|
+
|
|
36
|
+
const toCopy = "text";
|
|
37
|
+
const controller = new CopyTemporarilyToClipboardController();
|
|
38
|
+
|
|
39
|
+
jest.spyOn(controller.copyToClipboardService, "copyTemporarily").mockImplementation(() => {});
|
|
40
|
+
|
|
41
|
+
await controller.exec(toCopy);
|
|
42
|
+
|
|
43
|
+
expect(controller.copyToClipboardService.copyTemporarily).toHaveBeenCalledTimes(1);
|
|
44
|
+
expect(controller.copyToClipboardService.copyTemporarily).toHaveBeenCalledWith(toCopy);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -12,21 +12,23 @@
|
|
|
12
12
|
* @since 3.9.0
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import CopyToClipboardService from "../../service/clipboard/copyToClipboardService";
|
|
15
16
|
|
|
16
|
-
class
|
|
17
|
+
export default class CopyToClipboardController {
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* CopyToClipboardController constructor
|
|
19
20
|
* @param {Worker} worker
|
|
20
21
|
* @param {string} requestId uuid
|
|
21
22
|
*/
|
|
22
23
|
constructor(worker, requestId) {
|
|
23
24
|
this.worker = worker;
|
|
24
25
|
this.requestId = requestId;
|
|
26
|
+
this.copyToClipboardService = new CopyToClipboardService();
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* Wrapper of exec function to run it with worker.
|
|
29
|
-
* @param text {
|
|
31
|
+
* @param text {string} The text to copy
|
|
30
32
|
* @return {Promise<void>}
|
|
31
33
|
*/
|
|
32
34
|
async _exec(text) {
|
|
@@ -42,12 +44,10 @@ class ClipboardController {
|
|
|
42
44
|
/**
|
|
43
45
|
* Copy text to clipboard
|
|
44
46
|
*
|
|
45
|
-
* @param text {
|
|
46
|
-
* @return {
|
|
47
|
+
* @param text {string} The text to copy
|
|
48
|
+
* @return {Promise<void>}
|
|
47
49
|
*/
|
|
48
50
|
async exec(text) {
|
|
49
|
-
await
|
|
51
|
+
await this.copyToClipboardService.copy(text);
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
export default ClipboardController;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passbolt ~ Open source password manager for teams
|
|
3
|
+
* Copyright (c) 2023 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) 2023 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 3.9.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {v4 as uuidv4} from 'uuid';
|
|
16
|
+
import CopyToClipboardController from './copyToClipboardController';
|
|
17
|
+
|
|
18
|
+
describe('CopyToClipboardController', () => {
|
|
19
|
+
describe('constructor', () => {
|
|
20
|
+
it('should set the worker and requestId properties', () => {
|
|
21
|
+
expect.assertions(2);
|
|
22
|
+
|
|
23
|
+
const worker = {port: {}};
|
|
24
|
+
const requestId = uuidv4();
|
|
25
|
+
const controller = new CopyToClipboardController(worker, requestId);
|
|
26
|
+
|
|
27
|
+
expect(controller.worker).toBe(worker);
|
|
28
|
+
expect(controller.requestId).toBe(requestId);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('exec', () => {
|
|
33
|
+
it('should call copy on the right service', async() => {
|
|
34
|
+
expect.assertions(2);
|
|
35
|
+
|
|
36
|
+
const toCopy = "text";
|
|
37
|
+
const controller = new CopyToClipboardController();
|
|
38
|
+
|
|
39
|
+
jest.spyOn(controller.copyToClipboardService, "copy").mockImplementation(() => {});
|
|
40
|
+
|
|
41
|
+
await controller.exec(toCopy);
|
|
42
|
+
|
|
43
|
+
expect(controller.copyToClipboardService.copy).toHaveBeenCalledTimes(1);
|
|
44
|
+
expect(controller.copyToClipboardService.copy).toHaveBeenCalledWith(toCopy);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
package/src/all/background_page/controller/metadata/getOrFindMetadataKeysSettingsController.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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.4.0
|
|
13
|
+
*/
|
|
14
|
+
import GetOrFindMetadataSettingsService from "../../service/metadata/getOrFindMetadataSettingsService";
|
|
15
|
+
|
|
16
|
+
class GetOrFindMetadataKeysController {
|
|
17
|
+
/**
|
|
18
|
+
* @constructor
|
|
19
|
+
* @param {Worker} worker
|
|
20
|
+
* @param {string} requestId
|
|
21
|
+
* @param {ApiClientOptions} apiClientOptions the api client options
|
|
22
|
+
* @param {AccountEntity} account the user account
|
|
23
|
+
*/
|
|
24
|
+
constructor(worker, requestId, apiClientOptions, account) {
|
|
25
|
+
this.worker = worker;
|
|
26
|
+
this.requestId = requestId;
|
|
27
|
+
this.getOrFindMetadaSettingsService = new GetOrFindMetadataSettingsService(account, apiClientOptions);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Controller executor.
|
|
32
|
+
* @returns {Promise<void>}
|
|
33
|
+
*/
|
|
34
|
+
async _exec() {
|
|
35
|
+
try {
|
|
36
|
+
const result = await this.exec();
|
|
37
|
+
this.worker.port.emit(this.requestId, 'SUCCESS', result);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(error);
|
|
40
|
+
this.worker.port.emit(this.requestId, 'ERROR', error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get or find the metadata keys settings entity.
|
|
46
|
+
* @returns {Promise<MetadataKeysSettingsEntity>}
|
|
47
|
+
*/
|
|
48
|
+
async exec() {
|
|
49
|
+
return this.getOrFindMetadaSettingsService.getOrFindKeysSettings();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default GetOrFindMetadataKeysController;
|