Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions executor/linux/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,15 @@ func getSecretValues(ctn *pipeline.Container) []string {
secretValues := []string{}
// gather secrets' values from the environment map for masking
for _, secret := range ctn.Secrets {
s := ctn.Environment[strings.ToUpper(secret.Target)]
// capture secret from environment
s, ok := ctn.Environment[strings.ToUpper(secret.Target)]
if !ok {
continue
}
// handle multi line secrets from files
s = strings.ReplaceAll(s, "\n", " ")

// drop any trailing spaces
if strings.HasSuffix(s, " ") {
s = s[:(len(s) - 1)]
}
secretValues = append(secretValues, s)
secretValues = append(secretValues, strings.TrimSuffix(s, " "))
}
return secretValues
}
4 changes: 4 additions & 0 deletions executor/linux/step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ func TestLinux_getSecretValues(t *testing.T) {
Source: "someOtherSource",
Target: "secret_password",
},
{
Source: "disallowedSecret",
Target: "cannot_find",
},
},
},
},
Expand Down