Let me start with a little context. I am a QA engineer who specializes in automation and from a skill set has the ability to do development work. We have several hundred Selenium tests, but the majority of our testing is around the our APIs. We have mod-security which blocks most attacks before they can even begin. Our application also locks out attacks around bad credentials and uses anti-CSRF measures. Currently we have mod security disabled in the QA environment while I play with ZAP. Ultimately what I think we would like to do is have some sort of nightly automated security testing occur around the web application and possibly around the APIs.
While using ZAP I have found a large set of options and lots of hard to understand data. For instance, the Active Scan tab shows all the various URLs hit but doesn’t show WHAT the tool was trying to test. SQL Injection? XXS? I can’t tell. I try right clicking the grid, but no options seem useful. After several days of working through ZAP and watching youtube videos (thanks Simon Bennetts and others…) I have gotten a scan which scan our entire site, but now if I right click on my login page and choose ‘flag as context’->1 it no longer shows a list of contexts. Awesome. Maybe it is because I set my entire site to the context, but how do I get back to the context UI now?
Really what I want is to not have the UI at all. Ultimately I want a nightly run with no human involved outside of review the results if they change. So I go looking for the Java version of the client software. Hrmm… No up to date maven repo. I guess I can put it in our local repo, but updates won’t get pushed to us nor can I automatically download the source code and documentation. Now that I have it in my repo, it seems to ultimately want to go talking back to the UI. This isn’t terrible, but why can’t I configure ZAP via an API and just run it by an API. Why do I need a ZAP UI application running somewhere in our VM farm playing proxy? That is just another application operations has to maintain and more fragile systems that can go down and break my automation. Even if I run it headless, it won’t get updated like a maven pom file pulling latest would. The OWASP site points to sourceforge (https://code.google.com/p/zaproxy/wiki/ApiDetails ) for the client API and points to a rather outdated https://code.google.com/p/zap-maven-plugin/ (last updated in 2013) for the maven version. Is that right?
Why can’t I just say "ZAP code, go scan this site, with this user, knowing that the login page looks like x, and logout looks like?" in a fluent API without having to use a client-server? I suppose I could pull the entire ZAP repo, but that seems heavy handed and will not provide updates. Then there is the APIs I have which all use HTTP which means at least part of the attack surface is the same as what ZAP covers. I admit I have not investigate this yet, but it seems like ZAP is mostly around web-based applications. With an API it seems like I could at least use the fuzzers built into ZAP. Again, an API seems more useful than a client-server system in my use case.
Am I missing something here? Am I misguided in what I am looking for? Am I an odd use case? I really do appreciate all the work you have done here. I realize maybe I’m an edge case or I have totally missed some important data, but even then I hope my feedback is useful. Thanks,
- JCD
Right now we dont show which rules are responsible for which requests, and you're the first person to ask for that (as far as I can recall).
Can you explain why you want to know that?
Its not that I dont think you need to know, rather I can think of many reasons and it would be helpful to know which one it is as there may be different approaches to getting this info.
For a start, you can use the Scan Progress dialog - this shows the rule currently being run.
You could also run a rule independently to see exactly what it was doing.
If you run ZAP with the -daemon option then it will run headlessly - then the only way to interact with it is via the API. So you dont need the UI at all.
So you can say those things via the REST API.
I'm guessing that isnt fluent enough ;)
Can you give an example of how you would like the API to look?
ZAP has very powerful scripting support - the scripts can access all of the ZAP internals. One option would be to invoke ZAP with a script that invokes the internal calls which the API uses.
Hi Simon,Thanks for the reply. I'll quote the relevant sections to not inline too deeply.Right now we dont show which rules are responsible for which requests, and you're the first person to ask for that (as far as I can recall).Can you explain why you want to know that?Its not that I dont think you need to know, rather I can think of many reasons and it would be helpful to know which one it is as there may be different approaches to getting this info.For a start, you can use the Scan Progress dialog - this shows the rule currently being run.You could also run a rule independently to see exactly what it was doing.Let's say I see a URL that is 'odd' in that I don't know how it was generated. I see the referrer in the request header. That is useful, at least now I know where that URL was found and hit, but I don't know HOW or WHY it got where it did. If it doesn't trigger an existing rule for a failure, I can't see that data. Furthermore, I might want to sort by the rule set just to scan through each rule just to discover what each rule does. I guess I could just wait around while it is testing or select each rule to do the discovery, but that seems more labor intensive on my part. It seemed sort of obvious that the grid would have a column picker and that I could add in that data, but no such thing exists.
If you run ZAP with the -daemon option then it will run headlessly - then the only way to interact with it is via the API. So you dont need the UI at all.I think I was unclear.* The UI code comes with the system, even if you don't run with the UI.
* The UI code doesn't provide an automatic update like you would get with maven.
* The UI code requires you to communicate via HTTP rather than being part of the language* The UI code cannot be easily debugged because you are going over HTTP.
You are still required to keep the UI code. The UI build on my box shows a 300MB file (or so) and that would not be ideal to check in. The alternative is to have the UI (running headless) on some other box. Either case that would require having someone maintain that system and update the system. While the Client API (basically a REST API) can be mavenized, how does the server ('UI' or engine) get mavenized? Does that make more sense? I'm talking about the design of the system and how it gets maintained, not the fact that a GUI is displayed.
So you can say those things via the REST API.I'm guessing that isnt fluent enough ;)Can you give an example of how you would like the API to look?By Fluent, I mean i terms of Martin Fowler used, http://en.wikipedia.org/wiki/Fluent_interface#JavaI would imagine having something like this:new Zap().setSiteUrl(site).setContexts(new FluentList<Context>().add(new Context().setEmailAndPasswords(mapOfEmailAndPasswords).setLoginRegex(regex).setLogoutRegex(logOutRegex))).spider();I could even see a simplified:SpiderResults results = new Zap().loadSession(filePathToSession).setSiteUrl(siteUrl).spider();results.attack();I might be simplifying things a little, but that is roughly how I imagined it to work.
ZAP has very powerful scripting support - the scripts can access all of the ZAP internals. One option would be to invoke ZAP with a script that invokes the internal calls which the API uses.I realize this is not how it is currently done and perhaps that is a more developer-oriented view of how things would be done. Having a scripting language doesn't work around the idea that you now have external dependencies outside of the automated code. That makes automation more brittle. I want to have my dependencies as near to the code as possible, without the need to have HTTP calls to an external system not managed by the build system. While fluent isn't a requirement, it seemed like that would have been a reasonable way to handle newing up a complex object. I don't expect this to be magically done tomorrow (or ever), but I thought it might be helpful feedback.