Skip to content

Commit

Permalink
ASA-6905 & ASA-4814 (#177)
Browse files Browse the repository at this point in the history
ASA-6905 & ASA-4814
  • Loading branch information
vishalhcl-5960 authored Oct 30, 2023
1 parent a0647f1 commit 9ad2a32
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ public String getType() {
return DYNAMIC_ANALYZER;
}

@Override
public String getScanMethod() {
return "";
}

public String isLoginTypes(String loginTypeName) {
if (m_loginType != null) {
return m_loginType.equalsIgnoreCase(loginTypeName) ? "true" : "";
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/com/hcl/appscan/jenkins/plugin/scanners/Scanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.hcl.appscan.jenkins.plugin.scanners;

import com.hcl.appscan.sdk.CoreConstants;
import hudson.AbortException;
import hudson.Util;
import hudson.model.AbstractDescribableImpl;
Expand All @@ -28,16 +29,21 @@ public Scanner(String target, boolean hasOptions) {
m_target = target;
m_hasOptions = hasOptions;
}

public boolean getHasOptions() {

public boolean getHasOptions() {
if(getScanMethod().equals(CoreConstants.UPLOAD_DIRECT)){
return false;
}
return m_hasOptions;
}

public String getTarget() {
return m_target;
}

public abstract Map<String, String> getProperties(VariableResolver<String> resolver) throws AbortException;

public abstract String getScanMethod();

public abstract Map<String, String> getProperties(VariableResolver<String> resolver) throws AbortException;

public abstract String getType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,17 @@ public StaticAnalyzer(String target,boolean hasOptions) {
public String getType() {
return STATIC_ANALYZER;
}

public boolean isAdditionalOptions(){
return getHasOptions();
}

@DataBoundSetter
public void setScanSpeed(String scanSpeed) {
m_scanSpeed = scanSpeed;
}

public String getScanSpeed() {
return m_scanSpeed;
if(!m_scanMethod.equals(CoreConstants.UPLOAD_DIRECT)){
return m_scanSpeed;
}
return "";
}

public String checkScanSpeed(String scanSpeed) {
Expand All @@ -80,7 +79,10 @@ public String checkScanSpeed(String scanSpeed) {
}

public boolean isOpenSourceOnly() {
return m_openSourceOnly;
if(!m_scanMethod.equals(CoreConstants.UPLOAD_DIRECT)){
return m_openSourceOnly;
}
return false;
}

@DataBoundSetter
Expand All @@ -89,7 +91,10 @@ public void setOpenSourceOnly(boolean openSourceOnly) {
}

public boolean isSourceCodeOnly() {
return m_sourceCodeOnly;
if(!m_scanMethod.equals(CoreConstants.UPLOAD_DIRECT)){
return m_sourceCodeOnly;
}
return false;
}

@DataBoundSetter
Expand All @@ -102,6 +107,7 @@ public void setScanMethod(String scanMethod) {
m_scanMethod =scanMethod;
}

@Override
public String getScanMethod() {
return m_scanMethod;
}
Expand All @@ -113,18 +119,20 @@ public boolean isScanMethod(String scanMethod) {
public Map<String, String> getProperties(VariableResolver<String> resolver) {
Map<String, String> properties = new HashMap<String, String>();
properties.put(TARGET, resolver == null ? getTarget() : resolvePath(getTarget(), resolver));
if (m_openSourceOnly && getHasOptions()) {
properties.put(CoreConstants.OPEN_SOURCE_ONLY, "");
}
if (m_sourceCodeOnly && getHasOptions()) {
properties.put(CoreConstants.SOURCE_CODE_ONLY, "");
}
if (m_scanMethod != null && m_scanMethod.equals(CoreConstants.UPLOAD_DIRECT)) {
properties.put(CoreConstants.UPLOAD_DIRECT, "");
}
if(m_scanSpeed!=null && !m_scanSpeed.isEmpty() && getHasOptions()) {
properties.put(SCAN_SPEED, m_scanSpeed);
}
if (m_scanMethod != null && m_scanMethod.equals(CoreConstants.UPLOAD_DIRECT)) {
properties.put(CoreConstants.UPLOAD_DIRECT, "");
}
if(!properties.containsKey(CoreConstants.UPLOAD_DIRECT)){
if (m_openSourceOnly && getHasOptions()) {
properties.put(CoreConstants.OPEN_SOURCE_ONLY, "");
}
if (m_sourceCodeOnly && getHasOptions()) {
properties.put(CoreConstants.SOURCE_CODE_ONLY, "");
}
if(m_scanSpeed!=null && !m_scanSpeed.isEmpty() && getHasOptions()) {
properties.put(SCAN_SPEED, m_scanSpeed);
}
}
return properties;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#NLS_MESSAGEFORMAT_ALL
#NLS_ENCODING=UTF8

description.traffic.file=Provide a path to the login sequence file data. We can use Jenkins built-in variables or user defined variables to define the path. <br/><br/> Examples: <br/> <b>\u2022</b> C:\\UserName\\documents\\windows\\recorded\\ValidFileLogin.dast.config <br/> <b>\u2022</b> \/home\/userName\/documents\/linux\/recorded\/ValidFileLogin.dast.config <br/> <b>\u2022</b> \$'{'WORKSPACE'}'\\recorded\\ValidFileLogin.dast.config <br/> <b>\u2022</b> ValidFileLogin.dast.config <br/><br/> Location of the file by default will be \$'{'WORKSPACE'}' if not explicitly mentioned. <br/><br/> Supported file type: <b>CONFIG:</b> AppScan Activity Recorder file.<br/><br/> <b>How to record login?</b><br/>To use the AppScan Activity Recorder extension (for chrome or Edge):<br/><br/> 1. Install <a target="_blank" href="https://chrome.google.com/webstore/detail/appscan-activity-recorder/ijbfdoojnepibegmkhhilmeijonibmcn?hl=en%E2%80%8B">AppScan Activity Recorder </a>. <br/> 2. Open a new tab, enter the starting URL.<br/> 3. Click the extension icon, and record your login sequence.<br/> Note: You must be logged out of the application before you start the recording.<br/> 4. When finished, click the extension icon again, to stop the recording. You will be prompted to save the CONFIG file.<br/> 5. Add the full path for the Config file under the login sequence.<br/><br/> <a target="_blank" href="https://help.hcltechsw.com/appscan/ASoC/r_record_traffic.html">Learn more </a>
description.traffic.file=Provide the path to the login sequence file data. We can use Jenkins built-in variables or user defined variables to define the path. <br/><br/> Examples: <br/> <b>\u2022</b> C:\\UserName\\documents\\windows\\recorded\\ValidFileLogin.dast.config <br/> <b>\u2022</b> \/home\/userName\/documents\/linux\/recorded\/ValidFileLogin.dast.config <br/> <b>\u2022</b> \$'{'WORKSPACE'}'\\recorded\\ValidFileLogin.dast.config <br/> <b>\u2022</b> ValidFileLogin.dast.config <br/><br/> Location of the file by default will be \$'{'WORKSPACE'}' if not explicitly mentioned. <br/><br/> Supported file type: <b>CONFIG:</b> AppScan Activity Recorder file.<br/><br/> <b>How to record login?</b><br/>To use the AppScan Activity Recorder extension (for chrome or Edge):<br/><br/> 1. Install <a target="_blank" href="https://chrome.google.com/webstore/detail/appscan-activity-recorder/ijbfdoojnepibegmkhhilmeijonibmcn?hl=en%E2%80%8B">AppScan Activity Recorder </a>. <br/> 2. Open a new tab, enter the starting URL.<br/> 3. Click the extension icon, and record your login sequence.<br/> Note: You must be logged out of the application before you start the recording.<br/> 4. When finished, click the extension icon again, to stop the recording. You will be prompted to save the CONFIG file.<br/> 5. Add the full path for the Config file under the login sequence.<br/><br/> <a target="_blank" href="https://help.hcltechsw.com/appscan/ASoC/r_record_traffic.html">Learn more </a>
2 changes: 1 addition & 1 deletion src/main/webapp/help/loginAutomatic.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div>
Select this option to allow Login to the application using a username and password. Once selected, you would be prompted to enter the username and password.
Select this option to allow login to the application using a username and password. Once selected, you would be prompted to enter the username and password.
</div>

0 comments on commit 9ad2a32

Please sign in to comment.