Zed Attack Proxy (ZAP) Scanner Reference
Zed Attack Proxy (ZAP) is a free, open-source penetration tool for testing web applications. ZAP runs as a “man-in-the-middle proxy” between the tester’s browser and the web app. You can use ZAP to run penetration testing to simulate a malicious external attack and use the results to protect your app from unauthorized access and denial-of-service attacks.
Zap step configuration
The recommended workflow is add a ZAP step to a Security Tests or CI Build stage and then configure it as described below. You can also configure ZAP scans programmatically by copying, pasting, and editing the YAML definition.
- UI configuration support is currently limited to the following scanners: Aqua Trivy, Bandit, Black Duck, Checkmarx, Grype, Mend, Prisma Cloud, Snyk, SonarQube, and ZAP.
- Each step palette shows only the options that apply to a specific scan. If you're setting up a repository scan, for example, the UI won't show Container Image settings.
- Docker-in-Docker is not required for these steps unless you're scanning a container image. If you're scanning a repository using Bandit, for example, you don't need to set up a Background step running DinD.
- Support is currently limited to Kubernetes and Harness Cloud AMD64 build infrastructures only.
The orchestration mode to use for the scan. The following list includes the UI and YAML values for the supported options.
- Orchestrated A fully-orchestrated scan. A Security step in the Harness pipeline orchestrates a scan and then normalizes and compresses the results.
- Ingestion Ingestion scans are not orchestrated. The Security step ingest results from a previous scan (for a scan run in an previous step) and then normallizes and compresses the results.
The predefined configuration to use for the scan. All scan steps have at least one configuration.
The following options are supported for Zap scans:
- Standard —
- Attack —
- Quick —
- Instance Scan a running application.
The Identifier that you want to assign to the target you’re scanning in the pipeline. Use a unique, descriptive name such as
An identifier for a specific target to scan, such as the branch name or image tag. This identifier is used to differentiate or group results for a target. Harness maintains a historical trend for each variant.
The workspace path on the pod running the Security step. The workspace path is
/harness by default.
You can override this if you want to scan only a subset of the workspace. For example, suppose the pipeline publishes artifacts to a specific subfolder. You can specify the workspace path as
The results data file to use when running an Ingestion scan. Generally an Ingestion scan consists of a scan step (to generate the data file) and an ingestion step (to ingest the data file).
Domain of the application instance to scan. You can include the full path to the app in this field, or split the full path between the Domain and the Path fields. Example:
HTTPS (default) or HTTP.
The TCP port used by the scanned app instance.
Path to append to the application instance domain, if you're splitting the full path between the Domain and Path settings. For example, you might specify the domain as
https://myapp.io and the path as
Log Level, CLI flags, and Fail on Severity
The minimum severity of the messages you want to include in your scan logs. You can specify one of the following:
Additional CLI flags
You can use this field to customize the scan with specific command-line arguments supported by that scanner.
Fail on Severity
Every Security step has a Fail on Severity setting. If the scan finds any vulnerability with the specified severity level or higher, the pipeline fails. It is good practice to include this setting in every Security step in an integrated pipeline. You can specify one of the following:
NONE— Do not fail on severity
The YAML definition looks like this:
fail_on_severity : critical # | high | medium | low | info | none
In the Additional Configuration settings, you can use the following options:
In the Advanced settings, you can use the following options:
Security step configuration (deprecated)
Set up a ZAP scan in a Security step
Scan policy types
STO supports the following scan policy types for ZAP:
orchestratedScan— A Security step in the pipeline runs the scan and ingests the results. This is easier to set up and supports scans with default or predefined settings.
ingestionOnly— Run the scan in a Run step, or outside the pipeline, and then ingest the results. This is useful for advanced workflows that address specific security needs. See Ingest scan results into an STO pipeline.
product_config_name— Specify one of the following:
standard(scanMode = active, scanType = standard)
attack(scanMode = active, scanType = attack)
quick(scanMode = active, scanType = standard, quickMode = true)
instance_identifier— The target Id that will appear in the Test Targets page of the Harness UI.
instance_environment— The instance environment, such as
instance_domain— The app domain to scan, for example
instance_protocol— The protocol of the site to scan. Generally this is
fail_on_severity- See Fail on Severity.
instance_path— Specify if the app URL includes a path beyond the domain. If you want to scan
https://app.my-domain.com/myModule/myApp, the instance path is
instance_port— Specify if the site is accessed using a non-default port.
The following YAML pipeline includes example stages for scanning a repository (Bandit step), an image (AquaTrivy step), and an app (ZAP step).
If you want to set up scan steps programmatically using YAML, the best practice is to set up your step in a pipeline using the Visual Editor and then copy, paste, and edit the YAML definition.