This repository has been archived by the owner on May 14, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve request Content-Type checks (#1103)
* 920420: always check request Content-Type, no matter the HTTP method * 920420: fix incorrect tag * introduce Content-Type whitelist regexp * Content-Type: escape + char in regexp for clarity * Content-Type: renumber * 920470: add tests * 920420: add tests
- Loading branch information
1 parent
f9ffe1c
commit cd407cb
Showing
3 changed files
with
224 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
util/regression-tests/tests/REQUEST-920-PROTOCOL-ENFORCEMENT/920470.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
meta: | ||
author: "lifeforms" | ||
enabled: true | ||
name: "920470.yaml" | ||
description: "Content-Type header format checks" | ||
tests: | ||
- test_title: 920470-1 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: "%{(#nike='multipart/form-data').(#dm=@ognl" | ||
Content-Length: 0 | ||
output: | ||
log_contains: "id \"920470\"" | ||
- test_title: 920470-2 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: 'text/plain; charset="UTF-8"; garbage' | ||
Content-Length: 0 | ||
output: | ||
log_contains: "id \"920470\"" | ||
- test_title: 920470-3 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: 'text/plain; charset=/gar/bage' | ||
Content-Length: 0 | ||
output: | ||
log_contains: "id \"920470\"" | ||
- test_title: 920470-4 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
method: POST | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: "text/plain" | ||
Content-Length: 0 | ||
output: | ||
no_log_contains: "id \"920470\"" | ||
- test_title: 920470-5 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
method: POST | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: 'text/plain; charset=UTF-8' | ||
output: | ||
no_log_contains: "id \"920470\"" | ||
- test_title: 920470-6 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
method: POST | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: 'text/plain; charset="UTF-8"' | ||
Content-Length: 0 | ||
output: | ||
no_log_contains: "id \"920470\"" | ||
- test_title: 920470-7 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
method: POST | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: 'multipart/form-data; boundary=----WebKitFormBoundary12345' | ||
Content-Length: 0 | ||
output: | ||
no_log_contains: "id \"920470\"" | ||
- test_title: 920470-8 | ||
stages: | ||
- stage: | ||
input: | ||
dest_addr: 127.0.0.1 | ||
port: 80 | ||
method: POST | ||
headers: | ||
User-Agent: "ModSecurity CRS 3 Tests" | ||
Host: "localhost" | ||
Content-Type: 'application/json' | ||
Content-Length: 0 | ||
output: | ||
no_log_contains: "id \"920470\"" |