Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

livekit/agents
main @ 04f3fdd
19
Fixes
50
CVEs
CRITICAL
Peak severity
44.4%
Coverage
Highlights
Denial of Service: 16 prior fixes. Scrutinize any change in this area.
livekit-agents/livekit/agents/voice/agent_session.py: most-fixed (3 issues). Treat as high-risk during review.
1 high-severity fix in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Denial of Service: Supervised process startup sequences and socket connections leaked system resources on cancellation or initialization failures. Sockets and child processes must be explicitly cleaned up using robust exception handlers that terminate uninitialized processes and close socket pairs.
Auth Bypass: An authorization check (can_manage_agent_session) was missing when registering byte stream handlers, allowing incoming remote session byte stream messages to be processed and outbound messages to be sent without proper permissions.
Denial of Service: Resource exhaustion and dangling connections occurred when connection teardown handlers failed to catch BaseException (such as asyncio.CancelledError), allowing the cleanup of failed connection pools to be bypassed.