mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
29 lines
469 B
Go
29 lines
469 B
Go
package main
|
|
|
|
import (
|
|
_ "fmt"
|
|
"strings"
|
|
)
|
|
|
|
func checkRegex(diff string) ([]string, bool) {
|
|
var match string
|
|
var results []string
|
|
secretsPresent := false
|
|
lines := strings.Split(diff, "\n")
|
|
for _, line := range lines {
|
|
if len(line) == 0 {
|
|
continue
|
|
}
|
|
|
|
for _, re := range regexes {
|
|
match = re.FindString(line)
|
|
if len(match) == 0 {
|
|
continue
|
|
}
|
|
secretsPresent = true
|
|
results = append(results, line)
|
|
}
|
|
}
|
|
return results, secretsPresent
|
|
}
|