Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert secret whitespace stripping #7271

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Breaking-20240507-134020.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Breaking
body: Remove space stripping from secret arguments
time: 2024-05-07T13:40:20.158396621-03:00
custom:
Author: marcosnils
PR: "7271"
4 changes: 2 additions & 2 deletions cmd/dagger/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@ func (v *secretValue) Get(ctx context.Context, c *dagger.Client, _ *dagger.Modul
if err != nil {
return nil, fmt.Errorf("failed to read secret file %q: %w", v.sourceVal, err)
}
plaintext = strings.TrimSpace(string(filePlaintext))
plaintext = string(filePlaintext)

case commandSecretSource:
// #nosec G204
stdoutBytes, err := exec.CommandContext(ctx, "sh", "-c", v.sourceVal).Output()
if err != nil {
return nil, fmt.Errorf("failed to run secret command %q: %w", v.sourceVal, err)
}
plaintext = strings.TrimSpace(string(stdoutBytes))
plaintext = string(stdoutBytes)

default:
return nil, fmt.Errorf("unsupported secret arg source: %q", v.secretSource)
Expand Down