No request body size limits on proxy endpoints #4
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: High
All three proxy endpoints (
/v1/messages,/v1/chat/completions,/v1/responses) usejson.NewDecoder(r.Body)orio.ReadAll(r.Body)withouthttp.MaxBytesReaderor any size limit. An attacker on localhost (or via DNS rebinding) can exhaust server memory with a multi-gigabyte payload.Files:
cmd/ocgo/main.go:368,408,442Fix: Add
r.Body = http.MaxBytesReader(w, r.Body, <limit>)to all handlers.