Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Fix DoS via unbounded HTTP response body read in webhook requests

Matt Robertsda89c502ecd2
diff --git a/app/services/httpclient/httpclient.go b/app/services/httpclient/httpclient.go
index 72bf99d78..c71e843aa 100644
--- a/app/services/httpclient/httpclient.go
+++ b/app/services/httpclient/httpclient.go
@@ -59,7 +59,7 @@ func requestHandler(ctx context.Context, c *cmd.HTTPRequest) error {
}
defer func() { _ = res.Body.Close() }()
- respBody, err := io.ReadAll(res.Body)
+ respBody, err := io.ReadAll(io.LimitReader(res.Body, 1<<20)) // 1 MB limit
if err != nil {
return err
}