fix: valueMasker concurrent map write (#5026)
* valueMasker create secrets copy Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
@@ -144,6 +144,10 @@ func withStepLogger(ctx context.Context, stepID string, stepName string, stageNa
|
|||||||
type entryProcessor func(entry *logrus.Entry) *logrus.Entry
|
type entryProcessor func(entry *logrus.Entry) *logrus.Entry
|
||||||
|
|
||||||
func valueMasker(insecureSecrets bool, secrets map[string]string) entryProcessor {
|
func valueMasker(insecureSecrets bool, secrets map[string]string) entryProcessor {
|
||||||
|
ssecrets := []string{}
|
||||||
|
for _, v := range secrets {
|
||||||
|
ssecrets = append(ssecrets, v)
|
||||||
|
}
|
||||||
return func(entry *logrus.Entry) *logrus.Entry {
|
return func(entry *logrus.Entry) *logrus.Entry {
|
||||||
if insecureSecrets {
|
if insecureSecrets {
|
||||||
return entry
|
return entry
|
||||||
@@ -151,7 +155,7 @@ func valueMasker(insecureSecrets bool, secrets map[string]string) entryProcessor
|
|||||||
|
|
||||||
masks := Masks(entry.Context)
|
masks := Masks(entry.Context)
|
||||||
|
|
||||||
for _, v := range secrets {
|
for _, v := range ssecrets {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
entry.Message = strings.ReplaceAll(entry.Message, v, "***")
|
entry.Message = strings.ReplaceAll(entry.Message, v, "***")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user