However its worth understanding how the ZAP projects are structured, especially if you would like to use an alternative IDE.

Project structure

There are currently 2 main ZAP code projects, both one has been migrated to GitHub while the other is still on Google code (but will be migrated), and ongoing development takes place both on the trunks and in branches:

For each project, add all of the jars in the ‘lib’ directory to the classpath

You should update these projects at regular intervals in order to pick up the latest changes.To run ZAP run org.zaproxy.zap.ZAP.java

Each project also has a main Ant build file, build/build.xml, which we will examine in more detail later in the series.

There is more information about building ZAP on the ZAP wikiNote that if you just want to get going as quickly as possible you can just import the zaproxy trunk for core changes and/or the zap-extensions alpha branch for creating a new add-on.

The ZAP core

The zaproxy project is often called “the core”.It has 2 main high level packages within the src folder:

We try to implement significant new features in the zap-extensions project as ‘add-ons’.We do this for the following reasons:

Core changes can only be delivered via ‘full’ ZAP releases. We typically only do these a few times a year.

Add-ons can be released and updated as frequently as required. Users can dynamically install and update add-ons, often without having to even restart ZAP.

Add-ons progress from alpha through beta to release, allowing users to understand how robust an add-on is likely to be. This allows developers to release early without worrying about breaking ZAP for everyone.

Add-ons can still be included in ‘full’ ZAP releases - the WebSockets and Ajax Spider are 2 add-ons that we include by default.

Having said that, you may well find that changes you want to make can only be made in the core. That is not a problem - you can make changes to the core - but these changes will probably not be available to users as quickly as those made to add-ons.We also add new functionality to the core if we want it to be available for other add-ons to build on.Its important to note that if you make changes to code in the Paros package then you must include a comment at the top of the file mentioning your change. This is required to satisfy the Clarified Artistic License that Paros was released under.We have a standard format for these comments

// ZAP: yyyy/mm/dd Issue xyz: Description of the changes

eg see CommandLine.javaIf you make changes to the core then you typically just need to make them to the trunk.There is a branch for every release. If your change fixes a significant issue then we may also want to apply it to the latest release branch. But you dont need to worry about that.

Add-ons, Extensions and Rules

There are many ways to extend ZAP programmatically.Some of the main ways include:

Extensions, which are classes that extend the Extension.java class. They are a powerful way of adding functionality to ZAP, and much of the ‘core’ is actually implemented as extensions.

Active Scan rules, which are classes which extend Plugin.java, detect potential vulnerabilities and run as part of the Active Scanner. These rules typically make multiple requests on the target system. They only run when explicitly invoked by the user.

Passive Scan rules, which are classes which extend PluginPassiveScanner.java, detect potential vulnerabilities and run as part of the Passive Scanner. These rules cannot make any requests - all they can do is examine the requests and responses. They are typically invoked for every request that is proxied through ZAP.

Add-ons are packages which can include all of these components as well as ‘raw’ files. They are usually available on the ZAP Marketplace so that users can discover, download and install them from within ZAP. You can also install add-ons from your filestore via the “File / Load Add-on file…” menu.New add-ons should be created in the alpha branch and only move to the beta and then release branches after they have been reviewed.You can also create add-ons in your own repositories. If they are open source then they will still be eligible to be uploaded to the ZAP Marketplace, but it might take slightly longer to review them.

We will cover all of these components (and more) in more detail in a future posts.

If you have any questions about ZAP development then please ask them on the ZAP Developer group.

By contributing to ZAP you help all of the people that are using it to make their applications more secure.

It’s a great way to learn

I’m a developer. I started ZAP as a way to teach myself about security, and I’m a big fan of learning by doing, or in this case, ‘coding’. If you want to understand a particular vulnerability properly then why not write some code that you think will detect it? By the end of that process you should understand the vulnerability much better!

It doesnt matter if you are completely new to security (as I was) or have been working on it for many years - there’s always more to learn.

I want ZAP to be a great teaching tool, and that’s why I encourage students to get involved with ZAP development.

We have had some great features implemented by students, both in their own time and as part of the Google Summer of Code. If you are a student and would like to contribute to ZAP (for example as part of your course work) then we’d be delighted to hear from you.

The ZAP developer group is available specifically to help people work on ZAP, and we always do our best to help newcomers find their feet.

And of course, having contributions to a major open source security project like ZAP on your CV or resume can be a real benefit when trying to break into the security industry.

You can make ZAP work your way

ZAP is open source, and one of the big advantages of open source is that you can change it to work exactly as you want.

You can keep your changes to yourself of course, but we realize that people want to work in different ways, and so we are always happy for people to add new options to ZAP so that people can choose exactly how it works for them.

And even if you want to take ZAP off in a direction we (the ZAP core developers) think is completely irrelevant to what we are trying to achieve, we’ll still happily work with you to try to make sure you can achieve what you want. Without breaking ZAP for everyone else of course.

It’s a powerful environment

Lets say you’ve come up with a neat way to find vulnerabilities, either in a completely automated way or with manual assistance.

A small stand alone tool is ok, but there are so many things you need to handle when using such a tool on real world application. Things like authentication, session handling and managing CSRF tokens.

ZAP provides a complete testing environment and already handles a whole range of problems that you are likely to encounter.

If it can’t handle a particular problem then let us know - we are constantly improving ZAP, and so we might already be working on it. And if we are not then we’ll add it to the list of enhancement requests - someone else reading this post might just decide to work on it.

One of the advantages of using an open source project like ZAP is that you can access all of the ZAP internals. We have no ‘secret sauce’ and so we can give you access to all of the ZAP functionality without having to limit you to a restricted API for commercial reasons.

It provides more exposure for your project

Maybe you’ve started a small open source project, it might even an OWASP one.

You may well find that it takes time to get people interested in it, particularly if its completely stand alone.

While ZAP is a great environment to build on, we realize that there are many reasons why people might not want to just build on top of ZAP.

However you can wrap your project in a ZAP add-on while keeping ownership and maintaining it separately from ZAP.

We are big fans of reuse, and encourage people to write new functionality in a way that allows it to be reused across a range of security tools, even our competitors. We practice what we preach, having done that for major new features in ZAP like Plug-n-Hack and Zest.

The ZAP marketplace allows users to browse, download and install add-ons from within ZAP.

Repackaging your tool as a ZAP add-on will introduce your project to people who might otherwise never have known about it or bothered to try it.

Profit???

ZAP is open source, and will stay open source.

You will never have to pay for a ‘pro’ version.

However we have no problem with people developing and selling closed source add-ons to ZAP.

If you think you can make money from selling ZAP add-ons then go for it.