Skip to content

feat(harness): redact .env lines from pi grep output (finish ENG-2926) - #63

Merged
itelo merged 1 commit into
mainfrom
itelo/eng-2926-pi-grep-output-redaction
Aug 25, 2026
Merged

feat(harness): redact .env lines from pi grep output (finish ENG-2926)#63
itelo merged 1 commit into
mainfrom
itelo/eng-2926-pi-grep-output-redaction

Conversation

@itelo

@itelo itelo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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 .env input-path guard (a grep that names .env is refused) and added the anthropic PostToolUse grep redaction — but a repo-wide pi grep (path: ".") still scanned .env and 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 — the guardSecretFileTools wrapper 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.example lines are kept; non-grep tools are untouched.

Now both harnesses have parity: input-path deny + broad-grep output redaction.

Testing

Security & Compliance

  • Security hardening; no secrets in the diff.

🤖 Generated with Claude Code

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.)
@itelo
itelo requested a review from razor-x as a code owner August 25, 2026 14:34
@itelo
itelo merged commit 91dd1a2 into main Aug 25, 2026
11 checks passed
@itelo
itelo deleted the itelo/eng-2926-pi-grep-output-redaction branch August 25, 2026 14:37
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