1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <unload unload_date =" 2024-10-11 13:00:13 " >
2
+ <unload unload_date =" 2024-12-20 12:24:40 " >
3
3
<sys_script_include action =" INSERT_OR_UPDATE" >
4
4
<access >public</access >
5
5
<active >true</active >
@@ -73,7 +73,9 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
73
73
primaryBranch = this.UTIL.getProjectById(this.IMPLEMENTATION, appId).mainBranch.toString();
74
74
if (null != primaryBranch && '' != primaryBranch) {
75
75
responseLastScanSummary = this.UTIL.getScanListFilterByBranch(this.IMPLEMENTATION, appId, this._getCurrentDeltaStartTime(), primaryBranch);
76
- }
76
+ branches = this.UTIL.getProjectBranchList(this.IMPLEMENTATION, appId);
77
+ } else
78
+ responseLastScanSummary = this.UTIL.getScanInfo(this.IMPLEMENTATION, appId, newoffset, this._getCurrentDeltaStartTime());
77
79
} else if (scan_synchronization == 'latest scan from each branch') {
78
80
branches = this.UTIL.getProjectBranchList(this.IMPLEMENTATION, appId);
79
81
if (null != branches && '' != branches) {
@@ -97,10 +99,14 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
97
99
var lastSastDate;
98
100
var lastScaDate;
99
101
var lastKicsDate;
102
+ var prvBranch = '';
103
+ var prvSastScanBranch = '';
104
+ var prvScaScanBranch = '';
105
+ var prvKicsScanBranch = '';
100
106
101
107
while (scanSummary.hasNext()) {
102
108
scanSummary.next();
103
- var prvBranch = '';
109
+
104
110
var isBranchMatched = 'false';
105
111
var tags = scanSummary.getValue('tags');
106
112
if (null != tags && '' != tags && 'undefined' != tags) {
@@ -111,51 +117,57 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
111
117
prvBranch = record.substring(8);
112
118
}
113
119
}
120
+
114
121
if (null == scan_synchronization || '' == scan_synchronization || 'undefined' == scan_synchronization)
115
122
isBranchMatched = 'true';
116
- else if (scan_synchronization == 'latest scan of primary branch' && null != primaryBranch && '' != primaryBranch && primaryBranch == prvBranch)
117
- isBranchMatched = 'true';
118
- else if (scan_synchronization == 'latest scan from each branch' && null != branches && '' != branches && '' != prvBranch && branches.indexOf(prvBranch) != -1)
123
+ else if ((scan_synchronization == 'latest scan of primary branch' || scan_synchronization == 'latest scan from each branch') &&
124
+ null != branches && '' != branches && '' != prvBranch && branches.indexOf(prvBranch) != -1)
119
125
isBranchMatched = 'true';
120
126
else if (scan_synchronization == 'latest scan across all branches')
121
127
isBranchMatched = 'true';
122
128
if (null != scanSummary && null != scanSummary.source_scan_id && '' != scanSummary.source_scan_id && scanSummary.source_scan_id != 'undefined') {
123
129
prvScanId = scanSummary.getValue('source_scan_id') + '';
130
+ var lastUpdatedDate = scanSummary.getValue('sys_updated_on');
124
131
if (prvScanId.indexOf('sast') != -1 && isBranchMatched == 'true') {
125
- if ((null == lastSastDate || '' == lastSastDate || 'undefined' == lastSastDate) || (lastSastDate && lastSastDate < scanSummary.last_scan_date )) {
132
+ if ((null == lastSastDate || '' == lastSastDate || 'undefined' == lastSastDate) || (lastSastDate && lastUpdatedDate >= lastSastDate )) {
126
133
sastPrvScanId = prvScanId;
127
- lastSastDate = scanSummary.last_scan_date;
134
+ prvSastScanBranch = prvBranch;
135
+ lastSastDate = lastUpdatedDate;
136
+
128
137
}
129
138
if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
130
139
if (prvSastScanIdBranch != '')
131
140
prvSastScanIdBranch += '|||';
132
- prvSastScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + scanSummary.last_scan_date ;
141
+ prvSastScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + lastUpdatedDate ;
133
142
}
134
143
}
135
144
if (prvScanId.indexOf('sca') != -1 && isBranchMatched == 'true') {
136
- if ((null == lastScaDate || '' == lastScaDate || 'undefined' == lastScaDate) || (lastScaDate && lastScaDate < scanSummary.last_scan_date )) {
145
+ if ((null == lastScaDate || '' == lastScaDate || 'undefined' == lastScaDate) || (lastScaDate && lastUpdatedDate >= lastScaDate )) {
137
146
scaPrvScanId = prvScanId;
138
- lastScaDate = scanSummary.last_scan_date;
147
+ prvScaScanBranch = prvBranch;
148
+ lastScaDate = lastUpdatedDate;
139
149
}
140
150
if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
141
151
if (prvScaScanIdBranch != '')
142
152
prvScaScanIdBranch += '|||';
143
- prvScaScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + scanSummary.last_scan_date ;
153
+ prvScaScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + lastUpdatedDate ;
144
154
}
145
155
}
146
156
if (prvScanId.indexOf('IaC') != -1 && isBranchMatched == 'true') {
147
- if ((null == lastKicsDate || '' == lastKicsDate || 'undefined' == lastKicsDate) || (lastKicsDate && lastKicsDate < scanSummary.last_scan_date )) {
157
+ if ((null == lastKicsDate || '' == lastKicsDate || 'undefined' == lastKicsDate) || (lastKicsDate && lastUpdatedDate >= lastKicsDate )) {
148
158
kicsPrvScanId = prvScanId;
149
- lastKicsDate = scanSummary.last_scan_date;
159
+ prvKicsScanBranch = prvBranch;
160
+ lastKicsDate = lastUpdatedDate;
150
161
}
151
162
if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
152
163
if (prvKicsScanIdBranch != '')
153
164
prvKicsScanIdBranch += '|||';
154
- prvKicsScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + scanSummary.last_scan_date ;
165
+ prvKicsScanIdBranch += prvBranch + ':::' + prvScanId + ':::' + lastUpdatedDate ;
155
166
}
156
167
}
157
168
}
158
169
}
170
+
159
171
var branch = [];
160
172
var configScanType = config.scan_type.toString();
161
173
for (var item in jsonLastScanSummResp.scans) {
@@ -164,8 +176,13 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
164
176
var scaresponsevul = this.UTIL.getScanSummaryInfo(this.IMPLEMENTATION, jsonLastScanSummResp.scans[item].id);
165
177
var scaScanType = "Full Scan";
166
178
if (scaresponsevul != -1) {
167
- if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch')
179
+ if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
168
180
scaPrvScanId = this._getPrvScanIdForSpecificBranch(prvScaScanIdBranch, jsonLastScanSummResp.scans[item].branch);
181
+ if (scaPrvScanId == '')
182
+ prvScaScanBranch = '';
183
+ else
184
+ prvScaScanBranch = '' + jsonLastScanSummResp.scans[item].branch;
185
+ }
169
186
scaScanSummaryAll += '<scan id="' + 'sca' + jsonLastScanSummResp.scans[item].id + '" app_id="' + appId +
170
187
'" last_scan_date="' + this.UTIL.parseDate(jsonLastScanSummResp.scans[item].updatedAt) +
171
188
'" total_no_flaws="' + scaresponsevul +
@@ -174,6 +191,7 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
174
191
'" scan_origin="' + jsonLastScanSummResp.scans[item].sourceOrigin +
175
192
'" scan_source="' + jsonLastScanSummResp.scans[item].sourceType +
176
193
'" scan_type="' + scaScanType +
194
+ '" prvBranch="' + prvScaScanBranch +
177
195
'" app_name="' + appId + '"/>';
178
196
}
179
197
}
@@ -193,8 +211,13 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
193
211
}
194
212
var sastScanType = jsonLastScanSummResp.scans[item].metadata.configs[0].value.incremental == "false" ? "Full Scan" : "Incremental Scan";
195
213
if (sastresponsevul != -1 && ((null == configScanType || '' == configScanType) || (sastScanTypeToCheck != '' && configScanType.indexOf(sastScanTypeToCheck) != -1))) {
196
- if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch')
214
+ if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
197
215
sastPrvScanId = this._getPrvScanIdForSpecificBranch(prvSastScanIdBranch, jsonLastScanSummResp.scans[item].branch);
216
+ if (sastPrvScanId == '')
217
+ prvSastScanBranch = '';
218
+ else
219
+ prvSastScanBranch = '' + jsonLastScanSummResp.scans[item].branch;
220
+ }
198
221
var loc = this._getLOCforSAST(jsonLastScanSummResp.scans[item].statusDetails);
199
222
sastScanSummaryAll += '<scan id="' + 'sast' + jsonLastScanSummResp.scans[item].id + '" app_id="' + appId +
200
223
'" last_scan_date="' + this.UTIL.parseDate(jsonLastScanSummResp.scans[item].updatedAt) +
@@ -205,6 +228,7 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
205
228
'" scan_origin="' + jsonLastScanSummResp.scans[item].sourceOrigin +
206
229
'" scan_source="' + jsonLastScanSummResp.scans[item].sourceType +
207
230
'" scan_type="' + sastScanType +
231
+ '" prvBranch="' + prvSastScanBranch +
208
232
'" app_name="' + appId + '"/>';
209
233
}
210
234
}
@@ -215,8 +239,13 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
215
239
var scanType = "Full Scan";
216
240
if (kicsresponsevul != -1) {
217
241
218
- if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch')
242
+ if (null != scan_synchronization && '' != scan_synchronization && 'undefined' != scan_synchronization && scan_synchronization == 'latest scan from each branch') {
219
243
kicsPrvScanId = this._getPrvScanIdForSpecificBranch(prvKicsScanIdBranch, jsonLastScanSummResp.scans[item].branch);
244
+ if (kicsPrvScanId == '')
245
+ prvKicsScanBranch = '';
246
+ else
247
+ prvKicsScanBranch = '' + jsonLastScanSummResp.scans[item].branch;
248
+ }
220
249
kicsScanSummaryAll += '<scan id="' + 'IaC' + jsonLastScanSummResp.scans[item].id + '" app_id="' + appId +
221
250
'" last_scan_date="' + this.UTIL.parseDate(jsonLastScanSummResp.scans[item].updatedAt) +
222
251
'" total_no_flaws="' + kicsresponsevul +
@@ -225,6 +254,7 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
225
254
'" scan_origin="' + jsonLastScanSummResp.scans[item].sourceOrigin +
226
255
'" scan_source="' + jsonLastScanSummResp.scans[item].sourceType +
227
256
'" scan_type="' + scanType +
257
+ '" prvBranch="' + prvKicsScanBranch +
228
258
'" app_name="' + appId + '"/>';
229
259
}
230
260
}
@@ -434,13 +464,13 @@ CheckmarxOneScanSummaryIntegration.prototype = Object.extendsObject(sn_vul.Appli
434
464
<sys_created_by >admin</sys_created_by >
435
465
<sys_created_on >2022-11-18 05:18:19</sys_created_on >
436
466
<sys_id >d7f2d2e447131110328ca368436d4321</sys_id >
437
- <sys_mod_count >229 </sys_mod_count >
467
+ <sys_mod_count >267 </sys_mod_count >
438
468
<sys_name >CheckmarxOneScanSummaryIntegration</sys_name >
439
469
<sys_package display_value =" Checkmarx One Vulnerability Integration" source =" x_chec3_chexone" >3d20e92d47471110328ca368436d436a</sys_package >
440
470
<sys_policy />
441
471
<sys_scope display_value =" Checkmarx One Vulnerability Integration" >3d20e92d47471110328ca368436d436a</sys_scope >
442
472
<sys_update_name >sys_script_include_d7f2d2e447131110328ca368436d4321</sys_update_name >
443
473
<sys_updated_by >admin</sys_updated_by >
444
- <sys_updated_on >2024-10-04 06:23:34 </sys_updated_on >
474
+ <sys_updated_on >2024-12-11 16:31:25 </sys_updated_on >
445
475
</sys_script_include >
446
476
</unload >
0 commit comments