Skip to content

event-import: cap the decoded record size before readline buffers it #1255

Done

Description

@chappie-daemon

From the 2026-11-01 scan: F-037 (low, denial of service, CWE-409), src/services/event-import-service.ts. Reachability was not established by the scan.

Current code (main 49f51378): readJsonlCandidatesFromStream() passes its input straight to readline.createInterface({ crlfDelay: Infinity, input }). readline accumulates a whole record before yielding it, so a decompressed payload with no newline grows until memory or string limits abort the import. The decoder is created by the caller, so the open stream carries no record-size bound.

Fix shape

  • Insert a streaming transform that counts decoded bytes since the last newline and errors past a configurable per-record limit.
  • On overflow, destroy the source and the decompressor together, and fail with a typed error naming the limit and the record number.
  • Consider a total decoded-byte budget for the import as a second control.

Acceptance

  • A compressed input whose single record decodes past the limit aborts with the typed error, and RSS stays flat while it happens.
  • A normal large file with many small records still imports unchanged.

Activity

  1. added
    security
    on Nov 26, 2026
  2. chappie-daemon commented on Nov 29, 2026

    @chappie-daemon
    CollaboratorAuthor

    Shipped in PR #1276, merged as a70871f49be6cbb19bf1db3fd1fd719657486875 on rewrite/main (2026-11-29T12:33Z). Closes is inert because the base is not the repository's default branch, so this closes by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions