Skip to content

fix(output): escape bidi and zero-width format characters in text output #54

Closed

Description

@abruption

What happened

Security and stability hardening audit finding TS-06 / Low (2026-09-28). Priority is an audit recommendation, not a claim of a production incident. Related to abruption/session-peer#239, which covers control characters only.

Text output escapes C0, DEL, C1 and U+2028/U+2029, but not bidirectional formatting or zero-width characters. In a synthetic HOME, a session name in a fixture session record containing U+202E (RLO), U+2066/U+2069 (isolates) and U+200B was printed verbatim by list --output-format text, so the visual order of agent:id name home=... can be spoofed on one line. Names come from local session records, Codex thread titles (usually derived from the first prompt) or a remote list response over SSH.

What you expected

Text output escapes U+061C, U+200B–U+200F, U+202A–U+202E, U+2060–U+2069 and U+FEFF in the same \uXXXX form, while preserving other Unicode. JSON output is unchanged.

Environment

  • Baseline: published session-peer 0.2.0 (npm latest), repository commit 38a1300369443e064f58bb18e8bda70f31af0fbb.
  • Audit environment: macOS arm64, Node 22.14.0.
  • No live message tests or production mutation.
  • Reproduction: synthetic HOME with a fixture session record; no connection was made.

Source evidence

Acceptance criteria

  • Bidi and zero-width format characters are escaped in all text output fields.
  • Test with RLO, isolates, ZWSP and BOM in names and paths.

Scope and limitations

Display spoofing only; targets are still matched on the raw value and ambiguity is refused.

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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions