Commit fd56b35
committed
Bound DNS-over-HTTPS response read with io.LimitReader
io.ReadAll(resp.Body) in the DoH client reads the full response
without a size limit. A malicious or compromised DoH server can send
an arbitrarily large response, causing the cert-manager controller
to run out of memory.
Wrap with io.LimitReader using a 128KB cap, which is well above the
DNS over TCP maximum of 65535 bytes (RFC 1035). This matches the
existing pattern used in cloudflare.go and http.go for bounding
external response reads.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>1 parent c7fb73f commit fd56b35
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| |||
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
260 | | - | |
| 266 | + | |
261 | 267 | | |
262 | 268 | | |
263 | 269 | | |
| |||
0 commit comments