@webex/internal-plugin-ediscovery 3.0.0-beta.8 → 3.0.0-bnr.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/README.md +7 -5
- package/dist/config.js +0 -2
- package/dist/config.js.map +1 -1
- package/dist/ediscovery-error.js +2 -24
- package/dist/ediscovery-error.js.map +1 -1
- package/dist/ediscovery.js +236 -370
- package/dist/ediscovery.js.map +1 -1
- package/dist/index.js +4 -28
- package/dist/index.js.map +1 -1
- package/dist/internal-plugin-ediscovery.d.ts +50 -0
- package/dist/report-request.js +0 -6
- package/dist/report-request.js.map +1 -1
- package/dist/retry.js +27 -43
- package/dist/retry.js.map +1 -1
- package/dist/transforms.js +81 -104
- package/dist/transforms.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/config.d.ts +11 -0
- package/dist/types/ediscovery-error.d.ts +11 -0
- package/dist/types/ediscovery.d.ts +6 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/report-request.d.ts +29 -0
- package/dist/types/retry.d.ts +2 -0
- package/dist/types/transforms.d.ts +35 -0
- package/package.json +10 -10
- package/src/config.js +6 -4
- package/src/ediscovery.js +2 -2
- package/src/index.js +35 -22
- package/src/report-request.js +10 -1
- package/src/retry.js +23 -14
- package/src/transforms.js +483 -214
- package/test/integration/spec/ediscovery.js +62 -43
- package/test/unit/spec/content.js +304 -166
- package/test/unit/spec/report.js +76 -77
- package/test/unit/spec/transforms.js +227 -152
package/dist/transforms.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
|
-
|
|
10
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
15
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
16
|
-
|
|
17
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
18
|
-
|
|
19
14
|
var _retry = require("./retry");
|
|
20
|
-
|
|
21
15
|
/**
|
|
22
16
|
* This class is used to encrypt/decrypt various properties on ReportRequests, Activities and Spaces as they are sent/returned to/from the eDiscovery Service
|
|
23
17
|
*/
|
|
@@ -25,7 +19,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
25
19
|
function Transforms() {
|
|
26
20
|
(0, _classCallCheck2.default)(this, Transforms);
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
(0, _createClass2.default)(Transforms, null, [{
|
|
30
23
|
key: "encryptReportRequest",
|
|
31
24
|
value:
|
|
@@ -39,7 +32,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
39
32
|
if (!object || !object.body) {
|
|
40
33
|
return _promise.default.resolve(object);
|
|
41
34
|
}
|
|
42
|
-
|
|
43
35
|
var reportRequest = object.body;
|
|
44
36
|
return ctx.webex.internal.encryption.kms.createUnboundKeys({
|
|
45
37
|
count: 1
|
|
@@ -51,19 +43,16 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
51
43
|
keys: keys
|
|
52
44
|
}).then(function () {
|
|
53
45
|
var promises = [];
|
|
54
|
-
|
|
55
46
|
if (reportRequest.name) {
|
|
56
47
|
promises.push(ctx.webex.internal.encryption.encryptText(keys[0], reportRequest.name).then(function (encryptedName) {
|
|
57
48
|
reportRequest.name = encryptedName;
|
|
58
49
|
}));
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
if (reportRequest.description) {
|
|
62
52
|
promises.push(ctx.webex.internal.encryption.encryptText(keys[0], reportRequest.description).then(function (encryptedDescription) {
|
|
63
53
|
reportRequest.description = encryptedDescription;
|
|
64
54
|
}));
|
|
65
55
|
}
|
|
66
|
-
|
|
67
56
|
if (reportRequest.spaceNames) {
|
|
68
57
|
promises.push(_promise.default.all(reportRequest.spaceNames.map(function (spaceName) {
|
|
69
58
|
return ctx.webex.internal.encryption.encryptText(keys[0], spaceName);
|
|
@@ -71,7 +60,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
71
60
|
reportRequest.spaceNames = encryptedSpaceNames;
|
|
72
61
|
}));
|
|
73
62
|
}
|
|
74
|
-
|
|
75
63
|
if (reportRequest.keywords) {
|
|
76
64
|
promises.push(_promise.default.all(reportRequest.keywords.map(function (keyword) {
|
|
77
65
|
return ctx.webex.internal.encryption.encryptText(keys[0], keyword);
|
|
@@ -79,7 +67,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
79
67
|
reportRequest.keywords = encryptedKeywords;
|
|
80
68
|
}));
|
|
81
69
|
}
|
|
82
|
-
|
|
83
70
|
if (reportRequest.emails) {
|
|
84
71
|
// store unencrypted emails for ediscovery service to convert to user ids
|
|
85
72
|
reportRequest.unencryptedEmails = reportRequest.emails;
|
|
@@ -89,34 +76,30 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
89
76
|
reportRequest.emails = encryptedEmails;
|
|
90
77
|
}));
|
|
91
78
|
}
|
|
92
|
-
|
|
93
79
|
return _promise.default.all(promises);
|
|
94
80
|
});
|
|
95
81
|
}
|
|
96
|
-
|
|
97
82
|
return _promise.default.resolve(object);
|
|
98
83
|
}).catch(function (reason) {
|
|
99
84
|
ctx.webex.logger.error("Error while encrypting report request: ".concat(reportRequest, " : ").concat(reason));
|
|
100
85
|
return _promise.default.reject(reason);
|
|
101
86
|
});
|
|
102
87
|
}
|
|
88
|
+
|
|
103
89
|
/**
|
|
104
90
|
* This function is used to decrypt encrypted properties on the ReportRequest that is returned from the eDiscovery Service getReport(s) API
|
|
105
91
|
* @param {Object} ctx - An object containing a webex instance and a transform
|
|
106
92
|
* @param {Object} object - Generic object that you want to decrypt some property on based on the type
|
|
107
93
|
* @returns {Promise} - Returns a transform promise
|
|
108
94
|
*/
|
|
109
|
-
|
|
110
95
|
}, {
|
|
111
96
|
key: "decryptReportRequest",
|
|
112
97
|
value: function decryptReportRequest(ctx, object) {
|
|
113
98
|
if (!object || !object.body || !object.body.reportRequest || !object.body.reportRequest.encryptionKeyUrl) {
|
|
114
99
|
return _promise.default.resolve(object);
|
|
115
100
|
}
|
|
116
|
-
|
|
117
101
|
var reportRequest = object.body.reportRequest;
|
|
118
102
|
var reportNamePromise;
|
|
119
|
-
|
|
120
103
|
if (reportRequest.name) {
|
|
121
104
|
reportNamePromise = ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, reportRequest.name).then(function (decryptedName) {
|
|
122
105
|
reportRequest.name = decryptedName;
|
|
@@ -124,9 +107,7 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
124
107
|
ctx.webex.logger.error("Error decrypting report name for report ".concat(object.body.id, ": ").concat(reason));
|
|
125
108
|
});
|
|
126
109
|
}
|
|
127
|
-
|
|
128
110
|
var reportDescriptionPromise;
|
|
129
|
-
|
|
130
111
|
if (reportRequest.description) {
|
|
131
112
|
reportDescriptionPromise = ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, reportRequest.description).then(function (decryptedDescription) {
|
|
132
113
|
reportRequest.description = decryptedDescription;
|
|
@@ -134,9 +115,7 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
134
115
|
ctx.webex.logger.error("Error decrypting description for report ".concat(object.body.id, ": ").concat(reason));
|
|
135
116
|
});
|
|
136
117
|
}
|
|
137
|
-
|
|
138
118
|
var spaceNamePromises = [];
|
|
139
|
-
|
|
140
119
|
if (reportRequest.spaceNames) {
|
|
141
120
|
spaceNamePromises = _promise.default.all(reportRequest.spaceNames.map(function (spaceName) {
|
|
142
121
|
return ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, spaceName);
|
|
@@ -146,9 +125,7 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
146
125
|
ctx.webex.logger.error("Error decrypting space name for report ".concat(object.body.id, ": ").concat(reason));
|
|
147
126
|
});
|
|
148
127
|
}
|
|
149
|
-
|
|
150
128
|
var keywordPromises = [];
|
|
151
|
-
|
|
152
129
|
if (reportRequest.keywords) {
|
|
153
130
|
keywordPromises = _promise.default.all(reportRequest.keywords.map(function (keyword) {
|
|
154
131
|
return ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, keyword);
|
|
@@ -158,9 +135,7 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
158
135
|
ctx.webex.logger.error("Error decrypting keywords for report ".concat(object.body.id, ": ").concat(reason));
|
|
159
136
|
});
|
|
160
137
|
}
|
|
161
|
-
|
|
162
138
|
var emailPromises = [];
|
|
163
|
-
|
|
164
139
|
if (reportRequest.emails) {
|
|
165
140
|
emailPromises = _promise.default.all(reportRequest.emails.map(function (email) {
|
|
166
141
|
return ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, email);
|
|
@@ -170,9 +145,9 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
170
145
|
ctx.webex.logger.error("Error decrypting emails for report ".concat(object.body.id, ": ").concat(reason));
|
|
171
146
|
});
|
|
172
147
|
}
|
|
173
|
-
|
|
174
148
|
return _promise.default.all([reportNamePromise, reportDescriptionPromise].concat(spaceNamePromises, keywordPromises, emailPromises));
|
|
175
149
|
}
|
|
150
|
+
|
|
176
151
|
/**
|
|
177
152
|
* This function is used to decrypt encrypted properties on the activities that are returned from the eDiscovery Service getContent API
|
|
178
153
|
* @param {Object} ctx - An object containing a webex instance and a transform
|
|
@@ -180,89 +155,81 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
180
155
|
* @param {String} reportId - Id of the report for which content is being retrieved
|
|
181
156
|
* @returns {Promise} - Returns a transform promise
|
|
182
157
|
*/
|
|
183
|
-
|
|
184
158
|
}, {
|
|
185
159
|
key: "decryptReportContent",
|
|
186
160
|
value: function decryptReportContent(ctx, object, reportId) {
|
|
187
161
|
if (!object || !object.body || !reportId) {
|
|
188
162
|
return _promise.default.resolve();
|
|
189
163
|
}
|
|
190
|
-
|
|
191
164
|
var activity = object.body;
|
|
192
165
|
var promises = [];
|
|
193
166
|
return ctx.webex.internal.ediscovery.getContentContainerByContainerId(reportId, activity.targetId).then(function (res) {
|
|
194
167
|
var _activity$spaceInfo, _activity$spaceInfo2, _activity$spaceInfo3, _activity$spaceInfo4, _activity$spaceInfo5, _activity$meeting, _activity$recording;
|
|
195
|
-
|
|
196
168
|
var container = res.body;
|
|
197
|
-
|
|
198
169
|
if (!container) {
|
|
199
170
|
var reason = "Container ".concat(activity.targetId, " not found - unable to decrypt activity ").concat(activity.activityId);
|
|
200
171
|
activity.error = reason;
|
|
201
172
|
ctx.webex.logger.error(reason);
|
|
202
173
|
return _promise.default.resolve(object);
|
|
203
|
-
}
|
|
204
|
-
|
|
174
|
+
}
|
|
205
175
|
|
|
176
|
+
// add warning properties to the activity - these will be recorded in the downloader
|
|
206
177
|
if (container.warning) {
|
|
207
178
|
activity.spaceWarning = container.warning; // Remove this property once all clients are using the content container model
|
|
208
|
-
|
|
209
179
|
activity.containerWarning = container.warning;
|
|
210
|
-
}
|
|
211
|
-
|
|
180
|
+
}
|
|
212
181
|
|
|
182
|
+
// set space name and participants on activity
|
|
213
183
|
if (container.containerName) {
|
|
214
184
|
activity.spaceName = container.containerName; // Remove this property once all clients are using the content container model
|
|
215
|
-
|
|
216
185
|
activity.containerName = container.containerName;
|
|
217
186
|
} else if (container.isOneOnOne) {
|
|
218
187
|
var displayNames = (container.participants || []).concat(container.formerParticipants || []).map(function (p) {
|
|
219
188
|
return p.displayName;
|
|
220
|
-
}).join(' & ');
|
|
189
|
+
}).join(' & ');
|
|
221
190
|
|
|
191
|
+
// One to One spaces have no space name, use participant names as 'Subject' instead
|
|
222
192
|
activity.spaceName = displayNames; // Remove this property once all clients are using the content container model
|
|
223
|
-
|
|
224
193
|
activity.containerName = displayNames;
|
|
225
194
|
} else {
|
|
226
195
|
activity.spaceName = ''; // Remove this property once all clients are using the content container model
|
|
227
|
-
|
|
228
196
|
activity.containerName = '';
|
|
229
|
-
}
|
|
230
|
-
// as do meeting, recording activities, customApp extensions, and space information updates
|
|
231
|
-
|
|
197
|
+
}
|
|
232
198
|
|
|
233
|
-
|
|
199
|
+
// post and share activities have content which needs to be decrypted
|
|
200
|
+
// as do meeting, recording activities, customApp extensions, and space information updates
|
|
201
|
+
if (!['post', 'share'].includes(activity.verb) && !activity.meeting && !activity.recording && !(activity.extension && activity.extension.extensionType === 'customApp') && !((_activity$spaceInfo = activity.spaceInfo) !== null && _activity$spaceInfo !== void 0 && _activity$spaceInfo.name) && !((_activity$spaceInfo2 = activity.spaceInfo) !== null && _activity$spaceInfo2 !== void 0 && _activity$spaceInfo2.description) && !activity.encryptedTextKeyValues) {
|
|
234
202
|
return _promise.default.resolve(object);
|
|
235
203
|
}
|
|
236
|
-
|
|
237
204
|
if (!activity.encryptionKeyUrl) {
|
|
238
205
|
// If the encryptionKeyUrl is empty we assume the activity is unencrypted
|
|
239
206
|
ctx.webex.logger.info("Activity ".concat(activity.activityId, " cannot be decrypted due to a missing encryption key url"));
|
|
240
207
|
return _promise.default.resolve(object);
|
|
241
208
|
}
|
|
242
209
|
|
|
243
|
-
|
|
210
|
+
// CDR Compliance uses org key and does depend on an onBehalfOfUser
|
|
211
|
+
if (activity.encryptedTextKeyValues === undefined && !container.onBehalfOfUser) {
|
|
244
212
|
var _reason = "No user available with which to decrypt activity ".concat(activity.activityId, " in container ").concat(activity.targetId);
|
|
245
|
-
|
|
246
213
|
ctx.webex.logger.error(_reason);
|
|
247
214
|
activity.error = _reason;
|
|
248
215
|
return _promise.default.resolve(object);
|
|
249
|
-
}
|
|
250
|
-
|
|
216
|
+
}
|
|
251
217
|
|
|
218
|
+
// Decrypt activity message if present
|
|
252
219
|
if (activity.objectDisplayName) {
|
|
253
220
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.objectDisplayName, {
|
|
254
221
|
onBehalfOf: container.onBehalfOfUser
|
|
255
222
|
}]).then(function (decryptedMessage) {
|
|
256
223
|
activity.objectDisplayName = decryptedMessage;
|
|
257
224
|
}).catch(function (reason) {
|
|
258
|
-
ctx.webex.logger.error("Decrypt message error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
|
|
259
|
-
|
|
225
|
+
ctx.webex.logger.error("Decrypt message error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
|
|
226
|
+
// add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
|
|
260
227
|
activity.error = reason;
|
|
261
228
|
return _promise.default.resolve(object);
|
|
262
229
|
}));
|
|
263
|
-
}
|
|
264
|
-
|
|
230
|
+
}
|
|
265
231
|
|
|
232
|
+
// If the activity is a space information update, decrypt the name and description if present
|
|
266
233
|
if ((_activity$spaceInfo3 = activity.spaceInfo) !== null && _activity$spaceInfo3 !== void 0 && _activity$spaceInfo3.name) {
|
|
267
234
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.spaceInfo.name, {
|
|
268
235
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -274,7 +241,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
274
241
|
return _promise.default.resolve(object);
|
|
275
242
|
}));
|
|
276
243
|
}
|
|
277
|
-
|
|
278
244
|
if ((_activity$spaceInfo4 = activity.spaceInfo) !== null && _activity$spaceInfo4 !== void 0 && _activity$spaceInfo4.description) {
|
|
279
245
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.spaceInfo.description, {
|
|
280
246
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -286,7 +252,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
286
252
|
return _promise.default.resolve(object);
|
|
287
253
|
}));
|
|
288
254
|
}
|
|
289
|
-
|
|
290
255
|
if ((_activity$spaceInfo5 = activity.spaceInfo) !== null && _activity$spaceInfo5 !== void 0 && _activity$spaceInfo5.previousName && activity.spaceInfo.previousEncryptionKeyUrl) {
|
|
291
256
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.spaceInfo.previousEncryptionKeyUrl, activity.spaceInfo.previousName, {
|
|
292
257
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -297,9 +262,9 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
297
262
|
activity.error = reason;
|
|
298
263
|
return _promise.default.resolve(object);
|
|
299
264
|
}));
|
|
300
|
-
}
|
|
301
|
-
|
|
265
|
+
}
|
|
302
266
|
|
|
267
|
+
// Decrypt content url and display name if extension is present
|
|
303
268
|
if (activity.extension && activity.extension.objectType === 'extension' && activity.extension.extensionType === 'customApp') {
|
|
304
269
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.contentUrl, {
|
|
305
270
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -318,8 +283,9 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
318
283
|
ctx.webex.logger.error("Decrypt activity.extension.displayName error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
|
|
319
284
|
activity.error = reason;
|
|
320
285
|
return _promise.default.resolve(object);
|
|
321
|
-
}));
|
|
286
|
+
}));
|
|
322
287
|
|
|
288
|
+
// Decrypt webUrl.
|
|
323
289
|
if (activity.extension.webUrl) {
|
|
324
290
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.webUrl, {
|
|
325
291
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -331,7 +297,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
331
297
|
return _promise.default.resolve(object);
|
|
332
298
|
}));
|
|
333
299
|
}
|
|
334
|
-
|
|
335
300
|
if (activity.verb === 'update' && activity.extension.previous) {
|
|
336
301
|
if (activity.extension.previous.contentUrl) {
|
|
337
302
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.previous.contentUrl, {
|
|
@@ -344,7 +309,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
344
309
|
return _promise.default.resolve(object);
|
|
345
310
|
}));
|
|
346
311
|
}
|
|
347
|
-
|
|
348
312
|
if (activity.extension.previous.displayName) {
|
|
349
313
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.previous.displayName, {
|
|
350
314
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -357,9 +321,28 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
357
321
|
}));
|
|
358
322
|
}
|
|
359
323
|
}
|
|
360
|
-
}
|
|
324
|
+
}
|
|
361
325
|
|
|
326
|
+
// Decrypt encrypted text map if present
|
|
327
|
+
if (activity.encryptedTextKeyValues !== undefined) {
|
|
328
|
+
var _loop = function _loop() {
|
|
329
|
+
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
330
|
+
key = _Object$entries$_i[0],
|
|
331
|
+
value = _Object$entries$_i[1];
|
|
332
|
+
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, value]).then(function (decryptedMessage) {
|
|
333
|
+
activity.encryptedTextKeyValues[key] = decryptedMessage;
|
|
334
|
+
}).catch(function (reason) {
|
|
335
|
+
ctx.webex.logger.error("Decrypt activity.encryptedTextKeyValues error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
|
|
336
|
+
activity.error = reason;
|
|
337
|
+
return _promise.default.resolve(object);
|
|
338
|
+
}));
|
|
339
|
+
};
|
|
340
|
+
for (var _i = 0, _Object$entries = (0, _entries.default)(activity.encryptedTextKeyValues); _i < _Object$entries.length; _i++) {
|
|
341
|
+
_loop();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
362
344
|
|
|
345
|
+
// Decrypt meeting title if present
|
|
363
346
|
if (activity !== null && activity !== void 0 && (_activity$meeting = activity.meeting) !== null && _activity$meeting !== void 0 && _activity$meeting.title) {
|
|
364
347
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.meeting.title, {
|
|
365
348
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -370,9 +353,9 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
370
353
|
activity.error = reason;
|
|
371
354
|
return _promise.default.resolve(object);
|
|
372
355
|
}));
|
|
373
|
-
}
|
|
374
|
-
|
|
356
|
+
}
|
|
375
357
|
|
|
358
|
+
// Decrypt meeting recording topic if present
|
|
376
359
|
if (activity !== null && activity !== void 0 && (_activity$recording = activity.recording) !== null && _activity$recording !== void 0 && _activity$recording.topic) {
|
|
377
360
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.recording.topic, {
|
|
378
361
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -383,31 +366,31 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
383
366
|
activity.error = reason;
|
|
384
367
|
return _promise.default.resolve(object);
|
|
385
368
|
}));
|
|
386
|
-
}
|
|
387
|
-
// Array.prototype.concat.apply ignores undefined
|
|
388
|
-
|
|
369
|
+
}
|
|
389
370
|
|
|
371
|
+
// Decrypt shares (files, whiteboards, shared links)
|
|
372
|
+
// Array.prototype.concat.apply ignores undefined
|
|
390
373
|
var shares = Array.prototype.concat.apply([], activity.files);
|
|
391
374
|
shares = Array.prototype.concat.apply(shares, activity.whiteboards);
|
|
392
375
|
shares = Array.prototype.concat.apply(shares, activity.links);
|
|
376
|
+
var _loop2 = function _loop2() {
|
|
377
|
+
var share = shares[i];
|
|
393
378
|
|
|
394
|
-
|
|
395
|
-
var share = shares[i]; // Decrypt the share's display name
|
|
379
|
+
// Decrypt the share's display name
|
|
396
380
|
// Ignore display names for whiteboards which are unencrypted
|
|
397
|
-
|
|
398
381
|
if (share.displayName && (!activity.whiteboards || !activity.whiteboards.includes(share))) {
|
|
399
382
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, share.displayName, {
|
|
400
383
|
onBehalfOf: container.onBehalfOfUser
|
|
401
384
|
}]).then(function (decryptedDisplayName) {
|
|
402
385
|
share.displayName = decryptedDisplayName;
|
|
403
386
|
}).catch(function (reason) {
|
|
404
|
-
ctx.webex.logger.warn("Decrypt DisplayName error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
405
|
-
|
|
387
|
+
ctx.webex.logger.warn("Decrypt DisplayName error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
388
|
+
// add warning property to activity - this will present an indication that there was data loss on the downloader
|
|
406
389
|
activity.warning = reason;
|
|
407
390
|
}));
|
|
408
|
-
}
|
|
409
|
-
|
|
391
|
+
}
|
|
410
392
|
|
|
393
|
+
// Shared Links can have additional decryption fields
|
|
411
394
|
if (share.microsoftSharedLinkInfo) {
|
|
412
395
|
if (share.microsoftSharedLinkInfo.driveId) {
|
|
413
396
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, share.microsoftSharedLinkInfo.driveId, {
|
|
@@ -415,32 +398,32 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
415
398
|
}]).then(function (decryptedDriveId) {
|
|
416
399
|
share.microsoftSharedLinkInfo.driveId = decryptedDriveId;
|
|
417
400
|
}).catch(function (reason) {
|
|
418
|
-
ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.driveId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
419
|
-
|
|
401
|
+
ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.driveId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
402
|
+
// add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
|
|
420
403
|
activity.error = reason;
|
|
421
404
|
return _promise.default.resolve(object);
|
|
422
405
|
}));
|
|
423
406
|
}
|
|
424
|
-
|
|
425
407
|
if (share.microsoftSharedLinkInfo.itemId) {
|
|
426
408
|
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, share.microsoftSharedLinkInfo.itemId, {
|
|
427
409
|
onBehalfOf: container.onBehalfOfUser
|
|
428
410
|
}]).then(function (decryptedItemId) {
|
|
429
411
|
share.microsoftSharedLinkInfo.itemId = decryptedItemId;
|
|
430
412
|
}).catch(function (reason) {
|
|
431
|
-
ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.itemId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
432
|
-
|
|
413
|
+
ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.itemId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
414
|
+
// add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
|
|
433
415
|
activity.error = reason;
|
|
434
416
|
return _promise.default.resolve(object);
|
|
435
417
|
}));
|
|
436
418
|
}
|
|
437
|
-
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Decrypt the scr (Secure Content Reference) or sslr (Secure Shared Link Reference)
|
|
438
422
|
// Unlike a scr the sslr contains only a loc. But decryptScr(...) is flexible and
|
|
439
423
|
// leaves the tag, auth, IV, etc fields on the SCR object as undefined.
|
|
440
|
-
|
|
441
|
-
|
|
442
424
|
if (share.scr || share.sslr) {
|
|
443
|
-
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptScr,
|
|
425
|
+
promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptScr,
|
|
426
|
+
// A share will have an encryptionKeyUrl when it's activity uses a different encryptionKeyUrl. This can happen when old activities are edited
|
|
444
427
|
// and key rotation is turn on.
|
|
445
428
|
[share.encryptionKeyUrl || activity.encryptionKeyUrl, share.scr || share.sslr, {
|
|
446
429
|
onBehalfOf: container.onBehalfOfUser
|
|
@@ -451,69 +434,64 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
451
434
|
share.sslr = decryptedSCR.loc;
|
|
452
435
|
}
|
|
453
436
|
}).catch(function (reason) {
|
|
454
|
-
ctx.webex.logger.error("Decrypt file scr or sslr error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
455
|
-
|
|
437
|
+
ctx.webex.logger.error("Decrypt file scr or sslr error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
|
|
438
|
+
// add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
|
|
456
439
|
activity.error = reason;
|
|
457
440
|
return _promise.default.resolve(object);
|
|
458
441
|
}));
|
|
459
442
|
}
|
|
460
443
|
};
|
|
461
|
-
|
|
462
444
|
for (var i = 0; i < shares.length; i += 1) {
|
|
463
|
-
|
|
445
|
+
_loop2();
|
|
464
446
|
}
|
|
465
|
-
|
|
466
447
|
return _promise.default.all(promises);
|
|
467
448
|
}).catch(function (reason) {
|
|
468
|
-
ctx.webex.logger.error("Error retrieving content container for: ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
|
|
469
|
-
|
|
449
|
+
ctx.webex.logger.error("Error retrieving content container for: ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
|
|
450
|
+
// add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
|
|
470
451
|
activity.error = reason;
|
|
471
452
|
return _promise.default.resolve(object);
|
|
472
453
|
});
|
|
473
454
|
}
|
|
455
|
+
|
|
474
456
|
/**
|
|
475
457
|
* This function is used to decrypt encrypted properties on the containers that are returned from the eDiscovery Service getContentContainer API
|
|
476
458
|
* @param {Object} ctx - An object containing a webex instance and a transform
|
|
477
459
|
* @param {Object} object - Generic object that you want to decrypt some property on based on the type
|
|
478
460
|
* @returns {Promise} - Returns a transform promise
|
|
479
461
|
*/
|
|
480
|
-
|
|
481
462
|
}, {
|
|
482
463
|
key: "decryptReportContentContainer",
|
|
483
464
|
value: function decryptReportContentContainer(ctx, object) {
|
|
484
465
|
if (!object || !object.body) {
|
|
485
466
|
return _promise.default.resolve();
|
|
486
467
|
}
|
|
487
|
-
|
|
488
468
|
var container = object.body;
|
|
489
|
-
|
|
490
469
|
if (!container.containerName) {
|
|
491
470
|
return _promise.default.resolve(object);
|
|
492
471
|
}
|
|
493
|
-
|
|
494
472
|
if (!container.encryptionKeyUrl) {
|
|
495
473
|
// If the encryptionKeyUrl is empty we assume the container name is unencrypted
|
|
496
474
|
ctx.webex.logger.info("".concat(container.containerType, " container ").concat(container.containerId, " cannot be decrypted due to a missing encryption key url"));
|
|
497
475
|
return _promise.default.resolve(object);
|
|
498
476
|
}
|
|
499
|
-
|
|
500
477
|
if (!container.onBehalfOfUser) {
|
|
501
478
|
var reason = "No user available with which to decrypt ".concat(container.containerType, " container ").concat(container.containerId);
|
|
502
479
|
ctx.webex.logger.error(reason);
|
|
503
480
|
container.error = reason;
|
|
504
481
|
return _promise.default.resolve(object);
|
|
505
|
-
}
|
|
506
|
-
|
|
482
|
+
}
|
|
507
483
|
|
|
484
|
+
// decrypt description if present with a descriptionEncryptionKeyUrl
|
|
508
485
|
if (container.description && container.descriptionEncryptionKeyUrl) {
|
|
509
486
|
(0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [container.descriptionEncryptionKeyUrl, container.description, {
|
|
510
487
|
onBehalfOf: container.onBehalfOfUser
|
|
511
488
|
}]).then(function (decryptedContainerDescription) {
|
|
512
489
|
container.description = decryptedContainerDescription;
|
|
513
490
|
}).catch(function (reason) {
|
|
514
|
-
ctx.webex.logger.error("Decrypt container description error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason));
|
|
515
|
-
|
|
516
|
-
container.warning = reason;
|
|
491
|
+
ctx.webex.logger.error("Decrypt container description error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason));
|
|
492
|
+
// add warn property to container info - this warning will be recorded in the downloader
|
|
493
|
+
container.warning = reason;
|
|
494
|
+
// don't return, attempt to decrypt the name first
|
|
517
495
|
});
|
|
518
496
|
}
|
|
519
497
|
|
|
@@ -522,8 +500,8 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
522
500
|
}]).then(function (decryptedContainerName) {
|
|
523
501
|
container.containerName = decryptedContainerName;
|
|
524
502
|
}).catch(function (reason) {
|
|
525
|
-
ctx.webex.logger.error("Decrypt container name error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason));
|
|
526
|
-
|
|
503
|
+
ctx.webex.logger.error("Decrypt container name error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason));
|
|
504
|
+
// add warn property to container info - this warning will be recorded in the downloader
|
|
527
505
|
container.warning = reason;
|
|
528
506
|
return _promise.default.resolve(object);
|
|
529
507
|
});
|
|
@@ -531,7 +509,6 @@ var Transforms = /*#__PURE__*/function () {
|
|
|
531
509
|
}]);
|
|
532
510
|
return Transforms;
|
|
533
511
|
}();
|
|
534
|
-
|
|
535
512
|
var _default = Transforms;
|
|
536
513
|
exports.default = _default;
|
|
537
514
|
//# sourceMappingURL=transforms.js.map
|