rust-cli / rust-cli/anstyle

Support stripping of dangerous ANSI codes

Open
#298 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
171
Forks
44
Avg merge
2h 34m
Merged PRs (30d)
6

Description

anstream currently has two modes: Printing all ANSI sequences, and stripping all ANSI sequences (StripStream). Would it be possible to add a third mode SanitizeStream, that allows color and similar text formatting streams, but strips potentially dangerous actions such as setting the terminal title?

This request is due to https://github.com/tokio-rs/tracing/issues/3378, where tracing now allows either escaping ANSI (not stripping, leading to bad output with strange characters), or turning off this validation completely. Does this fit in the scope of anstyle?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing StripStream behavior and the requested SanitizeStream mode described here. Establish which formatting sequences remain allowed and which dangerous actions, such as terminal-title changes, must be removed; done means preserving color and similar text formatting while stripping those actions.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.