ag-ui-protocol / ag-ui-protocol/ag-ui

[BUG]: Rust community SDK buffers without bounds and never dispatches CRLF-terminated frames

Abierto
#2,439 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
15.9k
Forks
1.4k
Merge medio
1 d 17 h
PR fusionados (30 d)
163

Descripción

# Rust community SDK buffers without bounds and never dispatches CRLF-terminated frames

Repository: https://github.com/ag-ui-protocol/ag-ui
Affected: community Rust SDK — `crates/ag-ui-client/src/sse.rs:75-145`
CWE: CWE-400 (Uncontrolled Resource Consumption)

## Summary

Two issues in the SSE frame parser:

1. Buffering is unbounded — no per-frame or total-size limit.
2. Frames are dispatched only on LF-style termination. The SSE specification permits `\r\n` (and `\r`) line endings; a stream using `\r\n` never completes a frame, so its bytes accumulate in the buffer for the entire connection.

## Impact

Memory exhaustion from either oversized events or spec-legal CRLF framing from a misbehaving or malicious endpoint. Availability only.

## Suggested remediation

- Treat `\r\n` and lone `\r` as line terminators.
- Enforce per-frame data-size and total-budget caps (see the Dart SDK's limits).

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.