Skip to content

Escape service-supplied text in ts cache purge output #1562

Open

Description

@dhruv8sh

Description

ts cache purge writes text it receives from the service straight to the terminal. A compromised or misconfigured service can embed terminal control sequences (ANSI escapes, carriage returns) that rewrite or hide the operator's output.

Two places in crates/trusted-server-cli/src/commands/cache/purge.rs are affected:

  • the success path writes the raw response_body (writeln!(out, "{response_body}"), around line 70);
  • the failure path appends response_body.trim() to the purge failed: {status}{hint} error (around lines 83-86).

ts keys (PR #1500) already escapes service text with escape_terminal_text from ad_templates/output.rs; ts cache purge should do the same.

Done when

  • Both purge output paths pass service-supplied text through escape_terminal_text.
  • Regression tests feed a body containing \u{1b} and \r on success and failure and assert neither reaches the rendered output.

Affected area

CI / Tooling (ts CLI)

Activity

  1. added this to the 202611 milestone on Nov 12, 2026
  2. self-assigned this
    on Nov 12, 2026
  3. added theissue type on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions