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

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

Offen
#2,439 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
15.9k
Forks
1.4k
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
163

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.