fix(security): cap discord error response body read at 4096 bytes
Unbounded io.ReadAll on the Discord webhook error response body was a LOW OOM risk: a malicious gateway or misconfigured proxy could return a multi-MB body and exhaust agent memory. Cap with io.LimitReader(resp.Body, 4096) — error messages are always short; any extra content is irrelevant noise. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
15d4b25c78
commit
fde90efde5
@ -90,7 +90,7 @@ func (d *DiscordAdapter) SendMessage(ctx context.Context, config map[string]inte
|
||||
// would propagate that token into logs and error responses (#659).
|
||||
return fmt.Errorf("discord: HTTP request failed")
|
||||
}
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))
|
||||
resp.Body.Close()
|
||||
|
||||
// Discord returns 204 No Content on success.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user