Skip to content

Commit cc89e3e

Browse files
authored
Merge pull request #85 from thc202/release-1.8.0
Release 1.8.0
2 parents 8e8820c + 092f824 commit cc89e3e

22 files changed

+891
-40
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: java
22

33
jdk:
4-
- oraclejdk8
4+
- openjdk8
55
- openjdk11
66

77
before_cache:

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.8.0] - 2020-01-23
8+
### Added
9+
- Core APIs.
10+
- APIs from add-ons:
11+
- Access Control Testing;
12+
- Export Report;
13+
- Revisit;
14+
- Wappalyzer - Technology Detection.
15+
16+
### Changed
17+
- Core APIs updated for ZAP version 2.9.0.
18+
- Update APIs from add-ons:
19+
- Alert Filters;
20+
- OpenAPI Support;
21+
- Replacer.
22+
723
## [1.7.0] - 2019-06-13
824
### Added
925
- Add API for SOAP Scanner add-on, version 3.
@@ -70,7 +86,7 @@ the API key) from being used with ZAP versions <= 2.5.0.
7086
## [1.1.0] - 2017-03-09
7187
### Added
7288
- Context Alert Filters API, for more information refer to the help page:
73-
https://github.com/zaproxy/zap-extensions/wiki/HelpAddonsAlertFiltersAlertFilter
89+
https://www.zaproxy.org/docs/desktop/addons/alert-filters/
7490
- The `Alert` now exposes the alert ID, message ID, and scanner ID.
7591
- Added confidence "False Positive" (enum `Alert.Confidence`).
7692

@@ -99,6 +115,7 @@ of the alert (zaproxy/zaproxy#1341), older methods were deprecated.
99115
- First version as "stand alone library", it was migrated from the [zaproxy repository](https://github.com/zaproxy/zaproxy)
100116
and released to Maven Central.
101117

118+
[1.8.0]: https://github.com/zaproxy/zap-api-java/compare/v1.7.0...v1.8.0
102119
[1.7.0]: https://github.com/zaproxy/zap-api-java/compare/v1.6.0...v1.7.0
103120
[1.6.0]: https://github.com/zaproxy/zap-api-java/compare/v1.5.0...v1.6.0
104121
[1.5.0]: https://github.com/zaproxy/zap-api-java/compare/v1.4.0...v1.5.0

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Build Status](https://api.travis-ci.com/zaproxy/zap-api-java.svg?branch=develop)](https://travis-ci.com/zaproxy/zap-api-java)
66
[![Known Vulnerabilities](https://snyk.io/test/github/zaproxy/zap-api-java/badge.svg)](https://snyk.io/test/github/zaproxy/zap-api-java)
77

8-
The Java implementation to access the [OWASP ZAP API](https://github.com/zaproxy/zaproxy/wiki/ApiDetails). For more information
8+
The Java implementation to access the [OWASP ZAP API](https://www.zaproxy.org/docs/api/). For more information
99
about OWASP ZAP consult the (main) [OWASP ZAP project](https://github.com/zaproxy/zaproxy/).
1010

1111
This project produces two libraries:
@@ -22,16 +22,16 @@ can be obtained from [Maven Central](https://search.maven.org/) with following c
2222

2323
* GroupId: `org.zaproxy`
2424
* ArtifactId: `zap-clientapi`
25-
* Version: `1.7.0`
25+
* Version: `1.8.0`
2626

2727
Previous releases are also available, more details can be found in [Maven Central](https://search.maven.org/search?q=g:org.zaproxy%20AND%20a:zap-clientapi&core=gav).
2828

2929
## Getting Help
3030

3131
For help using OWASP ZAP API refer to:
3232
* [Examples](subprojects/zap-clientapi/src/examples/java/org/zaproxy/clientapi/examples) - collection of examples using the library;
33-
* [OWASP ZAP User Group](https://groups.google.com/group/zaproxy-users) - for asking questions;
34-
* IRC: irc.mozilla.org #websectools (eg [using Mibbit](http://chat.mibbit.com/?server=irc.mozilla.org%3A%2B6697&channel=%23websectools)) - chat with core ZAP developers (European office hours usually best)
33+
* [API Documentation](https://www.zaproxy.org/docs/api/)
34+
* [OWASP ZAP User Group](https://groups.google.com/group/zaproxy-users) - for asking questions
3535

3636
## Issues
3737

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ subprojects {
2020

2121
group = 'org.zaproxy'
2222

23-
version '1.7.0'
24-
ext.versionBC = '1.6.0'
23+
version '1.8.0'
24+
ext.versionBC = '1.7.0'
2525

2626
repositories {
2727
mavenCentral()

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core/ClientApi.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import javax.xml.parsers.DocumentBuilderFactory;
4848
import javax.xml.parsers.ParserConfigurationException;
4949
import org.w3c.dom.Document;
50+
import org.zaproxy.clientapi.gen.AccessControl;
5051
import org.zaproxy.clientapi.gen.Acsrf;
5152
import org.zaproxy.clientapi.gen.AjaxSpider;
5253
import org.zaproxy.clientapi.gen.AlertFilter;
@@ -57,16 +58,20 @@
5758
import org.zaproxy.clientapi.gen.Break;
5859
import org.zaproxy.clientapi.gen.Context;
5960
import org.zaproxy.clientapi.gen.Core;
61+
import org.zaproxy.clientapi.gen.Exportreport;
6062
import org.zaproxy.clientapi.gen.ForcedUser;
6163
import org.zaproxy.clientapi.gen.HttpSessions;
6264
import org.zaproxy.clientapi.gen.ImportLogFiles;
6365
import org.zaproxy.clientapi.gen.Importurls;
66+
import org.zaproxy.clientapi.gen.LocalProxies;
6467
import org.zaproxy.clientapi.gen.Openapi;
6568
import org.zaproxy.clientapi.gen.Params;
6669
import org.zaproxy.clientapi.gen.Pnh;
6770
import org.zaproxy.clientapi.gen.Pscan;
6871
import org.zaproxy.clientapi.gen.Replacer;
6972
import org.zaproxy.clientapi.gen.Reveal;
73+
import org.zaproxy.clientapi.gen.Revisit;
74+
import org.zaproxy.clientapi.gen.RuleConfig;
7075
import org.zaproxy.clientapi.gen.Script;
7176
import org.zaproxy.clientapi.gen.Search;
7277
import org.zaproxy.clientapi.gen.Selenium;
@@ -75,6 +80,7 @@
7580
import org.zaproxy.clientapi.gen.Spider;
7681
import org.zaproxy.clientapi.gen.Stats;
7782
import org.zaproxy.clientapi.gen.Users;
83+
import org.zaproxy.clientapi.gen.Wappalyzer;
7884
import org.zaproxy.clientapi.gen.Websocket;
7985

8086
public class ClientApi {
@@ -96,6 +102,7 @@ public class ClientApi {
96102
private DocumentBuilderFactory docBuilderFactory;
97103

98104
// Note that any new API implementations added have to be added here manually
105+
public AccessControl accessControl = new AccessControl(this);
99106
public Acsrf acsrf = new Acsrf(this);
100107
public AjaxSpider ajaxSpider = new AjaxSpider(this);
101108
public AlertFilter alertFilter = new AlertFilter(this);
@@ -107,16 +114,20 @@ public class ClientApi {
107114
public Break brk = new Break(this);
108115
public Context context = new Context(this);
109116
public Core core = new Core(this);
117+
public Exportreport exportreport = new Exportreport(this);
110118
public ForcedUser forcedUser = new ForcedUser(this);
111119
public HttpSessions httpSessions = new HttpSessions(this);
112120
public ImportLogFiles logImportFiles = new ImportLogFiles(this);
113121
public Importurls importurls = new Importurls(this);
122+
public LocalProxies localProxies = new LocalProxies(this);
114123
public Openapi openapi = new Openapi(this);
115124
public Params params = new Params(this);
116125
public Pnh pnh = new Pnh(this);
117126
public Pscan pscan = new Pscan(this);
118127
public Replacer replacer = new Replacer(this);
119128
public Reveal reveal = new Reveal(this);
129+
public Revisit revisit = new Revisit(this);
130+
public RuleConfig ruleConfig = new RuleConfig(this);
120131
public Search search = new Search(this);
121132
public Script script = new Script(this);
122133
public Selenium selenium = new Selenium(this);
@@ -125,6 +136,7 @@ public class ClientApi {
125136
public Spider spider = new Spider(this);
126137
public Stats stats = new Stats(this);
127138
public Users users = new Users(this);
139+
public Wappalyzer wappalyzer = new Wappalyzer(this);
128140
public Websocket websocket = new Websocket(this);
129141

130142
public ClientApi(String zapAddress, int zapPort) {
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
* Zed Attack Proxy (ZAP) and its related class files.
3+
*
4+
* ZAP is an HTTP/HTTPS proxy for assessing web application security.
5+
*
6+
* Copyright 2020 The ZAP Development Team
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
package org.zaproxy.clientapi.gen;
21+
22+
import java.util.HashMap;
23+
import java.util.Map;
24+
import org.zaproxy.clientapi.core.ApiResponse;
25+
import org.zaproxy.clientapi.core.ClientApi;
26+
import org.zaproxy.clientapi.core.ClientApiException;
27+
28+
/** This file was automatically generated. */
29+
@SuppressWarnings("javadoc")
30+
public class AccessControl {
31+
32+
private final ClientApi api;
33+
34+
public AccessControl(ClientApi api) {
35+
this.api = api;
36+
}
37+
38+
/**
39+
* Gets the Access Control scan progress (percentage integer) for the given context ID.
40+
*
41+
* <p>This component is optional and therefore the API will only work if it is installed
42+
*/
43+
public ApiResponse getScanProgress(String contextid) throws ClientApiException {
44+
Map<String, String> map = new HashMap<>();
45+
map.put("contextId", contextid);
46+
return api.callApi("accessControl", "view", "getScanProgress", map);
47+
}
48+
49+
/**
50+
* Gets the Access Control scan status (description string) for the given context ID.
51+
*
52+
* <p>This component is optional and therefore the API will only work if it is installed
53+
*/
54+
public ApiResponse getScanStatus(String contextid) throws ClientApiException {
55+
Map<String, String> map = new HashMap<>();
56+
map.put("contextId", contextid);
57+
return api.callApi("accessControl", "view", "getScanStatus", map);
58+
}
59+
60+
/**
61+
* Starts an Access Control scan with the given context ID and user ID. (Optional parameters:
62+
* user ID for Unauthenticated user, boolean identifying whether or not Alerts are raised, and
63+
* the Risk level for the Alerts.) [This assumes the Access Control rules were previously
64+
* established via ZAP gui and the necessary Context exported/imported.]
65+
*
66+
* <p>This component is optional and therefore the API will only work if it is installed
67+
*/
68+
public ApiResponse scan(
69+
String contextid,
70+
String userid,
71+
String scanasunauthuser,
72+
String raisealert,
73+
String alertrisklevel)
74+
throws ClientApiException {
75+
Map<String, String> map = new HashMap<>();
76+
map.put("contextId", contextid);
77+
map.put("userId", userid);
78+
if (scanasunauthuser != null) {
79+
map.put("scanAsUnAuthUser", scanasunauthuser);
80+
}
81+
if (raisealert != null) {
82+
map.put("raiseAlert", raisealert);
83+
}
84+
if (alertrisklevel != null) {
85+
map.put("alertRiskLevel", alertrisklevel);
86+
}
87+
return api.callApi("accessControl", "action", "scan", map);
88+
}
89+
90+
/**
91+
* Generates an Access Control report for the given context ID and saves it based on the
92+
* provided filename (path).
93+
*
94+
* <p>This component is optional and therefore the API will only work if it is installed
95+
*/
96+
public ApiResponse writeHTMLreport(String contextid, String filename)
97+
throws ClientApiException {
98+
Map<String, String> map = new HashMap<>();
99+
map.put("contextId", contextid);
100+
map.put("fileName", filename);
101+
return api.callApi("accessControl", "action", "writeHTMLreport", map);
102+
}
103+
}

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/gen/Alert.java

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,105 @@ public ApiResponse deleteAlert(String id) throws ClientApiException {
127127
map.put("id", id);
128128
return api.callApi("alert", "action", "deleteAlert", map);
129129
}
130+
131+
/** Update the alert with the given ID, with the provided details. */
132+
public ApiResponse updateAlert(
133+
String id,
134+
String name,
135+
String riskid,
136+
String confidenceid,
137+
String description,
138+
String param,
139+
String attack,
140+
String otherinfo,
141+
String solution,
142+
String references,
143+
String evidence,
144+
String cweid,
145+
String wascid)
146+
throws ClientApiException {
147+
Map<String, String> map = new HashMap<>();
148+
map.put("id", id);
149+
map.put("name", name);
150+
map.put("riskId", riskid);
151+
map.put("confidenceId", confidenceid);
152+
map.put("description", description);
153+
if (param != null) {
154+
map.put("param", param);
155+
}
156+
if (attack != null) {
157+
map.put("attack", attack);
158+
}
159+
if (otherinfo != null) {
160+
map.put("otherInfo", otherinfo);
161+
}
162+
if (solution != null) {
163+
map.put("solution", solution);
164+
}
165+
if (references != null) {
166+
map.put("references", references);
167+
}
168+
if (evidence != null) {
169+
map.put("evidence", evidence);
170+
}
171+
if (cweid != null) {
172+
map.put("cweId", cweid);
173+
}
174+
if (wascid != null) {
175+
map.put("wascId", wascid);
176+
}
177+
return api.callApi("alert", "action", "updateAlert", map);
178+
}
179+
180+
/**
181+
* Add an alert associated with the given message ID, with the provided details. (The ID of the
182+
* created alert is returned.)
183+
*/
184+
public ApiResponse addAlert(
185+
String messageid,
186+
String name,
187+
String riskid,
188+
String confidenceid,
189+
String description,
190+
String param,
191+
String attack,
192+
String otherinfo,
193+
String solution,
194+
String references,
195+
String evidence,
196+
String cweid,
197+
String wascid)
198+
throws ClientApiException {
199+
Map<String, String> map = new HashMap<>();
200+
map.put("messageId", messageid);
201+
map.put("name", name);
202+
map.put("riskId", riskid);
203+
map.put("confidenceId", confidenceid);
204+
map.put("description", description);
205+
if (param != null) {
206+
map.put("param", param);
207+
}
208+
if (attack != null) {
209+
map.put("attack", attack);
210+
}
211+
if (otherinfo != null) {
212+
map.put("otherInfo", otherinfo);
213+
}
214+
if (solution != null) {
215+
map.put("solution", solution);
216+
}
217+
if (references != null) {
218+
map.put("references", references);
219+
}
220+
if (evidence != null) {
221+
map.put("evidence", evidence);
222+
}
223+
if (cweid != null) {
224+
map.put("cweId", cweid);
225+
}
226+
if (wascid != null) {
227+
map.put("wascId", wascid);
228+
}
229+
return api.callApi("alert", "action", "addAlert", map);
230+
}
130231
}

0 commit comments

Comments
 (0)