fix: keep the local checkout path out of the reproduction report - #30
Merged
Merged
Conversation
The clean-reproduction report recorded each command's output verbatim, and several commands echo their own working directory. That directory is a temporary checkout under the OS temp directory, which on most machines sits inside a home directory, so the published report carried a local user path: "tail": "> stateproof@1.0.0 typecheck C:\Users\<name>\AppData\..." The secret scanner has a rule for exactly that shape and did not fire, because JSON stores the separators doubled and the rule looks for single ones. Two changes, because either alone leaves a gap: - clean-reproduction replaces the checkout path with `<checkout>` at the point output is recorded. Both separators are covered, since tools disagree about which to print on Windows, and the resolved path is too, since macOS reports its temp directory through a symlink. - scan-secrets applies each rule to the unescaped text as well as the text as written, so a path cannot hide from it merely by being quoted into JSON. This is not specific to the absolute-path rule; any rule whose pattern contains a separator had the same blind spot. The report is regenerated, which is a fresh run of the reproduction and not an edit of a recorded result. It passed, and the scanner now reports CLEAN where it reported one finding before this change. Closes #13.
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.
Closes #13.
What was leaking
Several of the reproduced commands echo their own working directory, and the report records each command's output verbatim. That directory is a temporary checkout under the OS temp directory, which on most machines sits inside a home directory, so the published report carried a real local path:
The scanner has a rule for exactly that shape,
absolute-user-path, and it did not fire. JSON stores the separators doubled and the rule looks for single ones.Two changes, because either alone leaves a gap
clean-reproduction.tsreplaces the checkout path with<checkout>at the point output is recorded, rather than scrubbing the file afterwards. It covers both separators, since tools disagree about which to print on Windows, and the resolved path as well, since macOS reports its temp directory through a symlink. Replacement runs longest-variant-first so no path is partly rewritten by one of its own prefixes.scan-secrets.tsapplies each rule to the unescaped text as well as the text as written. This is deliberately not scoped to the absolute-path rule: any rule whose pattern contains a separator had the same blind spot, so the fix belongs at the point rules are applied. It is a second pass only when the text actually contains an escaped backslash.Verification
Both halves are demonstrated rather than asserted, since
vitestonly collectspackages/*/testandapps/*/test:pnpm scan:secretsreportsFINDING submission/clean-reproduction-report.json: an absolute local user path, excerptC:\Users\Haz. Before this change the same file scanned CLEAN.pnpm test:clean-reproductionre-ran end to end and PASSED. The regenerated report contains zero occurrences ofUsersand the tails now read> stateproof@1.0.0 typecheck <checkout>.pnpm scan:secretsnow reportsRESULT: CLEAN, 0 findings.pnpm typecheckpasses.The report is regenerated, which is a fresh run of the reproduction rather than an edit of a recorded result, as the issue anticipated.
Note
Low Risk
Overview
This PR sanitizes local filesystem paths from reproduction command output before they are persisted in the published report.
scripts/clean-reproduction.tsis updated to strip the temporary checkout prefix from each command's tail/cwd fields (replacing it with a neutral marker like<tmp>), andscripts/scan-secrets.tsgains a new scanner rule that detects absolute temp-directory paths matching the same shape so the leak can be caught going forward. The two regenerated artifacts undersubmission/(the JSON and Markdown report) reflect the change, now showing the redacted path instead of the real user temp directory.Written by Gitzilla for commit 1b6e675. This will update automatically on new runs. Configure in the Gitzilla dashboard.