Skip to content

Commit

Permalink
refactor(secret): optimize performance by moving ToLower operation ou…
Browse files Browse the repository at this point in the history
…tside loop (#7862)
  • Loading branch information
Yeatesss authored Nov 5, 2024
1 parent a6a45b3 commit 2529b58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/fanal/secret/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ func (r *Rule) MatchKeywords(content []byte) bool {
if len(r.Keywords) == 0 {
return true
}

var contentLower = bytes.ToLower(content)
for _, kw := range r.Keywords {
if bytes.Contains(bytes.ToLower(content), []byte(strings.ToLower(kw))) {
if bytes.Contains(contentLower, []byte(strings.ToLower(kw))) {
return true
}
}
Expand Down

0 comments on commit 2529b58

Please sign in to comment.