Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CxOne 1.0.21 release items #27

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<unload unload_date="2024-02-14 13:27:23">
<unload unload_date="2024-06-12 10:11:49">
<sys_script_include action="INSERT_OR_UPDATE">
<access>public</access>
<active>true</active>
Expand All @@ -24,17 +24,7 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
// filteredcount, offset
response = this.getAppList(Object.keys(params.run)[0], params.run[Object.keys(params.run)[0]]);
}
params = this._serializeParameters(this._nextParameters(params));
this.setNextRunParameters(params);

//Saving delta_start_time
if (!params.run) {
var latest = this.LATEST ? this.LATEST : '';
this.INTEGRATION.setValue('delta_start_time', latest);
this.INTEGRATION.update();
this.hasMoreData(false);
} else
this.hasMoreData(true);

} catch (ex) {
gs.error(this.MSG + "Error in retriving data for app list integration!" + ex);
response = '<appInfoList><xml id="checkmarxone"><projects></projects></xml></appInfoList>';
Expand All @@ -44,7 +34,17 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
response = '<appInfoList><xml id="checkmarxone"><projects></projects></xml></appInfoList>';

}

params = this._serializeParameters(this._nextParameters(params));
this.setNextRunParameters(params);

//Saving delta_start_time
if (!params.run) {
var latest = this.LATEST ? this.LATEST : '';
this.INTEGRATION.setValue('delta_start_time', latest);
this.INTEGRATION.update();
this.hasMoreData(false);
} else
this.hasMoreData(true);
return {
contents: new GlideSysAttachment().write(this.PROCESS, this.FILENAME, "xml", response),
contentType: "sys_attachment",
Expand All @@ -62,48 +62,47 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
var appListAll = '';
//to start offset from 0 and limit 50
var newoffset = offset - 50;
var response = this.UTIL.getNextProjectList(this.IMPLEMENTATION, newoffset);
var projects = this.UTIL.getNextProjectList(this.IMPLEMENTATION, newoffset);
var groups = '';
var groupval = ' ';
var isPrimaryBranchEnabled = this.UTIL._getConfig(this.IMPLEMENTATION).sync_only_primary_branch.toString();
for (var item in response.projects) {
var projectTags = this._getProjectTags(JSON.stringify(response.projects[item].tags));
var applicationIds = '';
var primaryBranch = '';
var isProjectAllowed = 'true';
groups = +response.projects[item].groups.toString();
var projectResponse = this.UTIL.getProjectById(this.IMPLEMENTATION, response.projects[item].id);
if (null != projectResponse.applicationIds && projectResponse.applicationIds.length > 0)
applicationIds = projectResponse.applicationIds.toString();
if (null != projectResponse.mainBranch && projectResponse.mainBranch.length > 0)
primaryBranch = projectResponse.mainBranch.toString();
if (isPrimaryBranchEnabled == 'true' && (primaryBranch == null || primaryBranch == ''))
isProjectAllowed = 'false';
if (isProjectAllowed == 'true') {
var createdDate = this._getCurrentDeltaStartTime();

for (var item in projects) {
if (projects[item].createdAt > createdDate) {
var projectTags = this._getProjectTags(JSON.stringify(projects[item].tags));
var applicationIds = '';
var primaryBranch = '';
groups = +projects[item].groups.toString();

if (null != projects[item].applicationIds && projects[item].applicationIds.length > 0)
applicationIds = projects[item].applicationIds.toString();
if (null != projects[item].mainBranch && projects[item].mainBranch.length > 0)
primaryBranch = projects[item].mainBranch.toString();

if (groups == 0) {
appListAll += '<project id="' + response.projects[item].id +
'" createdAt="' + response.projects[item].createdAt +
appListAll += '<project id="' + projects[item].id +
'" createdAt="' + projects[item].createdAt +
'" applicationIds="' + applicationIds +
'" groups="' + groupval + '"><primaryBranch><' +
'![CDATA[' + primaryBranch + ']]' + '></primaryBranch><projectTags><' +
'![CDATA[' + projectTags + ']]' + '></projectTags><name><' +
'![CDATA[' + response.projects[item].name + ']]' + '></name></project>';
'![CDATA[' + projects[item].name + ']]' + '></name></project>';

} else {
appListAll += '<project id="' + response.projects[item].id +
'" createdAt="' + response.projects[item].createdAt +
appListAll += '<project id="' + projects[item].id +
'" createdAt="' + projects[item].createdAt +
'" applicationIds="' + applicationIds +
'" groups="' + response.projects[item].groups.toString() + '"><primaryBranch><' +
'" groups="' + projects[item].groups.toString() + '"><primaryBranch><' +
'![CDATA[' + primaryBranch + ']]' + '></primaryBranch><projectTags><' +
'![CDATA[' + projectTags + ']]' + '></projectTags><name><' +
'![CDATA[' + response.projects[item].name + ']]' + '></name></project>';
'![CDATA[' + projects[item].name + ']]' + '></name></project>';
}
}
}

var reportContent = appListRootNodeStart + appListAll + appListRootNodeEnd;
} catch (err) {
gs.info(this.MSG + " getAppList : Error while getting the summary report." + err);
gs.error(this.MSG + " getAppList : Error occured while creating XML for project list: " + err);
throw err;
}
return reportContent;
Expand Down Expand Up @@ -134,10 +133,12 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
this.LATEST = new GlideDateTime();
var offsetId;
var filteredCount;
var filter_project = this.UTIL._getConfig(this.IMPLEMENTATION).filter_project;
var list_projects = this.UTIL.getConfigProjectList(this.IMPLEMENTATION);
if (list_projects && list_projects.length > 0) {
offsetId = '0';
filteredCount = '' + list_projects.length;
if (list_projects && list_projects.length > 0 && list_projects.indexOf('exclude') == -1 && filter_project == 'by_Id') {
var projectLengthUI = '' + list_projects.length;
offsetId = this._getoffsets(projectLengthUI, projectLengthUI);
filteredCount = projectLengthUI;
} else {
var projectJSON = this.UTIL.getNewProjectList(this.IMPLEMENTATION);
filteredCount = projectJSON.filteredTotalCount;
Expand All @@ -155,7 +156,7 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
}
}
} catch (err) {
gs.error(this.MSG + " _getParameters : Error while getting the integration parameters." + err);
gs.error(this.MSG + " _getParameters : Error while getting the integration parameters: " + err);
throw err;
}
return params;
Expand Down Expand Up @@ -185,7 +186,7 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
try {
var delta = this.UTIL.parseTZDate(this.DELTA_START_TIME) || '1970-01-01T10:16:06.17544Z';
} catch (err) {
gs.error(this.MSG + " _getCurrentDeltaStartTime : Error while getting the current delta start time." + err);
gs.error(this.MSG + " _getCurrentDeltaStartTime : Error while getting the current delta start time: " + err);
throw err;
}
return delta;
Expand Down Expand Up @@ -224,13 +225,13 @@ CheckmarxOneAppListIntegration.prototype = Object.extendsObject(sn_vul.Applicati
<sys_created_by>admin</sys_created_by>
<sys_created_on>2022-11-18 05:11:38</sys_created_on>
<sys_id>f60f0ee047131110328ca368436d43ba</sys_id>
<sys_mod_count>179</sys_mod_count>
<sys_mod_count>197</sys_mod_count>
<sys_name>CheckmarxOneAppListIntegration</sys_name>
<sys_package display_value="Checkmarx One Vulnerability Integration" source="x_chec3_chexone">3d20e92d47471110328ca368436d436a</sys_package>
<sys_policy/>
<sys_scope display_value="Checkmarx One Vulnerability Integration">3d20e92d47471110328ca368436d436a</sys_scope>
<sys_update_name>sys_script_include_f60f0ee047131110328ca368436d43ba</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-02-08 16:03:48</sys_updated_on>
<sys_updated_on>2024-05-22 06:06:39</sys_updated_on>
</sys_script_include>
</unload>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<unload unload_date="2024-02-14 13:27:27">
<unload unload_date="2024-06-12 10:11:43">
<sys_script_include action="INSERT_OR_UPDATE">
<access>public</access>
<active>true</active>
Expand Down Expand Up @@ -46,29 +46,29 @@ CheckmarxOneAppListProcessor.prototype = Object.extendsObject(sn_vul.Application
var infoObj = {};

var childIter = appNode.getChildNodeIterator();
var projectTagsFlag = 'false';
var primaryBranchFlag = 'false';
var projectTagsFlag = 'false';
var primaryBranchFlag = 'false';
while (childIter.hasNext) {
var childNode = childIter.next();
if (childNode.getNodeName() == "projectTags") {
projectTags = childNode.getTextContent();
projectTagsFlag = 'true';
projectTagsFlag = 'true';
}
if (childNode.getNodeName() == "primaryBranch") {
primaryBranch = childNode.getTextContent();
primaryBranchFlag = 'true';
primaryBranchFlag = 'true';
}
if(projectTagsFlag == 'true' && primaryBranchFlag == 'true')
break;
if (projectTagsFlag == 'true' && primaryBranchFlag == 'true')
break;
}
if (appNode.getAttribute('applicationIds') && appNode.getAttribute('applicationIds') != {})
if (appNode.getAttribute('applicationIds') && appNode.getAttribute('applicationIds') != {})
infoObj[gs.getMessage("Application Id ")] = appNode.getAttribute('applicationIds').toString();
if (null != primaryBranch && '' != primaryBranch)

if (null != primaryBranch && '' != primaryBranch)
infoObj[gs.getMessage("Primary Branch ")] = primaryBranch.toString();

if (infoObj == {})
infoObj = "";
infoObj = "";

//map attributes from Checkmarx into the servicenow expected format'
var appObj = {
Expand All @@ -78,7 +78,7 @@ CheckmarxOneAppListProcessor.prototype = Object.extendsObject(sn_vul.Application
source_assigned_teams: attributes.groups,
description: 'created at' + attributes.createdAt,
source_additional_info: JSON.stringify(infoObj),
source_app_guid : primaryBranch.toString()
source_app_guid: primaryBranch.toString()

};
//Updating the project information in ServiceNow table
Expand Down Expand Up @@ -110,13 +110,13 @@ CheckmarxOneAppListProcessor.prototype = Object.extendsObject(sn_vul.Application
<sys_created_by>admin</sys_created_by>
<sys_created_on>2022-11-21 12:03:00</sys_created_on>
<sys_id>716c87ad471f1110328ca368436d438a</sys_id>
<sys_mod_count>74</sys_mod_count>
<sys_mod_count>75</sys_mod_count>
<sys_name>CheckmarxOneAppListProcessor</sys_name>
<sys_package display_value="Checkmarx One Vulnerability Integration" source="x_chec3_chexone">3d20e92d47471110328ca368436d436a</sys_package>
<sys_policy/>
<sys_scope display_value="Checkmarx One Vulnerability Integration">3d20e92d47471110328ca368436d436a</sys_scope>
<sys_update_name>sys_script_include_716c87ad471f1110328ca368436d438a</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-02-08 06:23:20</sys_updated_on>
<sys_updated_on>2024-05-22 05:08:04</sys_updated_on>
</sys_script_include>
</unload>
Loading