Skip to content

[Bug]: A control frame with no id kills the terminal daemon and every terminal on the host #17841

Closed

Description

@klaidliadon

Operating system: Linux (observed on Synology DSM; the code path has no platform branch)
Orca version: built from main at 94e758666 — between v1.4.191 and v1.4.192


One control frame whose id is missing or not a string takes the terminal daemon
down, and every terminal on the host with it — the process deliberately kept alive
so terminals outlive the runtime, the supervisor and an update.

DaemonServer.handleRequest reads request.id one line above the try/catch that
is already there:

const isNotify = request.id.startsWith(NOTIFY_PREFIX)   // outside the try
try { ... }

That throws a TypeError, escapes as an unhandled rejection, reaches the daemon's
uncaughtException handler, and is rethrown because it is not a native PTY error.

Repro:

  1. Connect to the daemon's control socket.
  2. Write one NDJSON line that is valid JSON with no usable id — {}, null, or
    {"id": 123}.
  3. The daemon exits. Every terminal on the host dies with it.

Three places independently allow it: the NDJSON boundary
(createNdjsonParser hands through any parsed JSON, null included, and the
callback asserts as DaemonRequest over it), the dispatch site
(void this.handleRequest(...) lets any rejection escape), and the id read
itself.

An unknown method is fine and already gets an error reply — that path was never
the problem. Only an unroutable frame is fatal, and it cannot be replied to anyway
since correlation needs the id it did not carry.

Activity

  1. klaidliadon commented on Sep 1, 2026

    @klaidliadon
    Author

    Update: there is a second, unauthenticated variant of this, found while reviewing the fix. Worth recording here because it changes the severity of the issue as filed.

    The same unchecked cast sits one frame earlier, on the hello handler in daemon-client-connections.ts:

    const hello = message as HelloMessage
    if (hello.type !== 'hello') {

    JSON.parse('null') is a valid frame, so message can be null and the .type read throws.

    Two things make it worse than the control-frame case in the original report:

    1. The throw is synchronous, so it is an uncaught exception rather than a rejection. createNdjsonParser invokes onRecord outside the try that wraps JSON.parse (src/shared/main-process-ndjson-framer.ts), so it propagates straight out of the socket's data handler.
    2. It runs before the token comparison. No credentials are required — socket reachability is the only precondition.

    So on the original report's reproduction, null as the first frame kills the daemon without authenticating at all. Both paths are fixed in #17848.

  2. added
    bug
    orca-remote-server
    on Sep 19, 2026
  3. added theissue type on Sep 19, 2026
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

    bugorca-remote-server

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions