diff --git a/src/main/java/com/hcl/appscan/sdk/scanners/sast/SAClient.java b/src/main/java/com/hcl/appscan/sdk/scanners/sast/SAClient.java index da7c92f0..e341455d 100644 --- a/src/main/java/com/hcl/appscan/sdk/scanners/sast/SAClient.java +++ b/src/main/java/com/hcl/appscan/sdk/scanners/sast/SAClient.java @@ -1,6 +1,6 @@ /** * © Copyright IBM Corporation 2016. - * © Copyright HCL Technologies Ltd. 2017, 2022, 2023. + * © Copyright HCL Technologies Ltd. 2017, 2024. * LICENSE: Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 */ @@ -320,36 +320,42 @@ private List getClientArgs(Map properties) { args.add(OPT_CONFIG); args.add(properties.get(CONFIG_FILE)); } - if(properties.containsKey(DEBUG) || System.getProperty(DEBUG.toUpperCase()) != null) + if(properties.containsKey(DEBUG) || System.getProperty(DEBUG.toUpperCase()) != null) { args.add(OPT_DEBUG); - if(properties.containsKey(VERBOSE)) + } + if(properties.containsKey(VERBOSE)) { args.add(OPT_VERBOSE); - if(properties.containsKey(THIRD_PARTY) || System.getProperty(THIRD_PARTY) != null) + } + if(properties.containsKey(THIRD_PARTY) || System.getProperty(THIRD_PARTY) != null) { args.add(OPT_THIRD_PARTY); - if (properties.containsKey(OPEN_SOURCE_ONLY) || System.getProperty(OPEN_SOURCE_ONLY) != null || properties.get(CoreConstants.SCANNER_TYPE).equals(CoreConstants.SOFTWARE_COMPOSITION_ANALYZER)) + } + if (properties.containsKey(OPEN_SOURCE_ONLY) || System.getProperty(OPEN_SOURCE_ONLY) != null || properties.getOrDefault(CoreConstants.SCANNER_TYPE, "").equals(CoreConstants.SOFTWARE_COMPOSITION_ANALYZER)) { args.add(OPT_OPEN_SOURCE_ONLY); - if (properties.containsKey(SOURCE_CODE_ONLY) || System.getProperty(SOURCE_CODE_ONLY) != null) - args.add(OPT_SOURCE_CODE_ONLY); - if(properties.containsKey(SCAN_SPEED)){ - args.add(OPT_SCAN_SPEED); - if(properties.containsKey(SECRETS_ENABLED) || System.getProperty(SECRETS_ENABLED) != null) + } + if (properties.containsKey(SOURCE_CODE_ONLY) || System.getProperty(SOURCE_CODE_ONLY) != null) { + args.add(OPT_SOURCE_CODE_ONLY); + } + if(properties.containsKey(SCAN_SPEED)) { + args.add(OPT_SCAN_SPEED); + if(properties.get(SCAN_SPEED).equals(NORMAL)){ + args.add(THOROUGH); + } else if (properties.get(SCAN_SPEED).equals(FAST)) { + args.add(DEEP); + } else if (properties.get(SCAN_SPEED).equals(FASTER)) { + args.add(BALANCED); + } else if (properties.get(SCAN_SPEED).equals(FASTEST)) { + args.add(SIMPLE); + } else { + args.add(properties.get(SCAN_SPEED)); + } + } + if(properties.containsKey(SECRETS_ENABLED) || System.getProperty(SECRETS_ENABLED) != null) { args.add(OPT_SECRETS_ENABLED); - if(properties.containsKey(SECRETS_ONLY) || System.getProperty(SECRETS_ONLY) != null) + } + if(properties.containsKey(SECRETS_ONLY) || System.getProperty(SECRETS_ONLY) != null) { args.add(OPT_SECRETS_ONLY); - //it is being used to have the same values in the freestyle & pipeline projects - if(properties.get(SCAN_SPEED).equals(NORMAL)){ - args.add(THOROUGH); - } else if (properties.get(SCAN_SPEED).equals(FAST)) { - args.add(DEEP); - } else if (properties.get(SCAN_SPEED).equals(FASTER)) { - args.add(BALANCED); - } else if (properties.get(SCAN_SPEED).equals(FASTEST)) { - args.add(SIMPLE); - } else { - args.add(properties.get(SCAN_SPEED)); - } - } - + } + return args; }