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

ASA 8392 #155

Merged
merged 10 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions src/main/java/com/hcl/appscan/sdk/CoreConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public interface CoreConstants {
String ERROR_UPLOADING_FILE = "error.upload.file"; //$NON-NLS-1$
String ERROR_GETTING_INFO = "error.getting.info"; //$NON-NLS-1$
String ERROR_URL_VALIDATION = "error.url.validation"; //$NON-NLS-1$
String ERROR_URL_DYNAMIC_UNSUPPORTED = "error.url.dynamic.unsupported"; //$NON-NLS-1$
String FORMAT_PARAMS = "FormatParams"; //$NON-NLS-1$

String ERROR_GETTING_SCANLOG = "error.getting.scanlog"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ public interface IAuthenticationProvider {
public Proxy getProxy();

public boolean getacceptInvalidCerts();
public boolean isAppScan360();
}
1 change: 1 addition & 0 deletions src/main/java/com/hcl/appscan/sdk/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ error.login.type.deprectated=The specified login type is deprecated. Please use
error.getting.info=An error occurred getting information for {0} with id {1}.
error.getting.scanlog=An error occurred retrieving the scan log.
error.url.validation = An error occurred while validating the Starting URL: {0}.
error.url.dynamic.unsupported = Either your A360 instance does not support dynamic scans or the starting URL is invalid: {0}.

#Presence
error.getting.presence.details=An error occurred retrieving details for Presence with id {0}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public void run() throws ScannerException, InvalidTargetException {
params.put(STARTING_URL, target);

IAuthenticationProvider authProvider = getServiceProvider().getAuthenticationProvider();
if(params.get(PRESENCE_ID)!=null && params.get(PRESENCE_ID).isEmpty() && !ServiceUtil.isValidUrl(target, authProvider, authProvider.getProxy())) {
if(!params.containsKey(PRESENCE_ID) && !ServiceUtil.isValidUrl(target, authProvider, authProvider.getProxy())) {
if(authProvider.isAppScan360()) {
throw new ScannerException(Messages.getMessage(CoreConstants.ERROR_URL_DYNAMIC_UNSUPPORTED,target));
}
throw new ScannerException(Messages.getMessage(CoreConstants.ERROR_URL_VALIDATION, target));
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/hcl/appscan/sdk/utils/ServiceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public static boolean isValidUrl(String url, IAuthenticationProvider provider, P
JSONObject body = new JSONObject();
body.put(URL, url);

HttpClient client = new HttpClient(proxy);
Map<String,String> requestHeaders= provider.getAuthorizationHeader(false);
requestHeaders.put("Content-Type", "application/json");
HttpClient client = new HttpClient(proxy, provider.getacceptInvalidCerts());
Map<String,String> requestHeaders= provider.getAuthorizationHeader(false);
requestHeaders.put("Content-Type", "application/json");
HttpResponse response = client.post(request_url, requestHeaders, body.toString());

if (response.isSuccess()) {
Expand Down
Loading