passbolt-browser-extension 5.14.2 → 5.14.3

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 CHANGED
@@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [5.14.3] - 2026-08-03
8
+ ### Fixed
9
+ - PB-53406: PCD: do not display when editing a shared resource metadata only
10
+ - PB-53471: PCD: creation of a shared resource in a non owned folder should display the PCD in read-only
11
+ - PB-53546: Fix in form menu integration disablement behaviour
12
+
13
+ ### Maintenance
14
+ - PB-53384: Add logs for errors on the process "add user to group"
15
+
7
16
  ## [5.14.2] - 2026-07-27
8
17
  ### Fixed
9
18
  - PB-53322: throttle permissions confirmation dialog requests
@@ -2925,7 +2934,8 @@ self registration settings option in the left-side bar
2925
2934
  - AP: User with plugin installed
2926
2935
  - LU: Logged in user
2927
2936
 
2928
- [Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.2...HEAD
2937
+ [Unreleased]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.3...HEAD
2938
+ [5.14.3]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.2...v5.14.3
2929
2939
  [5.14.2]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.1...v5.14.2
2930
2940
  [5.14.1]: https://github.com/passbolt/passbolt_browser_extension/compare/v5.14.0...v5.14.1
2931
2941
  [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,9 @@
1
- # v5.14.2
1
+ # v5.14.3
2
2
 
3
3
  ### Fixed
4
- - PB-53322: throttle permissions confirmation dialog requests
5
- - PB-53211: fix an error when creating an account
6
- - PB-53316: fix edition name translation
4
+ - PB-53406: PCD: do not display when editing a shared resource metadata only
5
+ - PB-53471: PCD: creation of a shared resource in a non owned folder should display the PCD in read-only
6
+ - PB-53546: Fix in form menu integration disablement behaviour
7
+
8
+ ### Maintenance
9
+ - PB-53384: Add logs for errors on the process "add user to group"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passbolt-browser-extension",
3
- "version": "5.14.2",
3
+ "version": "5.14.3",
4
4
  "license": "AGPL-3.0",
5
5
  "copyright": "Copyright 2025 Passbolt SA",
6
6
  "description": "Passbolt web extension for the open source password manager for teams",
@@ -21,7 +21,7 @@
21
21
  "kdbxweb": "2.1.1",
22
22
  "openpgp": "^6.1.1",
23
23
  "papaparse": "^5.5.2",
24
- "passbolt-styleguide": "^5.14.6",
24
+ "passbolt-styleguide": "^5.14.7",
25
25
  "react": "^18.3.1",
26
26
  "react-dom": "^18.3.1",
27
27
  "secrets-passbolt": "github:passbolt/secrets.js#v2.0.1",
@@ -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
- const secretMessage = await OpenpgpAssertion.readMessageOrFail(secret.data);
43
- result[secret.resourceId] = await DecryptMessageService.decrypt(secretMessage, privateKey);
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
- const encryptionKey = await OpenpgpAssertion.readKeyOrFail(usersPublicKeys[user_id]);
70
- const data = await EncryptMessageService.encrypt(decryptedSecrets[resource_id], encryptionKey, [privateKey]);
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 {Array} decryptedSecrets A collection of decrypted secret [{resourceId: secretDecrypted}, ...]
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<[]>} [{resourceId: secretDecrypted}, ...]
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] = keyring.findPublic(userId).armoredKey;
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 },
@@ -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
 
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 2,
3
3
  "name": "__MSG_appName__",
4
4
  "short_name": "passbolt",
5
- "version": "5.14.2",
5
+ "version": "5.14.3",
6
6
  "description": "__MSG_appDescription__",
7
7
  "default_locale": "en",
8
8
  "externally_connectable": {},
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "name": "__MSG_appName__",
4
4
  "short_name": "passbolt",
5
- "version": "5.14.2",
5
+ "version": "5.14.3",
6
6
  "description": "__MSG_appDescription__",
7
7
  "default_locale": "en",
8
8
  "minimum_chrome_version": "116",
@@ -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(new Error(data.message));
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
 
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 2,
3
3
  "name": "__MSG_appName__",
4
4
  "short_name": "passbolt",
5
- "version": "5.14.2",
5
+ "version": "5.14.3",
6
6
  "description": "__MSG_appDescription__",
7
7
  "default_locale": "en",
8
8
  "browser_specific_settings": {
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 2,
3
3
  "name": "Passbolt - password manager",
4
4
  "short_name": "passbolt",
5
- "version": "5.14.2",
5
+ "version": "5.14.3",
6
6
  "description": "Passbolt extension for the open source password manager.",
7
7
  "default_locale": "en",
8
8
  "icons": {