perf: pipeline git-hash blob extraction, harden CSV against formula injection - #51
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
git cat-file --batchrequests on a background writer thread instead of a blocking write-then-read round trip per blob, so--git-hashextraction overlaps request writes with response reads.git ls-treerecord parsing instead of buffering the entire listing into one byte array and one decoded string.List<byte>+ToArray()per header-line read with a growablebyte[], and wraps both process stdout streams in aBufferedStream.CsvRendereragainst CSV formula injection: a path or skip-reason starting with=,+,-,@, or tab is now prefixed with a quote before export.AnalyzeHandler's four near-identical per-format (Json/Html/Csv/Markdown) output branches into a singleCreateRendererdispatcher.Test plan
dotnet build Sloc.slnx— 0 warnings, 0 errorsdotnet test Sloc.slnx— 335/335 passing (includes new CSV formula-injection test cases)--git-hash HEADagainst this repo to confirm the extraction pipeline still produces correct output