1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <unload unload_date =" 2024-12-20 12:24:40 " >
2
+ <unload unload_date =" 2025-02-07 05:42:00 " >
3
3
<sys_script_include action =" INSERT_OR_UPDATE" >
4
4
<access >public</access >
5
5
<active >true</active >
6
6
<api_name >x_chec3_chexone.CheckmarxOneScanSummaryIntegration</api_name >
7
7
<caller_access />
8
8
<client_callable >false</client_callable >
9
9
<description >Integration script for the CheckmarxOne Scan Summary Integration.</description >
10
+ <mobile_callable >false</mobile_callable >
10
11
<name >CheckmarxOneScanSummaryIntegration</name >
12
+ <sandbox_callable >false</sandbox_callable >
11
13
<script ><![CDATA[ var CheckmarxOneScanSummaryIntegration = Class.create();
12
14
CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.ApplicationVulnerabilityIntegrationBase, {
13
15
@@ -59,11 +61,13 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
59
61
var scaScanSummaryAll = '';
60
62
var sastScanSummaryAll = '';
61
63
var kicsScanSummaryAll = '';
64
+ var containerSecurityScanSummaryAll = '';
62
65
var includescanSummaryAll = '';
63
66
var newoffset = offsetId - 1;
64
67
var includesca = this.UTIL.importScaFlaw(this.IMPLEMENTATION);
65
68
var includesast = this.UTIL.importSastFlaw(this.IMPLEMENTATION);
66
69
var includekics = this.UTIL.importKicsFlaw(this.IMPLEMENTATION);
70
+ var includeContainerSecurity = this.UTIL.importContainerSecurityFlaw(this.IMPLEMENTATION);
67
71
var config = this.UTIL._getConfig(this.IMPLEMENTATION);
68
72
var scan_synchronization = config.scan_synchronization.toString();
69
73
var primaryBranch = '';
@@ -93,16 +97,20 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
93
97
var prvSastScanIdBranch = '';
94
98
var prvScaScanIdBranch = '';
95
99
var prvKicsScanIdBranch = '';
100
+ var prvConSecScanIdBranch = '';
96
101
var sastPrvScanId = '';
97
102
var scaPrvScanId = '';
98
103
var kicsPrvScanId = '';
104
+ var conSecPrvScanId = '';
99
105
var lastSastDate;
100
106
var lastScaDate;
101
107
var lastKicsDate;
108
+ var lastConSecDate;
102
109
var prvBranch = '';
103
110
var prvSastScanBranch = '';
104
111
var prvScaScanBranch = '';
105
112
var prvKicsScanBranch = '';
113
+ var prvConSecScanBranch = '';
106
114
107
115
while (scanSummary.hasNext()) {
108
116
scanSummary.next();
@@ -165,6 +173,19 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
165
173
prvKicsScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + lastUpdatedDate;
166
174
}
167
175
}
176
+
177
+ if (prvScanId.indexOf('CS') != -1 && isBranchMatched == 'true') {
178
+ if ((null == lastConSecDate || '' == lastConSecDate || 'undefined' == lastConSecDate) || (lastConSecDate && lastUpdatedDate >= lastConSecDate)) {
179
+ conSecPrvScanId = prvScanId;
180
+ prvConSecScanBranch = prvBranch;
181
+ lastConSecDate = lastUpdatedDate;
182
+ }
183
+ if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
184
+ if (prvConSecScanIdBranch != '')
185
+ prvConSecScanIdBranch += '|||';
186
+ prvConSecScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + lastUpdatedDate;
187
+ }
188
+ }
168
189
}
169
190
}
170
191
@@ -258,6 +279,33 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
258
279
'" app_name="' + appId + '"/>';
259
280
}
260
281
}
282
+
283
+ //Container Security scan summary
284
+ if (includeContainerSecurity && jsonLastScanSummResp.scans[item].engines.toString().indexOf("containers") != -1 && branch.indexOf(jsonLastScanSummResp.scans[item].branch) == -1) {
285
+ var containerSecurityResponseVul = this.UTIL.getContainerSecurityScanSummaryInfo(this.IMPLEMENTATION, jsonLastScanSummResp.scans[item].id);
286
+ var scanType = "Full Scan";
287
+ if (containerSecurityResponseVul != -1) {
288
+
289
+ if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
290
+ conSecPrvScanId = this._getPrvScanIdForSpecificBranch(prvConSecScanIdBranch, jsonLastScanSummResp.scans[item].branch);
291
+ if (conSecPrvScanId == '')
292
+ prvConSecScanBranch = '';
293
+ else
294
+ prvConSecScanBranch = '' + jsonLastScanSummResp.scans[item].branch;
295
+ }
296
+ containerSecurityScanSummaryAll += '<scan id="' + 'CS' + jsonLastScanSummResp.scans[item].id + '" app_id="' + appId +
297
+ '" last_scan_date="' + this.UTIL.parseDate(jsonLastScanSummResp.scans[item].updatedAt) +
298
+ '" total_no_flaws="' + containerSecurityResponseVul +
299
+ '" branch="' + jsonLastScanSummResp.scans[item].branch +
300
+ '" prvScanId="' + conSecPrvScanId +
301
+ '" scan_origin="' + jsonLastScanSummResp.scans[item].sourceOrigin +
302
+ '" scan_source="' + jsonLastScanSummResp.scans[item].sourceType +
303
+ '" scan_type="' + scanType +
304
+ '" prvBranch="' + prvConSecScanBranch +
305
+ '" app_name="' + appId + '"/>';
306
+ }
307
+ }
308
+
261
309
branch.push(jsonLastScanSummResp.scans[item].branch);
262
310
263
311
var date = new GlideDateTime(this.UTIL.parseDate(jsonLastScanSummResp.scans[item].updatedAt));
@@ -273,6 +321,9 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
273
321
if (includekics) {
274
322
includescanSummaryAll += "<kicsScanData><scans>" + kicsScanSummaryAll + "</scans></kicsScanData>";
275
323
}
324
+ if (includeContainerSecurity) {
325
+ includescanSummaryAll += "<conSecScanData><scans>" + containerSecurityScanSummaryAll + "</scans></conSecScanData>";
326
+ }
276
327
277
328
reportContent = scanSummaryRootNodeStart + includescanSummaryAll + scanSummaryRootNodeEnd;
278
329
} catch (err) {
@@ -464,13 +515,13 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
464
515
<sys_created_by >admin</sys_created_by >
465
516
<sys_created_on >2022-11-18 05:18:19</sys_created_on >
466
517
<sys_id >d7f2d2e447131110328ca368436d4321</sys_id >
467
- <sys_mod_count >267 </sys_mod_count >
518
+ <sys_mod_count >271 </sys_mod_count >
468
519
<sys_name >CheckmarxOneScanSummaryIntegration</sys_name >
469
520
<sys_package display_value =" Checkmarx One Vulnerability Integration" source =" x_chec3_chexone" >3d20e92d47471110328ca368436d436a</sys_package >
470
521
<sys_policy />
471
522
<sys_scope display_value =" Checkmarx One Vulnerability Integration" >3d20e92d47471110328ca368436d436a</sys_scope >
472
523
<sys_update_name >sys_script_include_d7f2d2e447131110328ca368436d4321</sys_update_name >
473
524
<sys_updated_by >admin</sys_updated_by >
474
- <sys_updated_on >2024-12-11 16:31:25 </sys_updated_on >
525
+ <sys_updated_on >2024-12-31 08:00:01 </sys_updated_on >
475
526
</sys_script_include >
476
527
</unload >
0 commit comments