Skip to content

fix(server): add request body size limit to the API server #3595

Description

@aheritier

Summary

pkg/server/server.go NewWithManager registers RedactedRequestLogger + optional bearer middleware only; handlers JSON-decode unbounded bodies (e.g. runAgent, server.go:444). By contrast pkg/chatserver/server.go:220 sets middleware.BodyLimit. Default bind is loopback and auth is optional, but any local process can OOM the agent — worse if bound non-loopback.

Fix

Add BodyLimit middleware mirroring chatserver.

Acceptance

  • Oversized request body → 413; middleware test.

Metadata

Metadata

Assignees

Labels

area/apiFor features/issues/fixes related to the usage of the cagent APIarea/securityAuthentication, authorization, secrets, vulnerabilitieskind/fixPR fixes a bug (maps to fix:). Use on PRs only.

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions