Repository navigation
Description
What happened
Security and stability hardening audit finding TS-01 / Medium (2026-09-28). Priority is an audit recommendation, not a claim of a production incident. This is the TypeScript counterpart of abruption/session-peer#237.
Codex delivery passes the body as a separate argv element after the option name: codex queue --thread <id> --message <text>. A body that starts with - is parsed by codex's clap parser as an option instead of text.
With codex-cli 0.157.1 and an empty temporary CODEX_HOME, the bodies --help, -x hello, -1 and - first item each failed with a clap usage error (exit 2) before any queue access, while --message=<text> parsed them and reached the expected "no rollout found" error.
A normal send is protected by the From: header prefix, but when CODEX_THREAD_ID/CODEX_SESSION_ID is absent (for example a sender that is not itself a Codex thread) or --no-from is used, the body is passed unchanged. Leading newlines are stripped by envelope(), so "\n- item" is affected too. The SSH path always sends the remote request with --no-from --no-reply-to, so the remote host hits the same argv.
Because any non-zero codex exit is mapped to CodexUnknownOutcome, a deterministic parser rejection is reported as {"error":"outcome_unknown","status":"unknown","submitted":null,"retryAllowed":false}. --dry-run returns validated for the same body because it returns before invoking codex.
What you expected
Any non-empty body, including one starting with - or --, is queued as text. Pass --message=<text> as a single argv element. A parser rejection that provably happened before queue access should not be reported as an unknown outcome.
Environment
- Baseline: published session-peer 0.2.0 (npm
latest), repository commit38a1300369443e064f58bb18e8bda70f31af0fbb. - Audit environment: macOS arm64, Node 22.14.0.
- No live message tests or production mutation.
- Reproduction: codex-cli 0.157.1 with an empty temporary
CODEX_HOMEand a nonexistent thread ID. Nothing was queued.
Source evidence
- src/send.ts#L57 — dry-run returns before the native call
- src/send.ts#L59-L62 —
['queue', '--thread', id, '--message', options.message]; any non-zero exit becomesCodexUnknownOutcome - src/protocol.ts#L29-L34 —
From:prefix only when a sender UUID is present and--no-fromis not set - src/cli.ts#L134 — SSH remote request always adds
--no-from --no-reply-to
Acceptance criteria
- Codex argv uses
--message=<text>as a single element. - Contract tests with bodies
-x,--help,- item,--,-1and a multiline body starting with-, locally and through the SSH request path. - Verified against the supported codex-cli version with a temporary home.
- Dry-run and real send agree on whether a body is accepted; existing size and NUL validation unchanged.
Scope and limitations
No shell is involved; this is option parsing, not command injection. No other codex option can be injected: every probe ended in a usage error. Unix-socket and named-pipe delivery are not affected.
Checked
- Searched existing issues in this repository and in abruption/session-peer for duplicates.
- Removed credentials, conversation contents, private paths and real device/session identifiers.
- Used isolated fixtures without weakening inbound permissions.
Activity
fix: harden Codex delivery, CLI parsing, SSH and output (#49-#57) (#62)