Skip to content

Commit 787502d

Browse files
authored
Merge pull request #328 from thc202/zap/update-2.12
Update ZAP to 2.12
2 parents bd09e73 + 5831139 commit 787502d

29 files changed

+19
-89
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
## [Unreleased]
77
### Changed
8+
- Update minimum ZAP version to 2.12.0:
9+
- Remove compatibility code that provided the singletons (`control` and `model`) in JavaScript scripts, they can now be accessed directly always.
10+
- Use provided singletons (`control` and `model`) in Python scripts.
11+
- Use non-deprecated `HttpSender` constructor.
812
- Remove statements that return the message in HTTP Sender scripts, the message passed as parameter is used/sent always.
913

1014
## [16] - 2023-03-29

af-plans/juiceshop-selenium-auth/JuiceShopAuthentication.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ function authenticate(helper, _paramsValues, _credentials) {
7272
}
7373

7474
logger("Launching browser to authenticate to Juice Shop");
75-
var extSel = control.getSingleton().
76-
getExtensionLoader().getExtension(
75+
var extSel = control.getExtensionLoader().getExtension(
7776
org.zaproxy.zap.extension.selenium.ExtensionSelenium.class);
7877

7978
// Change to "firefox" (or "chrome") to see the browsers being launched

af-plans/juiceshop-selenium-auth/JuiceShopReset.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ if (token) {
3232
}
3333

3434
// Reset the state for all users
35-
var extUser = control.getSingleton().
36-
getExtensionLoader().getExtension(
35+
var extUser = control.getExtensionLoader().getExtension(
3736
org.zaproxy.zap.extension.users.ExtensionUserManagement.class);
3837
var session = model.getSession();
3938
var contexts = session.getContexts();

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ val scriptsDir = layout.buildDirectory.dir("scripts")
2222
zapAddOn {
2323
addOnId.set("communityScripts")
2424
addOnName.set("Community Scripts")
25-
zapVersion.set("2.11.0")
25+
zapVersion.set("2.12.0")
2626
addOnStatus.set(AddOnStatus.ALPHA)
2727

2828
releaseLink.set("https://github.com/zaproxy/community-scripts/compare/v@PREVIOUS_VERSION@...v@CURRENT_VERSION@")

extender/Simple Reverse Proxy.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
// An extender script that adds a simple reverse proxy.
2-
// Requires a ZAP version greater than 2.7.0.
3-
4-
var control, model
5-
if (!control) control = Java.type("org.parosproxy.paros.control.Control").getSingleton()
6-
if (!model) model = Java.type("org.parosproxy.paros.model.Model").getSingleton()
72

83
// To where the requests are sent.
94
var remoteAddress = "example.com"

httpfuzzerprocessor/add_msgs_sites_tree.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// with messages sent by the fuzzer (by default the fuzz result/messages
33
// are not shown in the Fuzzer tab).
44

5-
var model;
6-
if (!model) model = Java.type("org.parosproxy.paros.model.Model").getSingleton();
7-
85
var session = model.getSession();
96

107
function processMessage(utils, message) {}

httpsender/Alert on HTTP Response Code Errors.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// By default it will raise 'Info' level alerts for Client Errors (4xx) (apart from 404s) and 'Low' Level alerts for Server Errors (5xx)
33
// But it can be easily changed.
44

5-
var control, model
6-
if (!control) control = Java.type("org.parosproxy.paros.control.Control").getSingleton()
7-
if (!model) model = Java.type("org.parosproxy.paros.model.Model").getSingleton()
8-
95
var Pattern = Java.type("java.util.regex.Pattern")
106
pluginid = 100000 // https://github.com/zaproxy/zaproxy/blob/main/docs/scanners.md
117

httpsender/Alert on Unexpected Content Types.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// By default it will raise 'Low' level alerts for content types that are not expected to be returned by APIs.
33
// But it can be easily changed.
44

5-
var control, model
6-
if (!control) control = Java.type("org.parosproxy.paros.control.Control").getSingleton()
7-
if (!model) model = Java.type("org.parosproxy.paros.model.Model").getSingleton()
8-
95
var Pattern = Java.type("java.util.regex.Pattern")
106

117
var pluginid = 100001 // https://github.com/zaproxy/zaproxy/blob/main/docs/scanners.md

standalone/Active scan rule list.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// This script gives details about all of the active scan rules installed
22

3-
var control;
4-
if (!control) control = Java.type("org.parosproxy.paros.control.Control").getSingleton();
5-
63
extAscan = control.getExtensionLoader().getExtension(
74
org.zaproxy.zap.extension.ascan.ExtensionActiveScan.NAME);
85

standalone/Juice shop authentication by form.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// a user with a name of test@test.com and a password of test123
55
// You can change any of the variables to match your environment if needed.
66

7-
var control;
8-
if (!control) control = Java.type("org.parosproxy.paros.control.Control").getSingleton();
9-
107
var By = Java.type('org.openqa.selenium.By');
118
var Thread = Java.type('java.lang.Thread');
129
var juiceshop = 'http://localhost:3000/';

0 commit comments

Comments
 (0)