Sanitization requires color, which parses every record
まだ誰も着手していません。
- #420 @kskalski による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
src/writer/mod.rs:134 から始め、色が無効な場合の AutoStream のパスを sanitization と anstyle-parse の処理を通して追跡します。記載されたベンチマークを再現し、その後、C0 および DEL バイトが無効化され、newline と tab が変更されず、色のパスに影響がなく、正当な非 ASCII 入力が選択した動作に従って処理されることを検証します。
索引モデルが issue の本文から書いたものです。
説明
Problem
With styling disabled, AutoStream still walks every record through anstyle-parse's VT state machine, roughly doubling per-record cost even for builds emitting no styling.
Target::Stderr → /dev/null, 161-byte records, 500k iterations, release + LTO, 8 interleaved rounds:
| ns/record | |
|---|---|
with color |
596 |
without color |
302 |
Turning off just auto-color doesn't avoid it — WriteStyle::Auto then collapses to Never (src/writer/mod.rs:134), making the parse unconditional. Only dropping color entirely removes the parser.
However dropping color also removes sanitization, as the two share a code path, so untrusted input then reaches the reader's terminal verbatim:
Note: deactivating the build-time feature
coloris not a mitigation as that
removes all ANSI escape code stripping fromenv_logger.
Neither configuration avoids both. The coupling isn't required though: without color there is no styling emitted, so nothing needs parsing, only payload bytes need neutralizing.
Proposal
Escape C0 and DEL as \xNN when color is off, sparing \n and \t.
- 319 ns/record measured, so sanitizing costs ~17 ns over the unsafe build today
colorpath untouched, no behavior change for anyone using it- differs from the strip it replaces in both directions:
- stricter on
\r, VT and FF, whichanstreampasses through - more permissive on raw C1 and stray continuation bytes, which
anstreamdrops (matching it there needs full UTF-8 validation — ~20 lines, free for ASCII records, ~+40 ns/record for records with legitimate non-ASCII)
- stricter on
- 主要言語
- Rust
- スター
- 1.1k
- フォーク
- 150
- 平均マージ
- 3分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-cli/env_logger のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
rust-cli/env_logger#379 · コメント 5 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
rust-cli/env_logger#369 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
rust-cli/env_logger#367 · コメント 1 件 ·
-
refactor the crate to separate the provided configurable formater and the optional custom formatterオープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rust-cli/env_logger#365 · コメント 10 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
rust-cli/env_logger#364 · コメント 11 件 · リアクション 2 件 ·
rust-cli/env_logger の issue をすべて見る
似ている issue
-
install.ps1: Windows PowerShell 5.1 aborts after a successful cosign verification (NativeCommandError on 'Verified OK')対応中かも @sly321-pixel が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
ai_p2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ClickHouse/ClickHouse#125522 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: OpenRouter streaming chunks report the requested router name instead of the model OpenRouter served対応中かも @Mrun25 が今日担当しました。 オープンbug llm translation
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
BerriAI/litellm#46095 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
cline/mcp-marketplace#2942 ·