Skip to content

Commit

Permalink
Remove the OSO check from SDK (#121)
Browse files Browse the repository at this point in the history
* SCA support
* remove the check for OSO from SDK
  • Loading branch information
vishalhcl-5960 authored Nov 16, 2023
1 parent 8e8c9e3 commit 60f90f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/hcl/appscan/sdk/CoreConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ 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 WARNING_SCA = "warning.sca"; //$NON-NLS-1$
String FORMAT_PARAMS = "FormatParams"; //$NON-NLS-1$

// ASE Status Messages
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/hcl/appscan/sdk/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ error.http=Response Code: {0}\nReason: {1}
error.login.type.deprectated=The specified login type is deprecated. Please use API key and secret.
error.getting.info=An error occurred getting information for {0} with id {1}.
error.url.validation = An error occurred while validating the URL.
warning.sca = Note: To scan open-source files, use the Software Composition Analysis (SCA) scan type. AppScan on Cloud is phasing out open source-only scanning with static analysis scans.

#Presence
error.getting.presence.details=An error occurred retrieving details for Presence with id {0}.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/hcl/appscan/sdk/scanners/sast/SASTScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ public void run() throws ScannerException, InvalidTargetException {
if(target == null || !(new File(target).exists()))
throw new InvalidTargetException(Messages.getMessage(TARGET_INVALID, target));

if (getProperties().containsKey(OPEN_SOURCE_ONLY)){
getProgress().setStatus(new Message(Message.WARNING, Messages.getMessage(CoreConstants.WARNING_SCA)));
}

try {
if(getProperties().containsKey(CoreConstants.UPLOAD_DIRECT)){
generateZip();
Expand Down Expand Up @@ -113,7 +109,7 @@ private void generateZip() throws IOException,ScannerException {
throw new ScannerException(Messages.getMessage(ERROR_GENERATING_ZIP, getScanLogs().getAbsolutePath()));
}

private void analyzeIR() throws IOException, ScannerException {
protected void analyzeIR() throws IOException, ScannerException {
if(getProperties().containsKey(PREPARE_ONLY))
return;

Expand All @@ -122,9 +118,13 @@ private void analyzeIR() throws IOException, ScannerException {
throw new ScannerException(Messages.getMessage(ERROR_FILE_UPLOAD, m_irx.getName()));

Map<String, String> params = getProperties();
params.put(ARSA_FILE_ID, fileId);

setScanId(getServiceProvider().createAndExecuteScan(STATIC_ANALYZER, params));
params.put(FILE_ID, fileId);

if(getType().equals(CoreConstants.SOFTWARE_COMPOSITION_ANALYZER)) {
setScanId(getServiceProvider().createAndExecuteScan(CoreConstants.SCA, params));
} else {
setScanId(getServiceProvider().createAndExecuteScan(STATIC_ANALYZER, params));
}
if(getScanId() == null)
throw new ScannerException(Messages.getMessage(ERROR_SUBMITTING_IRX));
}
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/com/hcl/appscan/sdk/scanners/sca/SCAScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,4 @@ public void run() throws ScannerException, InvalidTargetException {
public String getType() {
return CoreConstants.SOFTWARE_COMPOSITION_ANALYZER;
}

private void analyzeIR() throws IOException, ScannerException {
if(getProperties().containsKey(PREPARE_ONLY))
return;

String fileId = getServiceProvider().submitFile(getIrx());
if(fileId == null)
throw new ScannerException(Messages.getMessage(ERROR_FILE_UPLOAD, getIrx().getName()));

Map<String, String> params = getProperties();
params.put(FILE_ID, fileId);
setScanId(getServiceProvider().createAndExecuteScan(CoreConstants.SCA, params));
if(getScanId() == null)
throw new ScannerException(Messages.getMessage(ERROR_SUBMITTING_IRX));
}
}

0 comments on commit 60f90f5

Please sign in to comment.