Skip to content

Commit 192dcf4

Browse files
authored
Merge pull request #515 from kingthorin/docker-sync
Sync changes from zaproxy
2 parents 07d3e63 + 5708c14 commit 192dcf4

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1717
- Maintenance and documentation changes.
1818
- Active and passive READMEs to include lastest JS script examples.
1919
- Reduce usage of fully qualified objects in loops or main methods to address potential classloader performance issues, in JavaScript scripts (Issue 9187).
20+
- httpsender/AlertOnHttpResponseCodeErrors.js and AlertOnUnexpectedContentTypes.js synced from zaproxy/docker (Issue 9273), renamed to PascalCase.
2021

2122
### Fixed
2223
- The following scripts were not being loaded as scan rules:
2324
- active/SSTI.js
2425
- passive/Mutliple Security Header Check.js
25-
- Updated Alert_on_HTTP_Response_Code_Errors.js to work with GraalVM JavaScript engine.
26+
- Updated AlertOnHttpResponseCodeErrors.js to work with GraalVM JavaScript engine.
2627

2728
### Removed
2829
- Links to videos which no longer exist.

httpsender/Alert on HTTP Response Code Errors.js renamed to httpsender/AlertOnHttpResponseCodeErrors.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const HistoryReference = Java.type(
1313
"org.parosproxy.paros.model.HistoryReference"
1414
);
1515

16+
const extensionAlert = control
17+
.getExtensionLoader()
18+
.getExtension(ExtensionAlert.NAME);
19+
1620
pluginid = 100000; // https://github.com/zaproxy/zaproxy/blob/main/docs/scanners.md
1721

1822
function sendingRequest(msg, initiator, helper) {
@@ -24,20 +28,20 @@ function responseReceived(msg, initiator, helper) {
2428
// Not of interest.
2529
return;
2630
}
27-
var extensionAlert = control
28-
.getExtensionLoader()
29-
.getExtension(ExtensionAlert.NAME);
31+
3032
if (extensionAlert != null) {
3133
var code = msg.getResponseHeader().getStatusCode();
32-
if (code < 400 || code >= 600 || code == 404) {
34+
if (code < 400 || code >= 600) {
3335
// Do nothing
3436
} else {
3537
var risk = 0; // Info
3638
var title = "A Client Error response code was returned by the server";
39+
var alertRef = 1;
3740
if (code >= 500) {
3841
// Server error
3942
risk = 1; // Low
4043
title = "A Server Error response code was returned by the server";
44+
alertRef = 2;
4145
}
4246
// CONFIDENCE_HIGH = 3 (we can be pretty sure we're right)
4347
var alert = new Alert(pluginid, risk, 3, title);
@@ -95,6 +99,7 @@ function responseReceived(msg, initiator, helper) {
9599
"Raised by the 'Alert on HTTP Response Code Error' script"
96100
);
97101
alert.setEvidence(code.toString());
102+
alert.setAlertRef(pluginid + "-" + alertRef);
98103
alert.setCweId(388); // CWE CATEGORY: Error Handling
99104
alert.setWascId(20); // WASC Improper Input Handling
100105
extensionAlert.alertFound(alert, ref);

httpsender/Alert on Unexpected Content Types.js renamed to httpsender/AlertOnUnexpectedContentTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const HistoryReference = Java.type(
1313
"org.parosproxy.paros.model.HistoryReference"
1414
);
1515

16-
var extensionAlert = control
16+
const extensionAlert = control
1717
.getExtensionLoader()
1818
.getExtension(ExtensionAlert.NAME);
1919

0 commit comments

Comments
 (0)