From 5a3c49fe676b0200b8556c107541aba950e13fb0 Mon Sep 17 00:00:00 2001 From: Vishal Chaudhary Date: Mon, 26 Feb 2024 19:02:15 +0530 Subject: [PATCH] ASA-8093 Handled the URL encoding issue with staging & A360 environment. --- .../com/hcl/appscan/sdk/results/CloudResultsProvider.java | 3 ++- .../com/hcl/appscan/sdk/scan/CloudScanServiceProvider.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hcl/appscan/sdk/results/CloudResultsProvider.java b/src/main/java/com/hcl/appscan/sdk/results/CloudResultsProvider.java index e5a028a3..01d15344 100644 --- a/src/main/java/com/hcl/appscan/sdk/results/CloudResultsProvider.java +++ b/src/main/java/com/hcl/appscan/sdk/results/CloudResultsProvider.java @@ -225,7 +225,8 @@ protected String getReportStatus(String reportId) throws IOException, JSONExcept } String request_url = authProvider.getServer() + API_REPORT_STATUS; - request_url += String.format("?$top=100&$filter=Id eq %s&$count=false",reportId); + String query = ("?%24top=100&%24filter=Id eq "+reportId+"&%24count=false").replaceAll(" ","%20"); + request_url += query; Map request_headers = authProvider.getAuthorizationHeader(true); request_headers.put(CONTENT_LENGTH, "0"); //$NON-NLS-1$ diff --git a/src/main/java/com/hcl/appscan/sdk/scan/CloudScanServiceProvider.java b/src/main/java/com/hcl/appscan/sdk/scan/CloudScanServiceProvider.java index d4a49ab5..16510066 100644 --- a/src/main/java/com/hcl/appscan/sdk/scan/CloudScanServiceProvider.java +++ b/src/main/java/com/hcl/appscan/sdk/scan/CloudScanServiceProvider.java @@ -137,7 +137,8 @@ public JSONObject getScanDetails(String scanId) throws IOException, JSONExceptio return null; String request_url = m_authProvider.getServer() + API_BASIC_DETAILS; - request_url +=String.format("?$filter=Id eq %s",scanId); + String query = ("?$filter=Id eq "+scanId).replaceAll(" ", "%20"); + request_url += query; Map request_headers = m_authProvider.getAuthorizationHeader(true); HttpClient client = new HttpClient(m_authProvider.getProxy(), m_authProvider.getacceptInvalidCerts()); @@ -179,7 +180,8 @@ public JSONArray getNonCompliantIssues(String scanId) throws IOException, JSONEx return null; String request_url = m_authProvider.getServer() + String.format(API_ISSUES_COUNT, "Scan", scanId); - request_url +="?$apply=groupby((Severity),aggregate($count as N))"; + String query = "?applyPolicies=All&%24apply=groupby%28%28Severity%29%2Caggregate%28%24count%20as%20N%29%29"; + request_url += query; Map request_headers = m_authProvider.getAuthorizationHeader(true); request_headers.put("Content-Type", "application/json; charset=UTF-8"); request_headers.put("Accept", "application/json");