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

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

Aperta
#2,439 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
15.9k
Fork
1.4k
Merge medio
1g 17h
PR unite (30g)
163

Descrizione

# 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).

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.