Repository navigation
test(app): resolve env(1) absolutely so the scrub probe survives a pinned PATH - #1633
Merged
Merged
Conversation
TestCommandRunnerEnvironment_Scenario2_DefaultScrub pins PATH to /bin as a sentinel, to prove the secret scrub passes a benign variable through verbatim. But commandRunnerEnv invoked the probe as a bare `env`, so the same pinned PATH also had to be a directory where env(1) actually lives. On darwin it is not (/usr/bin/env), so the probe exited 127 with empty stdout and the test failed with "did not preserve default scrub:" and a blank environment dump -- blaming the scrub for a probe that never ran. Resolve env(1) once at package init, before any t.Setenv can narrow PATH, and invoke it by absolute path. The sentinel is now purely a value under assertion and need not be a usable PATH at all, which is the property the test actually means to pin. Init-time resolution is deliberate: a lazy sync.OnceValue would be too late, since the PATH-pinning test can be the first caller. Not a runtime.GOOS skip: this is the Finding B secret-scrub oracle, and skipping it on darwin would put the hole on the platform much of the development happens on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
6 tasks done
jhrozek
approved these changes
Sep 17, 2026
Merged
2 tasks
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
TestCommandRunnerEnvironment_Scenario2_DefaultScrubpinsPATH=/binas a sentinel toprove the secret scrub passes a benign variable through verbatim — but the probe ran as a
bare
env, so that same sentinel also had to be a directory containingenv(1). On macOSit is not, so the probe exited 127 and the test failed as a scrub failure with a blank
environment dump.
Resolve
env(1)at package init, before anyt.Setenvcan narrowPATH, and invoke it byabsolute path. Init-time is deliberate: a lazy lookup could run after the pinning test.
Not a
GOOSskip — this is the Finding B scrub oracle, and skipping it on darwin puts thehole on the platform much of the development happens on.
Type of change
Test plan
TestCommandRunnerEnvironment_*scenarios pass; fullinternal/appgreentask lint— 0 issuesUser-facing change
None — test-only.