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

SDK version update #221

Merged
merged 14 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>com.hcl</groupId>
<artifactId>appscan.sdk</artifactId>
<version>1.1.0</version>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,37 +304,41 @@ private void shouldFailBuild(IResultsProvider provider,Run<?,?> build) throws Ab
throw new AbortException(Messages.error_checking_results(provider.getStatus()));
}
}

private void perform(Run<?,?> build, Launcher launcher, TaskListener listener) throws InterruptedException, IOException {
m_authProvider = new JenkinsAuthenticationProvider(m_credentials, build.getParent().getParent());
final IProgress progress = new ScanProgress(listener);
final boolean suspend = m_wait;
Map<String, String> properties = getScanProperties(build,listener);
String target = properties.get(CoreConstants.TARGET);
final IScan scan = ScanFactory.createScan(properties, progress, m_authProvider);
boolean isAppScan360 = ((JenkinsAuthenticationProvider) m_authProvider).isAppScan360();

private void validations(boolean isAppScan360, Map<String, String> properties, IProgress progress, String target) throws AbortException {
if(isAppScan360) {
if (m_type.equals("Dynamic Analyzer") && properties.containsKey(Scanner.PRESENCE_ID)) {
if (m_type.equals(Scanner.DYNAMIC_ANALYZER) && properties.containsKey(Scanner.PRESENCE_ID)) {
throw new AbortException(Messages.error_presence_AppScan360());
} if (m_type.equals(CoreConstants.SOFTWARE_COMPOSITION_ANALYZER)) {
throw new AbortException(Messages.error_sca_AppScan360());
} if (m_intervention) {
progress.setStatus(new Message(Message.WARNING, Messages.warning_allow_intervention_AppScan360()));
} if (properties.get("openSourceOnly") != null) {
} if (properties.get(CoreConstants.OPEN_SOURCE_ONLY) != null) {
throw new AbortException(Messages.error_sca_AppScan360());
}
} else if (m_authProvider.getacceptInvalidCerts()) {
progress.setStatus(new Message(Message.WARNING, Messages.warning_asoc_certificates()));
}

if (m_type.equals("Static Analyzer") && properties.containsKey(CoreConstants.OPEN_SOURCE_ONLY)) {
if (m_type.equals(Scanner.STATIC_ANALYZER) && properties.containsKey(CoreConstants.OPEN_SOURCE_ONLY)) {
progress.setStatus(new Message(Message.WARNING, Messages.warning_sca()));
}

if(m_type.equals("Dynamic Analyzer") && !properties.containsKey(Scanner.PRESENCE_ID) && !ServiceUtil.isValidUrl(target, m_authProvider, m_authProvider.getProxy())) {
if(!isAppScan360 && m_type.equals(Scanner.DYNAMIC_ANALYZER) && !properties.containsKey(Scanner.PRESENCE_ID) && !ServiceUtil.isValidUrl(target, m_authProvider, m_authProvider.getProxy())) {
throw new AbortException(Messages.error_url_validation(target));
}
}

private void perform(Run<?,?> build, Launcher launcher, TaskListener listener) throws InterruptedException, IOException {
m_authProvider = new JenkinsAuthenticationProvider(m_credentials, build.getParent().getParent());
final IProgress progress = new ScanProgress(listener);
final boolean suspend = m_wait;
Map<String, String> properties = getScanProperties(build,listener);
String target = properties.get(CoreConstants.TARGET);
final IScan scan = ScanFactory.createScan(properties, progress, m_authProvider);
boolean isAppScan360 = ((JenkinsAuthenticationProvider) m_authProvider).isAppScan360();

validations(isAppScan360, properties, progress, target);

IResultsProvider provider = launcher.getChannel().call(new Callable<IResultsProvider, AbortException>() {
private static final long serialVersionUID = 1L;
Expand Down
Loading