Skip to content

perf: pipeline git-hash blob extraction, harden CSV against formula injection - #51

Merged
coldhighsun merged 1 commit into
mainfrom
perf/git-snapshot-and-csv-hardening
Sep 12, 2026
Merged

perf: pipeline git-hash blob extraction, harden CSV against formula injection#51
coldhighsun merged 1 commit into
mainfrom
perf/git-snapshot-and-csv-hardening

Conversation

@coldhighsun

Copy link
Copy Markdown
Owner

Summary

  • Pipelines git cat-file --batch requests on a background writer thread instead of a blocking write-then-read round trip per blob, so --git-hash extraction overlaps request writes with response reads.
  • Streams git ls-tree record parsing instead of buffering the entire listing into one byte array and one decoded string.
  • Replaces the List<byte> + ToArray() per header-line read with a growable byte[], and wraps both process stdout streams in a BufferedStream.
  • Guards CsvRenderer against CSV formula injection: a path or skip-reason starting with =, +, -, @, or tab is now prefixed with a quote before export.
  • Collapses AnalyzeHandler's four near-identical per-format (Json/Html/Csv/Markdown) output branches into a single CreateRenderer dispatcher.

Test plan

  • dotnet build Sloc.slnx — 0 warnings, 0 errors
  • dotnet test Sloc.slnx — 335/335 passing (includes new CSV formula-injection test cases)
  • Smoke-tested --git-hash HEAD against this repo to confirm the extraction pipeline still produces correct output

…njection

Pipelines git cat-file --batch requests on a background writer thread instead
of one blocking write-then-read round trip per blob, streams ls-tree record
parsing instead of buffering the whole listing, and avoids a List<byte> +
ToArray() allocation per header line read. Also guards CsvRenderer against
CSV formula injection (a path or skip-reason starting with =, +, -, @, or tab
is prefixed with a quote) and collapses AnalyzeHandler's four near-identical
per-format output branches into one dispatcher.
@coldhighsun
coldhighsun merged commit 3314a7a into main Sep 12, 2026
5 checks passed
@coldhighsun
coldhighsun deleted the perf/git-snapshot-and-csv-hardening branch September 12, 2026 14:56
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.

1 participant