You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
security: adding a maximum Content-Length on the event endpoint to fix denial-of-service (DoS) attacks. This resolves [CVE-2025-11375](https://nvd.nist.gov/vuln/detail/CVE-2025-11375).
Copy file name to clipboardExpand all lines: agent/event_endpoint.go
+22-4Lines changed: 22 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ package agent
5
5
6
6
import (
7
7
"bytes"
8
+
"fmt"
8
9
"io"
9
10
"net/http"
10
11
"strconv"
@@ -44,12 +45,29 @@ func (s *HTTPHandlers) EventFire(resp http.ResponseWriter, req *http.Request) (i
44
45
}
45
46
46
47
// Get the payload
47
-
ifreq.ContentLength>0 {
48
+
ifreq.ContentLength>=0 {
49
+
// The underlying gossip sets limits on the size of a user event
50
+
// message. It is hard to give an exact number, as it depends on various
51
+
// parameters of the event, but the payload should be kept very small
52
+
// (< 100 bytes). We've multiplied this by 3 to be safe.
53
+
constmaxEventPayloadSize=300
54
+
ifreq.ContentLength>maxEventPayloadSize {
55
+
returnnil, HTTPError{
56
+
StatusCode: http.StatusRequestEntityTooLarge,
57
+
Reason: fmt.Sprintf("Event payload too large, received %d bytes, max size: %d bytes. User events should be kept small for efficient gossip propagation.",
58
+
req.ContentLength, maxEventPayloadSize),
59
+
}
60
+
}
61
+
48
62
varbuf bytes.Buffer
49
-
if_, err:=io.Copy(&buf, req.Body); err!=nil {
50
-
returnnil, err
63
+
ifreq.Body!=nil {
64
+
if_, err:=io.Copy(&buf, req.Body); err!=nil {
65
+
returnnil, err
66
+
}
67
+
event.Payload=buf.Bytes()
51
68
}
52
-
event.Payload=buf.Bytes()
69
+
} else {
70
+
returnnil, HTTPError{StatusCode: http.StatusBadRequest, Reason: "Event payload size must be greater than zero"}
0 commit comments