Skip to content

Commit 5e53251

Browse files
authored
Merge pull request #89 from thc202/release-1.9.0
Release 1.9.0
2 parents cc89e3e + e06bfc6 commit 5e53251

File tree

11 files changed

+402
-12
lines changed

11 files changed

+402
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ 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.9.0] - 2020-12-18
8+
### Added
9+
- Add API from GraphQL add-on.
10+
11+
### Changed
12+
- Core APIs updated for ZAP version 2.10.0.
13+
- Update API from AJAX Spider add.on.
14+
715
## [1.8.0] - 2020-01-23
816
### Added
917
- Core APIs.
@@ -115,6 +123,7 @@ of the alert (zaproxy/zaproxy#1341), older methods were deprecated.
115123
- First version as "stand alone library", it was migrated from the [zaproxy repository](https://github.com/zaproxy/zaproxy)
116124
and released to Maven Central.
117125

126+
[1.9.0]: https://github.com/zaproxy/zap-api-java/compare/v1.8.0...v1.9.0
118127
[1.8.0]: https://github.com/zaproxy/zap-api-java/compare/v1.7.0...v1.8.0
119128
[1.7.0]: https://github.com/zaproxy/zap-api-java/compare/v1.6.0...v1.7.0
120129
[1.6.0]: https://github.com/zaproxy/zap-api-java/compare/v1.5.0...v1.6.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ 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.8.0`
25+
* Version: `1.9.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

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.8.0'
24-
ext.versionBC = '1.7.0'
23+
version '1.9.0'
24+
ext.versionBC = '1.8.0'
2525

2626
repositories {
2727
mavenCentral()

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public ApiResponse optionTokensNames() throws ClientApiException {
4141
return api.callApi("acsrf", "view", "optionTokensNames", null);
4242
}
4343

44+
/** Define if ZAP should detect CSRF tokens by searching for partial matches */
45+
public ApiResponse optionPartialMatchingEnabled() throws ClientApiException {
46+
return api.callApi("acsrf", "view", "optionPartialMatchingEnabled", null);
47+
}
48+
4449
/** Adds an anti-CSRF token with the given name, enabled by default */
4550
public ApiResponse addOptionToken(String string) throws ClientApiException {
4651
Map<String, String> map = new HashMap<>();
@@ -55,6 +60,13 @@ public ApiResponse removeOptionToken(String string) throws ClientApiException {
5560
return api.callApi("acsrf", "action", "removeOptionToken", map);
5661
}
5762

63+
/** Define if ZAP should detect CSRF tokens by searching for partial matches. */
64+
public ApiResponse setOptionPartialMatchingEnabled(boolean bool) throws ClientApiException {
65+
Map<String, String> map = new HashMap<>();
66+
map.put("Boolean", Boolean.toString(bool));
67+
return api.callApi("acsrf", "action", "setOptionPartialMatchingEnabled", map);
68+
}
69+
5870
/** Generate a form for testing lack of anti-CSRF tokens - typically invoked via ZAP */
5971
public byte[] genForm(String hrefid) throws ClientApiException {
6072
Map<String, String> map = new HashMap<>();

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

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public AjaxSpider(ClientApi api) {
3636
this.api = api;
3737
}
3838

39+
/** This component is optional and therefore the API will only work if it is installed */
40+
public ApiResponse allowedResources() throws ClientApiException {
41+
return api.callApi("ajaxSpider", "view", "allowedResources", null);
42+
}
43+
3944
/** This component is optional and therefore the API will only work if it is installed */
4045
public ApiResponse status() throws ClientApiException {
4146
return api.callApi("ajaxSpider", "view", "status", null);
@@ -114,10 +119,7 @@ public ApiResponse optionRandomInputs() throws ClientApiException {
114119
}
115120

116121
/**
117-
* Runs the spider against the given URL and/or context, optionally, spidering everything in
118-
* scope. The parameter 'contextName' can be used to constrain the scan to a Context, the option
119-
* 'in scope' is ignored if a context was also specified. The parameter 'subtreeOnly' allows to
120-
* restrict the spider under a site's subtree (using the specified 'url').
122+
* Runs the AJAX Spider against a given target.
121123
*
122124
* <p>This component is optional and therefore the API will only work if it is installed
123125
*/
@@ -140,10 +142,7 @@ public ApiResponse scan(String url, String inscope, String contextname, String s
140142
}
141143

142144
/**
143-
* Runs the spider from the perspective of a User, obtained using the given context name and
144-
* user name. The parameter 'url' allows to specify the starting point for the spider, otherwise
145-
* it's used an existing URL from the context (if any). The parameter 'subtreeOnly' allows to
146-
* restrict the spider under a site's subtree (using the specified 'url').
145+
* Runs the AJAX Spider from the perspective of a User of the web application.
147146
*
148147
* <p>This component is optional and therefore the API will only work if it is installed
149148
*/
@@ -167,6 +166,32 @@ public ApiResponse stop() throws ClientApiException {
167166
return api.callApi("ajaxSpider", "action", "stop", null);
168167
}
169168

169+
/** This component is optional and therefore the API will only work if it is installed */
170+
public ApiResponse addAllowedResource(String regex, String enabled) throws ClientApiException {
171+
Map<String, String> map = new HashMap<>();
172+
map.put("regex", regex);
173+
if (enabled != null) {
174+
map.put("enabled", enabled);
175+
}
176+
return api.callApi("ajaxSpider", "action", "addAllowedResource", map);
177+
}
178+
179+
/** This component is optional and therefore the API will only work if it is installed */
180+
public ApiResponse removeAllowedResource(String regex) throws ClientApiException {
181+
Map<String, String> map = new HashMap<>();
182+
map.put("regex", regex);
183+
return api.callApi("ajaxSpider", "action", "removeAllowedResource", map);
184+
}
185+
186+
/** This component is optional and therefore the API will only work if it is installed */
187+
public ApiResponse setEnabledAllowedResource(String regex, String enabled)
188+
throws ClientApiException {
189+
Map<String, String> map = new HashMap<>();
190+
map.put("regex", regex);
191+
map.put("enabled", enabled);
192+
return api.callApi("ajaxSpider", "action", "setEnabledAllowedResource", map);
193+
}
194+
170195
/** This component is optional and therefore the API will only work if it is installed */
171196
public ApiResponse setOptionBrowserId(String string) throws ClientApiException {
172197
Map<String, String> map = new HashMap<>();

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,23 @@ public ApiResponse deleteAlert(String id) throws ClientApiException {
128128
return api.callApi("alert", "action", "deleteAlert", map);
129129
}
130130

131+
/** Update the confidence of the alerts. */
132+
public ApiResponse updateAlertsConfidence(String ids, String confidenceid)
133+
throws ClientApiException {
134+
Map<String, String> map = new HashMap<>();
135+
map.put("ids", ids);
136+
map.put("confidenceId", confidenceid);
137+
return api.callApi("alert", "action", "updateAlertsConfidence", map);
138+
}
139+
140+
/** Update the risk of the alerts. */
141+
public ApiResponse updateAlertsRisk(String ids, String riskid) throws ClientApiException {
142+
Map<String, String> map = new HashMap<>();
143+
map.put("ids", ids);
144+
map.put("riskId", riskid);
145+
return api.callApi("alert", "action", "updateAlertsRisk", map);
146+
}
147+
131148
/** Update the alert with the given ID, with the provided details. */
132149
public ApiResponse updateAlert(
133150
String id,

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,40 @@ public ApiResponse setContextRegexs(String contextname, String incregexs, String
116116
return api.callApi("context", "action", "setContextRegexs", map);
117117
}
118118

119+
/**
120+
* Set the checking strategy for a context - this defines how ZAP checks that a request is
121+
* authenticated
122+
*/
123+
public ApiResponse setContextCheckingStrategy(
124+
String contextname,
125+
String checkingstrategy,
126+
String pollurl,
127+
String polldata,
128+
String pollheaders,
129+
String pollfrequency,
130+
String pollfrequencyunits)
131+
throws ClientApiException {
132+
Map<String, String> map = new HashMap<>();
133+
map.put("contextName", contextname);
134+
map.put("checkingStrategy", checkingstrategy);
135+
if (pollurl != null) {
136+
map.put("pollUrl", pollurl);
137+
}
138+
if (polldata != null) {
139+
map.put("pollData", polldata);
140+
}
141+
if (pollheaders != null) {
142+
map.put("pollHeaders", pollheaders);
143+
}
144+
if (pollfrequency != null) {
145+
map.put("pollFrequency", pollfrequency);
146+
}
147+
if (pollfrequencyunits != null) {
148+
map.put("pollFrequencyUnits", pollfrequencyunits);
149+
}
150+
return api.callApi("context", "action", "setContextCheckingStrategy", map);
151+
}
152+
119153
/** Creates a new context with the given name in the current session */
120154
public ApiResponse newContext(String contextname) throws ClientApiException {
121155
Map<String, String> map = new HashMap<>();

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ public ApiResponse optionUseProxyChainAuth() throws ClientApiException {
322322
return api.callApi("core", "view", "optionUseProxyChainAuth", null);
323323
}
324324

325+
/** Gets whether or not the SOCKS proxy should be used. */
326+
public ApiResponse optionUseSocksProxy() throws ClientApiException {
327+
return api.callApi("core", "view", "optionUseSocksProxy", null);
328+
}
329+
325330
/**
326331
* Convenient and simple action to access a URL, optionally following redirections. Returns the
327332
* request sent and response received and followed redirections, if any. Other actions are
@@ -688,6 +693,13 @@ public ApiResponse setOptionUseProxyChainAuth(boolean bool) throws ClientApiExce
688693
return api.callApi("core", "action", "setOptionUseProxyChainAuth", map);
689694
}
690695

696+
/** Sets whether or not the SOCKS proxy should be used. */
697+
public ApiResponse setOptionUseSocksProxy(boolean bool) throws ClientApiException {
698+
Map<String, String> map = new HashMap<>();
699+
map.put("Boolean", Boolean.toString(bool));
700+
return api.callApi("core", "action", "setOptionUseSocksProxy", map);
701+
}
702+
691703
public byte[] proxypac() throws ClientApiException {
692704
return api.callApiOther("core", "other", "proxy.pac", null);
693705
}

0 commit comments

Comments
 (0)