The new Automation Framework will in time replace the Command Line and Packaged Scan options. It allows you to control ZAP via one YAML file and provides more flexibility while not being tied to any specific container technology.
The Automation Framework is included with the latest version of ZAP as well as the stable docker image. The framework is plugable and many of the existing add-ons have been enhanced to support it.
The framework is covered in the following ZAP Chat videos:
- ZAP Chat 07 Automation Framework Part 1 An introduction to the framework
- ZAP Chat 08 Automation Framework Part 2 Details on the environment, passiveScan-config job, and alertFilter job
- ZAP Chat 09 Automation Framework Part 3 Details on the requester job and replacer job
- ZAP Chat 10 Automation Framework Part 4 Details on the spider job and spiderAjax job
- ZAP Chat 11 Automation Framework Part 5 Details on the openapi, soap, and graphql jobs
- ZAP Chat 12 Automation Framework Part 6 Details on the passiveScan-wait, delay, and activeScan jobs
- ZAP Chat 16 Automation Framework Part 7 How to configure authentication using auto-detection
Framework Overview
For details of how to get started with the framework see the main framework help page.
The framework supports:
- environment - which defines all of the applications the plan can act on
- Authentication - all of the authentication mechanisms supported by ZAP
- Job Tests - which can be used to validate the outcome of jobs
The full set of jobs currently supported by the framework and other add-ons are:
- activeScan - runs the active scanner
- alertFilter - alert filter configuration, provided with the Alert Filters add-on
- delay - waits for a specified time or until a condition is met
- graphql - GraphQL schema import, provided with the GraphQL add-on
- import - allows you to import HAR(HTTP Archive File), ModSecurity2 Logs, ZAP Messages or a file containing URLs locally
- openapi - OpenAPI definition import, provided with the OpenAPI add-on
- passiveScan-config - passive scan configuration
- passiveScan-wait - waits for the passive scanner to finish processing the current queue
- postman - Postman definition import, provided with the Postman add-on
- replacer - replace strings in requests and responses
- report - report generation, provided with the Report Generation add-on
- requestor - sends specific requests to targets
- script - adds, removes and runs scripts
- soap - SOAP WSDL import, provided with the SOAP add-on
- spider - runs the traditional spider
- spiderAjax - runs the ajax spider, provided with the Ajax Spider add-on
For details of future changes planned see the tracker issue.
Updating Add-ons
The addOns job has been found to cause problems when updating add-ons which are defined in the current plan. This job has been depreciated and no longer does anything.
From 2.12 you can use the standard ZAP command line
options with the AF -autorun
option:
-addoninstall <addOnId>
to install an add-on-addonuninstall <addOnId>
to uninstall an add-on-addonupdate
to update all add-ons
You can use -addoninstall
and -addonuninstall
as many times as you need:
./zap.sh -addonupdate\
-addoninstall example-1 \
-addoninstall example-2 \
-addonuninstall example-3 \
-cmd -autorun zap.yaml <any other ZAP options>
Exit Value
If you run the framework from the command line then ZAP will exit with:
- 0: The plan ran without any problems reported
- 1: The plan failed with an error
- 2: The plan ran but there were warnings
The framework will exit with 2
if there are warnings even if the environment failOnWarning
parameter is set to false
.
If you need ZAP to exit with 0
in this case then you can run ZAP with a Linux / macOS command line like:
bash -c "./zap.sh -cmd -autorun /path/to/your/af-plan.yaml" || [ $? -ne 1 ]