Skip to content

security: cap the SSE reader line buffer #2

Closed

Description

@mrgoonie

Problem

The SSE line reader in src/api/sse-reader.ts builds up the current line, or event, with no size limit. A misbehaving or compromised server, or anything in the path that can inject bytes, can stream a huge line with no newline. The side panel then keeps growing memory until the tab is killed.

Found during the isolated review of the bootstrap work (#1).

Expected

  • Cap the line and event buffer, for example at 1 MiB, which is well above the largest legitimate frame (respond bodies are capped at 160 KiB).
  • When the cap is exceeded, stop the stream with a protocol_error. The panel then reconciles, as it does for other stream failures.

Acceptance

  • A unit test feeds an endless line and gets a protocol_error without unbounded growth.
  • Normal frames still parse.

Activity

  1. added
    ai-handleSẵn sàng để AI agent xử lý
    securityBảo mật và phân quyền
    in progressĐang được triển khai
    on Oct 11, 2026
  2. self-assigned this
    on Oct 12, 2026
  3. added a commit that references this issue on Oct 12, 2026
    f79f913
  4. added
    in reviewĐang được agent review
    and removed
    in progressĐang được triển khai
    on Oct 12, 2026
  5. added
    doneĐã tạo PR xong
    and removed
    in reviewĐang được agent review
    on Oct 12, 2026
  6. mrgoonie commented on Oct 12, 2026

    @mrgoonie
    ContributorAuthor

    PR #4 is open (Closes #2). It went through two rounds of isolated review, and every should-fix finding is fixed: frames completed before an overflow are kept, Stop during the cancel still maps to protocol_error, and a finished turn is not turned into an error. CI passes (check + e2e).

  7. added
    shippedĐã merge vào main
    and removed
    doneĐã tạo PR xong
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-handleSẵn sàng để AI agent xử lýsecurityBảo mật và phân quyềnshippedĐã merge vào main

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions