Conversation
Entire-Checkpoint: 01KY7V1VPA7BTC8YG9XWSA4DC4
There was a problem hiding this comment.
Pull request overview
Adds a small utility to redact explicit -e/--env values from container runner argument lists before they’re written to debug logs, reducing the chance of leaking secrets in log output.
Changes:
- Introduces
container.RedactEnvArgsto copy and redact env flag values in an args slice. - Adds unit tests covering separate and inline
-e/--envforms plus non-env args. - Updates Docker/Podman runner and profile container exec debug logging to use the redacted args.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/runners/util/container/redact.go | Adds the argument redaction helper used for safe logging. |
| internal/runners/util/container/redact_test.go | Adds tests to validate redaction behavior and non-mutation of input args. |
| internal/runners/podman/run.go | Logs redacted args instead of raw args for Podman execution. |
| internal/runners/docker/run.go | Logs redacted args instead of raw args for Docker execution. |
| internal/profiles/profiles.go | Logs redacted args instead of raw args when starting the profile container. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+32
| func RedactEnvArgs(args []string) []string { | ||
| redacted := append([]string(nil), args...) | ||
|
|
||
| for i := 0; i < len(redacted); i++ { | ||
| switch redacted[i] { | ||
| case "-e", "--env": | ||
| if i+1 < len(redacted) { | ||
| redacted[i+1] = redactEnvSpec(redacted[i+1]) | ||
| i++ | ||
| } | ||
| default: | ||
| for _, prefix := range []string{"-e=", "--env="} { | ||
| if spec, ok := strings.CutPrefix(redacted[i], prefix); ok { | ||
| redacted[i] = prefix + redactEnvSpec(spec) | ||
| break | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return redacted | ||
| } |
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.
No description provided.