From cee035e6bffc7d58988da66f8b995eaaf3597b79 Mon Sep 17 00:00:00 2001 From: ilandn Date: Mon, 6 Jun 2022 19:10:00 -0500 Subject: [PATCH] bugid: 572, 573 CR_by: N/A --- src/services/clients/cxClient.ts | 12 +++++------- src/services/clients/scaClient.ts | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/services/clients/cxClient.ts b/src/services/clients/cxClient.ts index 8aae7dc..e3e37c3 100644 --- a/src/services/clients/cxClient.ts +++ b/src/services/clients/cxClient.ts @@ -128,9 +128,9 @@ export class CxClient { if (!httpClient) { - if (this.config.enableProxy && this.config.proxyConfig && (this.proxyConfig.proxyHost != '' || this.proxyConfig.proxyUrl != '' || this.proxyConfig.sastProxyUrl != '')) + if (this.config.enableProxy && this.config.proxyConfig && this.proxyConfig.sastProxyUrl != '') { - sastProxyConfig.proxyUrl = this.proxyConfig.sastProxyUrl != '' ? this.proxyConfig.sastProxyUrl : this.proxyConfig.proxyUrl; + sastProxyConfig.proxyUrl = this.proxyConfig.sastProxyUrl; sastProxyConfig.sastProxyUrl = ''; sastProxyConfig.scaProxyUrl = ''; this.httpClient = new HttpClient(baseUrl, this.config.cxOrigin, this.config.cxOriginUrl, this.log, sastProxyConfig, this.sastConfig.cacert_chainFilePath); @@ -158,12 +158,10 @@ export class CxClient { let scaHttpClient: HttpClient; let scaProxyConfig = JSON.parse(JSON.stringify(this.config.proxyConfig)); - if (this.config.enableProxy && this.config.proxyConfig && (this.proxyConfig.proxyHost != '' || this.proxyConfig.proxyUrl != '' || this.proxyConfig.scaProxyUrl != '')) + if (this.config.enableProxy && this.config.proxyConfig && this.proxyConfig.scaProxyUrl != '') { - scaProxyConfig.proxyUrl = this.proxyConfig.scaProxyUrl != '' ? this.proxyConfig.scaProxyUrl : this.proxyConfig.proxyUrl; - scaProxyConfig.sastProxyUrl = ''; - scaProxyConfig.scaProxyUrl = ''; - this.log.info("Overriten URL "+this.config.proxyConfig.sastProxyUrl); + scaProxyConfig.proxyUrl = this.proxyConfig.scaProxyUrl; + this.log.info("Overwritten URL " + scaProxyConfig.proxyUrl); scaHttpClient = new HttpClient(this.scaConfig.apiUrl, this.config.cxOrigin, this.config.cxOriginUrl,this.log, scaProxyConfig, this.scaConfig.cacert_chainFilePath); } else diff --git a/src/services/clients/scaClient.ts b/src/services/clients/scaClient.ts index e121d50..84c7fb2 100644 --- a/src/services/clients/scaClient.ts +++ b/src/services/clients/scaClient.ts @@ -401,11 +401,24 @@ export class ScaClient { this.log.debug(`Sending PUT request to ${uploadUrl}`); const child_process = require('child_process'); let command; + + if (this.scanConfig.enableProxy) { + this.log.info(`scanConfig.enableProxy is TRUE`); + } + if (this.proxyConfig){ + this.log.info(`proxyConfig is TRUE`); + this.log.info(`SCA proxy URL: ` + this.proxyConfig.scaProxyUrl); + } + if (this.proxyConfig.scaProxyUrl){ + this.log.info(`proxyConfig.scaProxyUrl is TRUE`); + } + if ( this.scanConfig.enableProxy && this.proxyConfig && this.proxyConfig.scaProxyUrl) { let proxyUrl=ProxyHelper.getFormattedProxy(this.proxyConfig); - command = `curl -x ${proxyUrl} -X PUT -L "${uploadUrl}" -H "Content-Type:" -T "${file}"`; + command = `curl -x ${proxyUrl} -X PUT -L "${uploadUrl}" -H "Content-Type:" -T "${file}" --ssl-no-revoke`; } else { - command = `curl -X PUT -L "${uploadUrl}" -H "Content-Type:" -T "${file}"`; + this.log.info(`No proxy being used to AWS upload`); + command = `curl -X PUT -L "${uploadUrl}" -H "Content-Type:" -T "${file}" --ssl-no-revoke`; } child_process.execSync(command, { stdio: 'pipe' }); }