Skip to content

Commit

Permalink
enhance(log): improve secret mask buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Aug 16, 2023
1 parent 1e3aae6 commit 975d21a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ func (l *Log) MaskData(secrets []string) {
// create regexp to match secrets in the log data surrounded by regexp metacharacters
//
// https://pkg.go.dev/regexp#MustCompile
re := regexp.MustCompile((`(\s|^|=|"|:|'|\.|,)` + escaped + `(\s|$|"|:|'|\.|,)`))
buffer := `(\s|^|=|"|?|:|'|\.|,|&|$|;)`
re := regexp.MustCompile((buffer + escaped + buffer))

// create a mask for the secret
mask := fmt.Sprintf("$1%s$2", constants.SecretLogMask)
Expand Down

0 comments on commit 975d21a

Please sign in to comment.