-
Notifications
You must be signed in to change notification settings - Fork 1
Ignore illegal response header (#2439) #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: pr_055_before
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -228,7 +228,6 @@ module Const | |
| COLON = ": ".freeze | ||
|
|
||
| NEWLINE = "\n".freeze | ||
| HTTP_INJECTION_REGEX = /[\r\n]/.freeze | ||
|
|
||
| HIJACK_P = "rack.hijack?".freeze | ||
| HIJACK = "rack.hijack".freeze | ||
|
|
@@ -239,5 +238,13 @@ module Const | |
| # Mininum interval to checks worker health | ||
| WORKER_CHECK_INTERVAL = 5 | ||
|
|
||
| # Illegal character in the key or value of response header | ||
| DQUOTE = "\"".freeze | ||
| HTTP_HEADER_DELIMITER = Regexp.escape("(),/:;<=>?@[]{}").freeze | ||
| ILLEGAL_HEADER_KEY_REGEX = /[\u0000-\u0025|#{DQUOTE}|#{HTTP_HEADER_DELIMITER}]/.freeze | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regex incorrectly blocks valid pipe character in headersMedium Severity The |
||
| ILLEGAL_HEADER_VALUE_REGEX = /[\000-\037]/.freeze | ||
|
|
||
| # Banned keys of response header | ||
| BANNED_HEADER_KEY = /rack.|status/.freeze | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Banned header regex matches unintended header namesMedium Severity The |
||
| end | ||
| end | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex blocks valid HTTP header token characters
Medium Severity
The
ILLEGAL_HEADER_KEY_REGEXuses range\u0000-\u0025which blocks characters 0-37 decimal. This incorrectly blocks valid RFC 7230 token characters!(33),#(35),$(36), and%(37). Per RFC 7230, these are explicitly validtcharcharacters. Valid response headers containing these characters would be incorrectly filtered out. The range likely intended to be\u0000-\u0020(control chars + space) withDQUOTEadded separately.