Commit 47e4802
authored
Merge commit from fork
`Mint.HTTP1.Parse.content_length_header/1` parsed the header value with
`Integer.parse/1`, which accepts an optional `+`/`-` sign prefix. The
`length >= 0` guard rejected negatives but let values like `+0` or `+123`
through, returning them as valid lengths.
RFC 7230 defines `Content-Length = 1*DIGIT`, with no sign permitted. On a
connection shared with a strict fronting proxy this parser disagreement is a
response-smuggling primitive: the proxy frames the body one way and Mint
another.
Validate that the trimmed value is one or more digits before converting it,
so signs, embedded whitespace, or any non-digit byte are rejected with
`:invalid_content_length_header`.
Fixes GHSA-mjqx-c6f6-7rc2.1 parent b8d2393 commit 47e4802
2 files changed
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
17 | 35 | | |
18 | 36 | | |
19 | 37 | | |
| |||
0 commit comments