feat(harness): redact .env lines from pi grep output (finish ENG-2926) - #63
Merged
Merged
Conversation
Completes the broad-grep residual left by #59. The pi tool wrapper already blocks a grep that *names* .env, but a repo-wide grep (path ".") still scanned it and returned its lines. The wrapper holds each tool's result, so it can now strip .env-sourced lines from the grep tool's output via redactSecretGrepLines — parity with the anthropic harness's PostToolUse redaction. (Corrects #59's note that pi has "no output-rewrite hook": the wrapper itself is that hook.)
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
Closes the one genuine residual from ENG-2926 that PR #59 left open: pi's broad-grep output.
#59 gave the pi harness a
.envinput-path guard (a grep that names.envis refused) and added the anthropic PostToolUse grep redaction — but a repo-wide pi grep (path: ".") still scanned.envand returned its lines, because the guard only checks the input path. #59's note said pi had "no tool-output-rewrite hook"; that was wrong — theguardSecretFileToolswrapper already holds each tool's result, so it is the hook.This applies
redactSecretGrepLines(the same helper the anthropic PostToolUse hook uses) to the grep tool's output in the pi wrapper, stripping.env-sourced lines before they reach the model..env.examplelines are kept; non-grep tools are untouched.Now both harnesses have parity: input-path deny + broad-grep output redaction.
Testing
npm run lintcleannpm run typecheckcleannpm test— 170 passed. The redaction logic itself (redactSecretGrepLines) is unit-tested from feat(harness): extend .env guard to pi harness + redact broad-grep leaks #59 (.env-sourced lines dropped,.env.examplekept, files-with-matches form); this change is the wrapper glue that applies it to pi grep results.Security & Compliance
🤖 Generated with Claude Code