Skip to content

Commit

Permalink
ASA 8329 (#208)
Browse files Browse the repository at this point in the history
personal scan support
  • Loading branch information
vishalhcl-5960 authored Apr 3, 2024
1 parent e02084d commit c56d369
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class AppScanBuildStep extends Builder implements SimpleBuildStep, Serial
private String m_credentials;
private List<FailureCondition> m_failureConditions;
private boolean m_emailNotification;
private boolean m_personalScan;
private boolean m_intervention;
private boolean m_wait;
private boolean m_failBuildNonCompliance;
Expand All @@ -103,7 +104,7 @@ public class AppScanBuildStep extends Builder implements SimpleBuildStep, Serial
private static final File JENKINS_INSTALL_DIR=new File(System.getProperty("user.dir"),".appscan");//$NON-NLS-1$ //$NON-NLS-2$

@Deprecated
public AppScanBuildStep(Scanner scanner, String name, String type, String target, String application, String credentials, List<FailureCondition> failureConditions, boolean failBuildNonCompliance, boolean failBuild, boolean wait, boolean email, boolean intervention) {
public AppScanBuildStep(Scanner scanner, String name, String type, String target, String application, String credentials, List<FailureCondition> failureConditions, boolean failBuildNonCompliance, boolean failBuild, boolean wait, boolean email, boolean personalScan, boolean intervention) {
m_scanner = scanner;
m_name = (name == null || name.trim().equals("")) ? application.replaceAll(" ", "") + ThreadLocalRandom.current().nextInt(0, 10000) : name; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
m_type = scanner.getType();
Expand All @@ -112,6 +113,7 @@ public AppScanBuildStep(Scanner scanner, String name, String type, String target
m_credentials = credentials;
m_failureConditions = failureConditions;
m_emailNotification = email;
m_personalScan = personalScan;
m_intervention = intervention;
m_wait = wait;
m_failBuildNonCompliance=failBuildNonCompliance;
Expand All @@ -127,6 +129,7 @@ public AppScanBuildStep(Scanner scanner, String name, String type, String applic
m_application = application;
m_credentials = credentials;
m_emailNotification = false;
m_personalScan = false;
m_intervention = true;
m_wait = false;
m_failBuildNonCompliance=false;
Expand Down Expand Up @@ -217,6 +220,15 @@ public void setEmail(boolean emailNotification) {
public boolean getEmail() {
return m_emailNotification;
}

@DataBoundSetter
public void setPersonalScan(boolean personalScan) {
m_personalScan = personalScan;
}

public boolean getPersonalScan() {
return m_personalScan;
}

@Override
public DescriptorImpl getDescriptor() {
Expand Down Expand Up @@ -258,6 +270,7 @@ private Map<String, String> getScanProperties(Run<?,?> build, TaskListener liste
properties.put(CoreConstants.APP_ID, m_application);
properties.put(CoreConstants.SCAN_NAME, resolver == null ? m_name : Util.replaceMacro(m_name, resolver) + "_" + SystemUtil.getTimeStamp()); //$NON-NLS-1$
properties.put(CoreConstants.EMAIL_NOTIFICATION, Boolean.toString(m_emailNotification));
properties.put(CoreConstants.PERSONAL_SCAN, Boolean.toString(m_personalScan));
properties.put("FullyAutomatic", Boolean.toString(!m_intervention));
properties.put("APPSCAN_IRGEN_CLIENT", "Jenkins");
properties.put("APPSCAN_CLIENT_VERSION", Jenkins.VERSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ LICENSE: Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0
<f:entry field="email">
<f:checkbox title="${%label.email}"/>
</f:entry>

<f:entry field="personalScan">
<f:checkbox title="${%label.personalScan}"/>
</f:entry>

<f:entry field="intervention">
<f:checkbox title="${%label.intervention}" default="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ label.application=Application
label.name=Test Name
label.type=Test Type
label.email=Email Notification
label.personalScan=Run as a personal scan
label.intervention=Allow intervention by scan enablement team
label.wait=Suspend job until security analysis completes
label.fail.build=Fail build if:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?jelly escape-by-default='true'?>
<div>
${%description.personal.scan}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#NLS_MESSAGEFORMAT_ALL
#NLS_ENCODING=UTF8

description.personal.scan=A personal scan does not affect the application data and compliance until it is promoted. If not promoted it is deleted after 30 days.<br/> <a target="_blank" href="https://help.hcltechsw.com/appscan/ASoC/appseccloud_scans_personal.html">Learn more </a>

0 comments on commit c56d369

Please sign in to comment.