sec (7/9): redact declared scanner env values from error text#31
Open
jesse-merhi wants to merge 1 commit into
Open
sec (7/9): redact declared scanner env values from error text#31jesse-merhi wants to merge 1 commit into
jesse-merhi wants to merge 1 commit into
Conversation
A user-defined scanner declares env vars precisely because they carry secrets. When the command fails, commandError composes an error string from stderr that can echo those secret values, and that string persists in ScannerResult.Error. Scrub the value of every declared env var from the error text, regardless of the variable name, so credentials never survive in the artifact even when the name evades the generic secret-name heuristic.
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: sec (7/9): redact declared scanner env values from error text This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
This was referenced Jul 24, 2026
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.
What changes
When a user-defined scanner fails, the values of its declared
env:vars arescrubbed from the error text before the message is stored in the run artifact.
The declared value is replaced with
[redacted].Why it matters
A scanner's
env:entries exist to hand it secrets. If the scanner fails andprints one of those secrets to stderr, that stderr is folded into the artifact's
error field — persisting the secret. The existing secret-name heuristic can
miss an oddly named var, so this redacts by the actual declared value: any
env var the scanner declared has its value stripped from error text regardless
of how it is named.
Before / after (runnable)
Scanner that leaks its declared secret to stderr, then fails:
leaking-value=supersekretleaking-value=[redacted]; raw value absent(
env: {SECRET_TOKEN: "present"}in the artifact confirms presence-onlyrecording is unchanged.)
Verify
Covers name sanitization, value redaction, and the end-to-end
"secret leaked to stderr →
[redacted]in the scanner error" path.