Skip to content

fix(ssh): refuse or escape PowerShell smart quotes in a Windows --remote-bin #56

Closed

Description

@abruption

What happened

Security and stability hardening audit finding TS-08 / Low (2026-09-28). Priority is an audit recommendation, not a claim of a production incident.

For --remote-platform win32, --remote-bin is validated with ^[A-Za-z]:\\[^\r\n]+$ and embedded in a PowerShell single-quoted string by doubling ASCII ' only. PowerShell also treats U+2018, U+2019, U+201A and U+201B as single-quote delimiters. A value such as C:\a’;calc;# produces the encoded command & 'C:\a’;calc;#' --version, which PowerShell tokenizes as a closed string followed by calc.

Confirmed by decoding the generated -EncodedCommand; not executed (no PowerShell in the audit environment).

What you expected

Either restrict --remote-bin for Windows to printable ASCII (as the POSIX branch already does) or escape all PowerShell single-quote characters.

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: stub ssh executable capturing argv; no network connection.

Source evidence

Acceptance criteria

  • Smart single quotes in a Windows --remote-bin are refused or escaped.
  • Unit test decoding the generated encoded command for each quote variant.

Scope and limitations

Hardening only: --remote-bin is supplied by the caller, who already has SSH access to the remote host, and it cannot be set through a Reply-To URI. No privilege boundary is crossed.

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