Skip to content

Commit 62de030

Browse files
authored
Merge pull request #105 from thc202/update-apis
Update APIs of add-ons and core
2 parents 840f328 + 73297ce commit 62de030

File tree

12 files changed

+559
-83
lines changed

12 files changed

+559
-83
lines changed

CHANGELOG.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ 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-
## [Unreleased]
7+
## [1.12.0] - 2023-07-13
88
### Changed
99
- Minimum Java version is now 11.
10+
- Update core APIs for 2.13.
11+
- Update the APIs of the following add-ons:
12+
- AJAX Spider version 23.15.0;
13+
- Alert Filters version 17;
14+
- GraphQL Support version 0.18.0;
15+
- Network version 0.10.0;
16+
- Selenium version 15.13.0;
17+
- Spider version 0.5.0.
1018

1119
## [1.11.0] - 2022-11-01
1220
### Added
@@ -166,7 +174,7 @@ of the alert (zaproxy/zaproxy#1341), older methods were deprecated.
166174
- First version as "stand alone library", it was migrated from the [zaproxy repository](https://github.com/zaproxy/zaproxy)
167175
and released to Maven Central.
168176

169-
[Unreleased]: https://github.com/zaproxy/zap-api-java/compare/v1.11.0...HEAD
177+
[1.12.0]: https://github.com/zaproxy/zap-api-java/compare/v1.11.0...v1.12.0
170178
[1.11.0]: https://github.com/zaproxy/zap-api-java/compare/v1.10.0...v1.11.0
171179
[1.10.0]: https://github.com/zaproxy/zap-api-java/compare/v1.9.0...v1.10.0
172180
[1.9.0]: https://github.com/zaproxy/zap-api-java/compare/v1.8.0...v1.9.0

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ can be obtained from [Maven Central](https://search.maven.org/) with following c
2121

2222
* GroupId: `org.zaproxy`
2323
* ArtifactId: `zap-clientapi`
24-
* Version: `1.11.0`
24+
* Version: `1.12.0`
2525

2626
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).
2727

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ subprojects {
1212

1313
group = 'org.zaproxy'
1414

15-
version '1.12.0-SNAPSHOT'
15+
version '1.12.0'
1616
ext.versionBC = '1.11.0'
1717

1818
repositories {

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

+103
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ public ApiResponse allowedResources() throws ClientApiException {
4646
return api.callApi("ajaxSpider", "view", "allowedResources", null);
4747
}
4848

49+
/**
50+
* Gets the excluded elements. The excluded elements are not clicked during crawling, for
51+
* example, to prevent logging out.
52+
*
53+
* <p>This component is optional and therefore the API will only work if it is installed
54+
*/
55+
public ApiResponse excludedElements(String contextname) throws ClientApiException {
56+
Map<String, String> map = new HashMap<>();
57+
map.put("contextName", contextname);
58+
return api.callApi("ajaxSpider", "view", "excludedElements", map);
59+
}
60+
4961
/**
5062
* Gets the current status of the crawler. Actual values are Stopped and Running.
5163
*
@@ -250,6 +262,97 @@ public ApiResponse addAllowedResource(String regex, String enabled) throws Clien
250262
return api.callApi("ajaxSpider", "action", "addAllowedResource", map);
251263
}
252264

265+
/**
266+
* Adds an excluded element to a context.
267+
*
268+
* <p>This component is optional and therefore the API will only work if it is installed
269+
*/
270+
public ApiResponse addExcludedElement(
271+
String contextname,
272+
String description,
273+
String element,
274+
String xpath,
275+
String text,
276+
String attributename,
277+
String attributevalue,
278+
String enabled)
279+
throws ClientApiException {
280+
Map<String, String> map = new HashMap<>();
281+
map.put("contextName", contextname);
282+
map.put("description", description);
283+
map.put("element", element);
284+
if (xpath != null) {
285+
map.put("xpath", xpath);
286+
}
287+
if (text != null) {
288+
map.put("text", text);
289+
}
290+
if (attributename != null) {
291+
map.put("attributeName", attributename);
292+
}
293+
if (attributevalue != null) {
294+
map.put("attributeValue", attributevalue);
295+
}
296+
if (enabled != null) {
297+
map.put("enabled", enabled);
298+
}
299+
return api.callApi("ajaxSpider", "action", "addExcludedElement", map);
300+
}
301+
302+
/**
303+
* Modifies an excluded element of a context.
304+
*
305+
* <p>This component is optional and therefore the API will only work if it is installed
306+
*/
307+
public ApiResponse modifyExcludedElement(
308+
String contextname,
309+
String description,
310+
String element,
311+
String descriptionnew,
312+
String xpath,
313+
String text,
314+
String attributename,
315+
String attributevalue,
316+
String enabled)
317+
throws ClientApiException {
318+
Map<String, String> map = new HashMap<>();
319+
map.put("contextName", contextname);
320+
map.put("description", description);
321+
map.put("element", element);
322+
if (descriptionnew != null) {
323+
map.put("descriptionNew", descriptionnew);
324+
}
325+
if (xpath != null) {
326+
map.put("xpath", xpath);
327+
}
328+
if (text != null) {
329+
map.put("text", text);
330+
}
331+
if (attributename != null) {
332+
map.put("attributeName", attributename);
333+
}
334+
if (attributevalue != null) {
335+
map.put("attributeValue", attributevalue);
336+
}
337+
if (enabled != null) {
338+
map.put("enabled", enabled);
339+
}
340+
return api.callApi("ajaxSpider", "action", "modifyExcludedElement", map);
341+
}
342+
343+
/**
344+
* Removes an excluded element from a context.
345+
*
346+
* <p>This component is optional and therefore the API will only work if it is installed
347+
*/
348+
public ApiResponse removeExcludedElement(String contextname, String description)
349+
throws ClientApiException {
350+
Map<String, String> map = new HashMap<>();
351+
map.put("contextName", contextname);
352+
map.put("description", description);
353+
return api.callApi("ajaxSpider", "action", "removeExcludedElement", map);
354+
}
355+
253356
/**
254357
* Removes an allowed resource.
255358
*

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

+25-62
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/** This file was automatically generated. */
2929
@SuppressWarnings("javadoc")
30-
public class AlertFilter {
30+
public class AlertFilter extends org.zaproxy.clientapi.gen.deprecated.AlertFilterDeprecated {
3131

3232
private final ClientApi api;
3333

@@ -54,40 +54,13 @@ public ApiResponse alertFilterList(String contextid) throws ClientApiException {
5454
public ApiResponse globalAlertFilterList() throws ClientApiException {
5555
return api.callApi("alertFilter", "view", "globalAlertFilterList", null);
5656
}
57-
/**
58-
* Adds a new alert filter for the context with the given ID.
59-
*
60-
* <p>This component is optional and therefore the API will only work if it is installed
61-
*/
62-
public ApiResponse addAlertFilter(
63-
String contextid,
64-
String ruleid,
65-
String newlevel,
66-
String url,
67-
String urlisregex,
68-
String parameter,
69-
String enabled)
70-
throws ClientApiException {
71-
return addAlertFilter(
72-
contextid,
73-
ruleid,
74-
newlevel,
75-
url,
76-
urlisregex,
77-
parameter,
78-
enabled,
79-
null,
80-
null,
81-
null,
82-
null,
83-
null);
84-
}
8557

8658
/**
8759
* Adds a new alert filter for the context with the given ID.
8860
*
8961
* <p>This component is optional and therefore the API will only work if it is installed
9062
*/
63+
@Override
9164
public ApiResponse addAlertFilter(
9265
String contextid,
9366
String ruleid,
@@ -100,7 +73,8 @@ public ApiResponse addAlertFilter(
10073
String attack,
10174
String attackisregex,
10275
String evidence,
103-
String evidenceisregex)
76+
String evidenceisregex,
77+
String methods)
10478
throws ClientApiException {
10579
Map<String, String> map = new HashMap<>();
10680
map.put("contextId", contextid);
@@ -133,6 +107,9 @@ public ApiResponse addAlertFilter(
133107
if (evidenceisregex != null) {
134108
map.put("evidenceIsRegex", evidenceisregex);
135109
}
110+
if (methods != null) {
111+
map.put("methods", methods);
112+
}
136113
return api.callApi("alertFilter", "action", "addAlertFilter", map);
137114
}
138115

@@ -141,35 +118,7 @@ public ApiResponse addAlertFilter(
141118
*
142119
* <p>This component is optional and therefore the API will only work if it is installed
143120
*/
144-
public ApiResponse removeAlertFilter(
145-
String contextid,
146-
String ruleid,
147-
String newlevel,
148-
String url,
149-
String urlisregex,
150-
String parameter,
151-
String enabled)
152-
throws ClientApiException {
153-
return removeAlertFilter(
154-
contextid,
155-
ruleid,
156-
newlevel,
157-
url,
158-
urlisregex,
159-
parameter,
160-
enabled,
161-
null,
162-
null,
163-
null,
164-
null,
165-
null);
166-
}
167-
168-
/**
169-
* Removes an alert filter from the context with the given ID.
170-
*
171-
* <p>This component is optional and therefore the API will only work if it is installed
172-
*/
121+
@Override
173122
public ApiResponse removeAlertFilter(
174123
String contextid,
175124
String ruleid,
@@ -182,7 +131,8 @@ public ApiResponse removeAlertFilter(
182131
String attack,
183132
String attackisregex,
184133
String evidence,
185-
String evidenceisregex)
134+
String evidenceisregex,
135+
String methods)
186136
throws ClientApiException {
187137
Map<String, String> map = new HashMap<>();
188138
map.put("contextId", contextid);
@@ -215,6 +165,9 @@ public ApiResponse removeAlertFilter(
215165
if (evidenceisregex != null) {
216166
map.put("evidenceIsRegex", evidenceisregex);
217167
}
168+
if (methods != null) {
169+
map.put("methods", methods);
170+
}
218171
return api.callApi("alertFilter", "action", "removeAlertFilter", map);
219172
}
220173

@@ -223,6 +176,7 @@ public ApiResponse removeAlertFilter(
223176
*
224177
* <p>This component is optional and therefore the API will only work if it is installed
225178
*/
179+
@Override
226180
public ApiResponse addGlobalAlertFilter(
227181
String ruleid,
228182
String newlevel,
@@ -234,7 +188,8 @@ public ApiResponse addGlobalAlertFilter(
234188
String attack,
235189
String attackisregex,
236190
String evidence,
237-
String evidenceisregex)
191+
String evidenceisregex,
192+
String methods)
238193
throws ClientApiException {
239194
Map<String, String> map = new HashMap<>();
240195
map.put("ruleId", ruleid);
@@ -266,6 +221,9 @@ public ApiResponse addGlobalAlertFilter(
266221
if (evidenceisregex != null) {
267222
map.put("evidenceIsRegex", evidenceisregex);
268223
}
224+
if (methods != null) {
225+
map.put("methods", methods);
226+
}
269227
return api.callApi("alertFilter", "action", "addGlobalAlertFilter", map);
270228
}
271229

@@ -274,6 +232,7 @@ public ApiResponse addGlobalAlertFilter(
274232
*
275233
* <p>This component is optional and therefore the API will only work if it is installed
276234
*/
235+
@Override
277236
public ApiResponse removeGlobalAlertFilter(
278237
String ruleid,
279238
String newlevel,
@@ -285,7 +244,8 @@ public ApiResponse removeGlobalAlertFilter(
285244
String attack,
286245
String attackisregex,
287246
String evidence,
288-
String evidenceisregex)
247+
String evidenceisregex,
248+
String methods)
289249
throws ClientApiException {
290250
Map<String, String> map = new HashMap<>();
291251
map.put("ruleId", ruleid);
@@ -317,6 +277,9 @@ public ApiResponse removeGlobalAlertFilter(
317277
if (evidenceisregex != null) {
318278
map.put("evidenceIsRegex", evidenceisregex);
319279
}
280+
if (methods != null) {
281+
map.put("methods", methods);
282+
}
320283
return api.callApi("alertFilter", "action", "removeGlobalAlertFilter", map);
321284
}
322285

0 commit comments

Comments
 (0)