Address potential classloader performance issues in JS scripts#504
Conversation
|
Note I used |
|
New Issues (6)Checkmarx found the following issues in this Pull Request
Use @Checkmarx to interact with Checkmarx PR Assistant. |
39d4e87 to
80916f9
Compare
|
The CX failure is unrelated to the changes. |
80916f9 to
f6c4ce7
Compare
|
Think I got all those. |
|
Not all scripts were updated (some still left in the changed scripts), was that on purpose? |
|
I thought I copied the full content from zaproxy/docker will check. |
|
I'm referring to scripts that are just here (e.g. |
|
My search must have missed them, thanks for clarifying. |
|
I just remembered there were a few I left on purpose like in the extender scripts cause they're only used on install and uninstall or register and unregister, but I guess I should change them all to be consistent. |
f6c4ce7 to
4cfd726
Compare
4cfd726 to
164e4a9
Compare
|
Done & done. (If the var -> const change is too broad let me know and I can roll it back) |
|
It's not an if, it is. How does that address potential classloader performance issues. |
|
We had agreed to update them as we were switching the fully qualified class usage to Java.types/extends. I was debating if consistency or minimal change was more important. I'll roll it back. |
|
Minimal changes are more important if the other changes are not done consistently, there are other var that should be const (and we should drop the var as well) throughout (e.g. why in the first script it was not changed |
|
Because my instruction had been to change it with Java.type and Java.extends. It's okay, I'll go back to minimal change, that's probably best for this case. Other stuff can be done in other passes or PRs. |
164e4a9 to
1ea2a05
Compare
|
Should be back on track. |
|
That was a restoration to the original state (check the change tab, it doesn't show there). Unless it was something we had discussed and I lost track? Edit: Disregard I was looking at the wrong sender/Alert on* |
|
It can also be squashed (would make diffs easier IMO). |
97935db to
14dc813
Compare
|
Removed unrelated changes in httpsender/Alert on * and squashed. |
14dc813 to
4cf6425
Compare
a8b939b to
b6335c1
Compare
There was a problem hiding this comment.
Pull request overview
This PR reduces repeated fully qualified Java class access in community JavaScript scripts by hoisting Java classes into top-level Java.type(...) bindings, aligning scripts with existing ZAP scripting conventions and addressing classloader performance concerns.
Changes:
- Replaced inline fully qualified Java references with reusable
Java.type(...)bindings across active, passive, HTTP sender, targeted, standalone, extender, and session scripts. - Updated static/enum references to use the new bindings.
- Added a changelog entry for Issue 9187.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
CHANGELOG.md |
Documents the classloader performance cleanup. |
active/OpenModelContextProtocolServer.js |
Hoists Apache URI class binding. |
authentication/DjangoAuthentication.js |
Moves authentication Java class imports to module scope. |
extender/ZAP onEvent Handler.js |
Hoists ZAP event bus class binding. |
extender/arpSyndicateSubdomainDiscovery.js |
Hoists ZAP event bus class binding. |
httpfuzzerprocessor/addCacheBusting.js |
Hoists HTML parameter class/type bindings. |
httpfuzzerprocessor/add_msgs_sites_tree.js |
Hoists history reference and event queue bindings. |
httpsender/Alert on HTTP Response Code Errors.js |
Hoists alert/history/integer bindings and updates evidence handling. |
httpsender/Alert on Unexpected Content Types.js |
Hoists alert/history/integer bindings. |
httpsender/Capture and Replace Anti CSRF Token.js |
Hoists ScriptVars and parameter type bindings. |
httpsender/greenbone-maintain-auth.js |
Hoists HTML parameter type binding. |
httpsender/inject_js_in_html_page.js |
Hoists file/string Java class bindings. |
httpsender/keep-cookies-going.js |
Hoists HTML parameter type binding. |
httpsender/maintain-jwt.js |
Hoists HTML parameter type binding. |
other/af-plans/juiceshop-selenium-auth/JuiceShopAuthentication.js |
Hoists Selenium extension binding. |
other/af-plans/juiceshop-selenium-auth/JuiceShopReset.js |
Hoists user management extension binding. |
other/af-plans/juiceshop-selenium-auth/JuiceShopSession.js |
Hoists HTML parameter type binding. |
passive/Report non static sites.js |
Hoists passive scanner class binding and updates example comment. |
passive/Telerik Using Poor Crypto.js |
Hoists Base64 and Alert bindings. |
passive/f5_bigip_cookie_internal_ip.js |
Hoists integer and address bindings. |
selenium/FillOTPInMFA.js |
Hoists Selenium and thread bindings. |
session/Juice Shop Session Management.js |
Hoists HTML parameter type binding. |
standalone/Active scan rule list.js |
Hoists active scan extension binding. |
standalone/Juice shop authentication by form.js |
Hoists Selenium extension binding. |
standalone/Juice shop authentication by google.js |
Hoists Selenium extension binding. |
standalone/Loop through alerts.js |
Hoists alert extension and alert bindings. |
standalone/Loop through history table.js |
Hoists history extension binding. |
standalone/alertAndPluginDetails.js |
Hoists alert/passive scan/plugin bindings. |
standalone/domainFinder.js |
Hoists InetAddress binding. |
standalone/historySourceTagger.js |
Hoists ScriptVars and history extension bindings. |
standalone/load_function_example.js |
Hoists system property binding. |
standalone/scan_rule_list.js |
Hoists active/passive scan extension bindings. |
targeted/Remove 302s.js |
Hoists purge sites binding. |
targeted/SQLMapCommandGenerator.js |
Hoists clipboard-related bindings. |
targeted/Search www.xssposed.org for known XSS.js |
Hoists DesktopUtils binding. |
targeted/curl_command_generator.js |
Hoists clipboard-related bindings. |
targeted/cve-2021-22214.js |
Hoists Alert binding. |
targeted/cve-2021-41773-apache-path-trav.js |
Hoists Alert binding. |
targeted/json_csrf_poc_generator.js |
Hoists header and clipboard bindings. |
targeted/request_to_xml.js |
Hoists HTTP header binding. |
targeted/search cvedetails using target server header.js |
Hoists DesktopUtils binding. |
variant/CompoundCookies.js |
Hoists HTML parameter type binding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you! |
Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
b6335c1 to
3a975c8
Compare




No description provided.