Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f034a34

Browse files
Merge pull request #2799 from martinhsv/v2/master
Adjust parser activation rules in modsecurity.conf-recommended
2 parents 51a30d7 + bb37285 commit f034a34

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

‎CHANGES‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
DD mmm YYYY - 2.9.x (to be released)
22
-------------------
33

4+
* Adjust parser activation rules in modsecurity.conf-recommended
5+
[Issue #2799 - @terjanq, @martinhsv]
46
* Multipart parsing fixes and new MULTIPART_PART_HEADERS collection
57
[Issue #2797 - @terjanq, @martinhsv]
68
* Limit rsub null termination to where necessary

‎modsecurity.conf-recommended‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ SecRequestBodyAccess On
1919
# Enable XML request body parser.
2020
# Initiate XML Processor in case of xml content-type
2121
#
22-
SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\+|/)|text/)xml" \
22+
SecRule REQUEST_HEADERS:Content-Type "^(?:application(?:/soap\+|/)|text/)xml" \
2323
"id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML"
2424

2525
# Enable JSON request body parser.
2626
# Initiate JSON Processor in case of JSON content-type; change accordingly
2727
# if your application does not use 'application/json'
2828
#
29-
SecRule REQUEST_HEADERS:Content-Type "application/json" \
29+
SecRule REQUEST_HEADERS:Content-Type "^application/json" \
3030
"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
3131

3232
# Sample rule to enable JSON request body parser for more subtypes.
3333
# Uncomment or adapt this rule if you want to engage the JSON
3434
# Processor for "+json" subtypes
3535
#
36-
#SecRule REQUEST_HEADERS:Content-Type "^application/.+[+]json$" \
36+
#SecRule REQUEST_HEADERS:Content-Type "^application/[a-z0-9.-]+[+]json" \
3737
# "id:'200006',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
3838

3939
# Maximum request body size we will accept for buffering. If you support

‎tests/regression/rule/10-xml.t‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
SecXmlExternalEntity On
395395
SecDebugLog $ENV{DEBUG_LOG}
396396
SecDebugLogLevel 9
397-
SecRule REQUEST_HEADERS:Content-Type "^text/xml\$" "id:500029, \\
397+
SecRule REQUEST_HEADERS:Content-Type "^(?:application(?:/soap\+|/)|text/)xml" "id:500029, \\
398398
phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML"
399399
SecRule REQBODY_PROCESSOR "!^XML\$" nolog,pass,skipAfter:12345,id:500030
400400
SecRule XML "\@validateDTD $ENV{CONF_DIR}/SoapEnvelope-bad.dtd" "id:500031 \\

‎tests/regression/rule/15-json.t‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
SecAuditLog "$ENV{AUDIT_LOG}"
237237
SecDebugLogLevel 9
238238
SecRequestBodyJsonDepthLimit 3
239-
SecRule REQUEST_HEADERS:Content-Type "application/json" \\
239+
SecRule REQUEST_HEADERS:Content-Type "^application/json" \\
240240
"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
241241
SecRule REQBODY_ERROR "!\@eq 0" "id:'200444',phase:2,log,deny,status:403,msg:'Failed to parse request body'"
242242
SecRule ARGS "\@streq 25" "id:'200445',phase:2,log,deny,status:403"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /