I am trying to automate zap tasks into my build process. Here is what I do:
- run zap
- run selenium tests
- run zap spider
- run zap activeScan
- save zap session
- run zap alert check and report it
- end zap
And here is the target of my ant build.xml :
<SpiderURL zapAddress="${zapaddr}" zapPort="${zapport}" url="${targetHost}" debug="true"/>
<sleep seconds="5"/>
<ActiveScanSite zapAddress="${zapaddr}" zapPort="${zapport}" url="${targetHost}" debug="true"/>
<sleep seconds="5"/>
<tstamp>
<format property="timestamp" pattern="MM-dd-yyyy HH-mm-ss"/>
</tstamp>
<SaveZAPSession zapAddress="${zapaddr}" zapPort="${zapport}" name="${user.dir}/test ${timestamp}" debug="true"/>
<record name="Report.txt" action="start" append="true" />
<alertCheckTask zapAddress="${zapaddr}" zapPort="${zapport}" debug="false">
<ignoreAlert risk="Low" />
<ignoreAlert risk="Medium" />
<requirealert alert="Cross Site Scripting (Reflected)" />
</alertCheckTask>
<record name="Report.txt" action="stop" />
The problem is : The active scan is not finished and it get interrupted by the next task (save zap session), which means the reported alerts are also not covering all the active scan result.