-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
silently drop or refuse header names w/ underscore
Ambiguous mappings open a bottomless pit of "what is user input and what is proxy input" confusion. Default to what everyone else has been doing for years now, silently drop. see also https://nginx.org/r/underscores_in_headers
- Loading branch information
Showing
11 changed files
with
130 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GET /keep/same/as?invalid/040 HTTP/1.0\r\n | ||
Transfer_Encoding: tricked\r\n | ||
Content-Length: 7\r\n | ||
Content_Length: -1E23\r\n | ||
\r\n | ||
tricked\r\n |
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,7 @@ | ||
from gunicorn.http.errors import InvalidHeaderName | ||
from gunicorn.config import Config | ||
|
||
cfg = Config() | ||
cfg.set("header_map", "refuse") | ||
|
||
request = InvalidHeaderName |
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,10 @@ | ||
POST /chunked_ambiguous_header_mapping HTTP/1.1\r\n | ||
Transfer_Encoding: gzip\r\n | ||
Transfer-Encoding: chunked\r\n | ||
\r\n | ||
5\r\n | ||
hello\r\n | ||
6\r\n | ||
world\r\n | ||
0\r\n | ||
\r\n |
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,7 @@ | ||
from gunicorn.http.errors import InvalidHeaderName | ||
from gunicorn.config import Config | ||
|
||
cfg = Config() | ||
cfg.set("header_map", "refuse") | ||
|
||
request = InvalidHeaderName |
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,6 @@ | ||
GET /keep/same/as?invalid/040 HTTP/1.0\r\n | ||
Transfer_Encoding: tricked\r\n | ||
Content-Length: 7\r\n | ||
Content_Length: -1E23\r\n | ||
\r\n | ||
tricked\r\n |
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,9 @@ | ||
request = { | ||
"method": "GET", | ||
"uri": uri("/keep/same/as?invalid/040"), | ||
"version": (1, 0), | ||
"headers": [ | ||
("CONTENT-LENGTH", "7") | ||
], | ||
"body": b'tricked' | ||
} |
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,6 @@ | ||
GET /keep/same/as?invalid/040 HTTP/1.0\r\n | ||
Transfer_Encoding: tricked\r\n | ||
Content-Length: 7\r\n | ||
Content_Length: -1E23\r\n | ||
\r\n | ||
tricked\r\n |
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,16 @@ | ||
from gunicorn.config import Config | ||
|
||
cfg = Config() | ||
cfg.set("header_map", "dangerous") | ||
|
||
request = { | ||
"method": "GET", | ||
"uri": uri("/keep/same/as?invalid/040"), | ||
"version": (1, 0), | ||
"headers": [ | ||
("TRANSFER_ENCODING", "tricked"), | ||
("CONTENT-LENGTH", "7"), | ||
("CONTENT_LENGTH", "-1E23"), | ||
], | ||
"body": b'tricked' | ||
} |