htmlreport to get a final report of the Passive Scanner. This works fine, but I would like to also use the Active Scanner. Using the Active Scanner in CI is mentioned several times in ZAP's documentation, but haven't found any working example or tutorial about it... does any exist?What I would like to achieve is something like: Run Active Scanner on all the pages visited by the Selenium regression suite, once it is finished to run.
Trying to look at ZAP's REST api, but is mostly undocumented:
https://github.com/zaproxy/zaproxy/wiki/ApiGen_Index
Ideally, it would be great to have something like:
In the REST api it seems there is something related, but:
ascan/scan needs an url as input. Could call core/urls to see what the Selenium tests have visited, but then how to set the right authentication (logging credential)? What if the order in which the urls are visited is important? What if a page is only accessable with a specific credential?ascan/scanAsUser, but it is unclear how contextId and userId can be retrieved from ZAP. A cumbersome workaround would be to modify the Selenium tests to write on disk the urls they visit and which logging/password credentials they are using, and then, once all tests are finished, to read from disk such info to call ZAP. Is there any simpler way?OK, so theres a lot of questions here:)
ZAP typically scans hierarchies of URLs, eg everything under https://www.example.com/app the top level url of your application. We kind of assume you know what that will be ;)
Authentication is non trivial to handle, see https://github.com/zaproxy/zaproxy/wiki/FAQformauth
The ascan/status call returns the completed %
You may find the ZAP User Group http://groups.google.com/group/zaproxy-users better for these sort of questions. But yes, we do need to improve the API documentation :/
Cheers,
Simon (ZAP Project Lead)
My (new) comments:
Thanks Simon for the clarification and very quick response. I have still some doubts though.
I do understand that I can use the REST api to directly control the Active Scanner, by providing URL and loggin info. However, my point was on whether ZAP can automatically re-use all information (urls and logging information) of the Selenium tests that were run with ZAP as proxy.
The Getting Started Guide states:
A high level approach could be:
1. Proxy browser based regression tests (eg using Selenium) through ZAP in order to explore
the application in a realistic way
2. Use the spiders to discover content not covered by regression tests
3. Run the active scanner to attack the application
4. Read the alerts found and report any new vulnerabilities
In particular, I thought that point (3) could be automatically run based on the information of the previous two points. At the end of the day, if ZAP was used as a proxy, it could have stored such info (it does for visited urls, but maybe it is not possible for logging credentials?). If it cannot, then that high level approach sketch is a bit misleading: points (1) and (3) would be independent, and one could do (3) before (1), with constraint of doing (4) at the end. Or am I completely misunderstanding it?
cheers
Andrea