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

fix file and cmd secret source inputs #6845

Merged
merged 1 commit into from Mar 12, 2024
Merged
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
4 changes: 2 additions & 2 deletions cmd/dagger/flags.go
Expand Up @@ -357,15 +357,15 @@ func (v *secretValue) Get(ctx context.Context, c *dagger.Client) (any, error) {
if err != nil {
return nil, fmt.Errorf("failed to read secret file %q: %w", v.sourceVal, err)
}
plaintext = string(filePlaintext)
plaintext = strings.TrimSpace(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 = string(stdoutBytes)
plaintext = strings.TrimSpace(string(stdoutBytes))

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