Repository navigation
Conversation
Redaction replaces a secret value as a literal substring wherever it
appears, with no minimum length. A one-character value under a
credential-bearing key therefore masked that character everywhere in
captured subprocess output: "v1.2.3" became "v***.2.3" and a docker
volume mountpoint became a path that does not exist, so writing the
agent binary into the volume failed with ENOENT.
Skip values below minRedactableValueLength and report them through
SkippedValueCount, so a genuinely short secret is surfaced rather than
silently left unmasked. The Redactor already computed this length for
its replacer but never used it.
Two existing tests used sub-threshold fixtures ("hunter2", "sec"); they
now use realistic values that still exercise the behavior they cover.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Result.Stdout is redacted, but several callers parse it as data rather than display it. A redactor that masked any character of a value then corrupted the value itself: the docker volume mountpoint became a path that does not exist, and the agent version and seed labels parsed wrong. Add Result.RawStdout plus Options.UnredactedStdout so those callers can use the output verbatim while Stdout, Stderr and DiagnosticOutput stay redacted for display. RawStdout is empty unless requested, so the default path is unchanged. This mirrors the UnredactedStdout option pkg/git already used for `git credential fill`. Route the volume mountpoint, managed volume listing, detected agent version and seed label parsing in pkg/agent/delivery through raw capture, along with the rendered environment template in pkg/devcontainer/crane, which reaches subprocess through the options-based entry point. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The eight failures that surfaced this bug only reproduce when the ambient
environment happens to hold a credential-bearing variable with a
low-entropy value. On a clean CI runner they pass, so the regression
would not have been caught by the new unit-test job.
Inject the offending variable explicitly through the delivery
Environment field and assert that both consumers of machine-readable
docker output survive it: the volume mountpoint, which is used as a
filesystem path, and the detected agent version, which is compared
verbatim.
Both fail against the unfixed code with the original symptom
("v1.2.3" reported as "v***.2.3", and a mountpoint path rewritten to
"00***"), and pass once the capture path is separated from redaction.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comments restated what the code already says. Cut them back to the part that is not derivable: why a value must be long enough to mask, and why the docker output is captured unredacted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
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
Redaction replaces a secret value as a literal substring wherever it appears, with no minimum length. A one-character value under a credential-bearing key therefore masked that character everywhere in captured subprocess output.
On a machine with such a variable set, this produced two concrete failures:
v1.2.3becamev***.2.3ENOENTThe capture path was also conflating two different things:
subprocess.Result.Stdoutis redacted for display, but several callers parse it as data.Changes
pkg/secrets—NewRedactorskips values belowminRedactableValueLength(8) and reports them throughSkippedValueCount, so a genuinely short secret is surfaced rather than silently left unmasked. TheRedactoralready computed this length for its replacer but never used it.pkg/subprocess— addsResult.RawStdoutandOptions.UnredactedStdout, so callers that parse command output can use it verbatim whileStdout,StderrandDiagnosticOutputstay redacted for display.RawStdoutis empty unless requested, so the default path is unchanged. This mirrors theUnredactedStdoutoptionpkg/gitalready used forgit credential fill.Callers routed through raw capture — the volume mountpoint, managed volume listing, detected agent version and seed label parsing in
pkg/agent/delivery, and the rendered environment template inpkg/devcontainer/crane.Verification
mainand pass here, same environment.pkg/secretstests while leaving delivery green.Note for review
NewRedactornow leaves values under 8 characters unmasked, andSkippedValueCountexists to report them. Whether 8 is the right threshold, and whether callers should surface that count, is a security tradeoff worth a second opinion.