Skip to content

Commit

Permalink
Q4 2024 integration branch (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulPidde23 authored Nov 28, 2024
1 parent 18d99b8 commit 134f857
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@checkmarx/cx-common-js-client",
"version": "0.1.87",
"version": "0.1.88",
"description": "Client for interaction with Checkmarx products.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/dto/scanConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface ScanConfig {
scaConfig?: ScaConfig;
proxyConfig?: ProxyConfig;
version?: string;
originName?: string;
}
15 changes: 10 additions & 5 deletions src/services/clients/cxClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ export class CxClient {
sastProxyConfig.proxyUrl = this.proxyConfig.sastProxyUrl != '' ? this.proxyConfig.sastProxyUrl : this.proxyConfig.proxyUrl;
sastProxyConfig.sastProxyUrl = '';
sastProxyConfig.scaProxyUrl = '';
this.httpClient = new HttpClient(baseUrl, this.config.cxOrigin, this.config.cxOriginUrl, this.log, sastProxyConfig, this.sastConfig.cacert_chainFilePath,this.config.version);
this.httpClient = new HttpClient(baseUrl,this.config.originName ? this.config.originName : this.config.cxOrigin, this.config.cxOriginUrl, this.log, sastProxyConfig, this.sastConfig.cacert_chainFilePath,this.config.version);
}
else
{
this.httpClient = new HttpClient(baseUrl, this.config.cxOrigin, this.config.cxOriginUrl, this.log, undefined, this.sastConfig.cacert_chainFilePath,this.config.version);
this.httpClient = new HttpClient(baseUrl, this.config.originName ? this.config.originName : this.config.cxOrigin, this.config.cxOriginUrl, this.log, undefined, this.sastConfig.cacert_chainFilePath,this.config.version);
}
await this.httpClient.getPacProxyResolve();
await this.httpClient.login(this.sastConfig.username, this.sastConfig.password);
Expand All @@ -174,11 +174,11 @@ export class CxClient {
scaProxyConfig.sastProxyUrl = '';
scaProxyConfig.scaProxyUrl = '';
this.log.info("Overriten URL "+this.config.proxyConfig.sastProxyUrl);
scaHttpClient = new HttpClient(this.scaConfig.apiUrl, this.config.cxOrigin, this.config.cxOriginUrl,this.log, scaProxyConfig, this.scaConfig.cacert_chainFilePath,this.config.version);
scaHttpClient = new HttpClient(this.scaConfig.apiUrl, this.config.originName ? this.config.originName : this.config.cxOrigin, this.config.cxOriginUrl,this.log, scaProxyConfig, this.scaConfig.cacert_chainFilePath,this.config.version);
}
else
{
scaHttpClient = new HttpClient(this.scaConfig.apiUrl, this.config.cxOrigin, this.config.cxOriginUrl,this.log, undefined, this.scaConfig.cacert_chainFilePath,this.config.version);
scaHttpClient = new HttpClient(this.scaConfig.apiUrl, this.config.originName ? this.config.originName : this.config.cxOrigin, this.config.cxOriginUrl,this.log, undefined, this.scaConfig.cacert_chainFilePath,this.config.version);
}
await scaHttpClient.getPacProxyResolve();
this.scaClient = new ScaClient(this.scaConfig, this.config.sourceLocation, scaHttpClient, this.log,scaProxyConfig, this.config);
Expand Down Expand Up @@ -682,11 +682,16 @@ Scan results location: ${result.sastScanResultsLink}
JSON.stringify({
name: query.$.name,
severity: query.$.Severity,
resultLength: query.Result.length
resultLength: this.getQueryResultCount(query.Result)
})
).join(SEPARATOR);
}

private static getQueryResultCount(Result: any[])
{
return Result.length > 0 ? Result.filter( (queryResult ) => queryResult.$['state'] !== '1').length : 0;
}

private static getNewVulnerabilityCounts(scanResult: ScanResults, queries: any[]) {
var results, severity;
if(queries == undefined || queries.length == 0)
Expand Down
4 changes: 2 additions & 2 deletions src/services/clients/scaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ The Build Failed for the Following Reasons:
projectCustomTagObj = this.normalizeTags(this.config.projectCustomTags);
let projectId = this.projectId;
let path = ScaClient.PROJECTS + `/${projectId}`;
const teamName = this.config.scaSastTeam;
let teamNameArray: Array<string | undefined> = [teamName];
let teamName = this.config.scaSastTeam.trim();
let teamNameArray: Array<string | undefined> = (teamName != null && teamName != "" && teamName != '/') ? [teamName] : [];
const request = {
name: this.scanConfig.projectName,
AssignedTeams: teamNameArray,
Expand Down

0 comments on commit 134f857

Please sign in to comment.