Skip to content

fix: CSV/TSVのformula injectionを無害化#32

Open
zac343 wants to merge 1 commit into
mimo-3:masterfrom
zac343:codex/csv-formula-neutralization
Open

fix: CSV/TSVのformula injectionを無害化#32
zac343 wants to merge 1 commit into
mimo-3:masterfrom
zac343:codex/csv-formula-neutralization

Conversation

@zac343

@zac343 zac343 commented Jul 16, 2026

Copy link
Copy Markdown

概要

  • CSV/TSV の文字列セルで、先頭(space / tab / CR / LF 後を含む)が =, +, -, @ の場合に apostrophe を付けて無害化
  • データ行だけでなく header と scalar string も同じルールで処理
  • scalar string は delimiter や改行を含んでも 1 record / 1 cell になるよう CSV writer 経由で出力
  • number / bool / null / JSON value と通常文字列の既存出力を維持

CSV の quoting だけでは表計算ソフト側の formula 評価を止められないため、文字列型に限定して neutralize します。

Fixes #16

検証

  • cargo +stable test --locked — 40 tests passed
  • cargo +stable clippy --locked -- -D warnings
  • cargo +stable fmt --check

補足: cargo +1.75.0 test --locked は、現行 lockfile の clap_lex 1.1.0 が Edition 2024 対応 Cargo を要求するため、crate のコンパイル前に停止します。本変更で使用した Rust API / 構文は 1.75 互換です。

@zac343
zac343 marked this pull request as ready for review July 16, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] CSV/TSV出力でformula injectionを無害化する

1 participant