build: support either stdlib or 3rd-party regexp (#1706)

This commit is contained in:
Richard Gomez authored and GitHub committed 2025-01-20 10:45:31 -06:00
1 parent 049f5b2435
commit 3f4d91fc22
47 files changed
+102 -123

No files matched your search

+1 -2
View File
@@ -4,9 +4,8 @@ import (
"fmt" "fmt"
"strings" "strings"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func CreateGlobalConfig() config.Config { func CreateGlobalConfig() config.Config {
+1 -2
View File
@@ -1,11 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// https://developer.1password.com/docs/service-accounts/security/?token-example=encoded // https://developer.1password.com/docs/service-accounts/security/?token-example=encoded
+1 -2
View File
@@ -1,10 +1,9 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func AgeSecretKey() *config.Rule { func AgeSecretKey() *config.Rule {
+1 -2
View File
@@ -1,11 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func AWS() *config.Rule { func AWS() *config.Rule {
+2 -4
View File
@@ -3,12 +3,10 @@ package rules
import ( import (
"fmt" "fmt"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// References: // References:
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func Clojars() *config.Rule { func Clojars() *config.Rule {
+1 -1
View File
@@ -2,10 +2,10 @@ package rules
import ( import (
"fmt" "fmt"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// https://curl.se/docs/manpage.html#-u // https://curl.se/docs/manpage.html#-u
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func Doppler() *config.Rule { func Doppler() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func Duffel() *config.Rule { func Duffel() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func Dynatrace() *config.Rule { func Dynatrace() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func EasyPost() *config.Rule { func EasyPost() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func FlutterwavePublicKey() *config.Rule { func FlutterwavePublicKey() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func FrameIO() *config.Rule { func FrameIO() *config.Rule {
+1 -2
View File
@@ -1,10 +1,9 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func Freemius() *config.Rule { func Freemius() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// TODO this one could probably use some work // TODO this one could probably use some work
+1 -2
View File
@@ -1,11 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func GenericCredential() *config.Rule { func GenericCredential() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
var githubAllowlist = []config.Allowlist{ var githubAllowlist = []config.Allowlist{
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// overview with all GitLab tokens: // overview with all GitLab tokens:
+2 -5
View File
@@ -1,13 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func HarnessApiKey() *config.Rule { func HarnessApiKey() *config.Rule {
+2 -4
View File
@@ -3,12 +3,10 @@ package rules
import ( import (
"fmt" "fmt"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func HashiCorpTerraform() *config.Rule { func HashiCorpTerraform() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func VaultServiceToken() *config.Rule { func VaultServiceToken() *config.Rule {
+1 -1
View File
@@ -4,10 +4,10 @@ import (
b64 "encoding/base64" b64 "encoding/base64"
"fmt" "fmt"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func JWT() *config.Rule { func JWT() *config.Rule {
+2 -4
View File
@@ -3,11 +3,9 @@ package rules
import ( import (
"fmt" "fmt"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// KubernetesSecret validates if we detected a kubernetes secret which contains data! // KubernetesSecret validates if we detected a kubernetes secret which contains data!
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func LinearAPIToken() *config.Rule { func LinearAPIToken() *config.Rule {
+2 -4
View File
@@ -1,11 +1,9 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func NugetConfigPassword() *config.Rule { func NugetConfigPassword() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// OpenShift 4 user tokens are prefixed with `sha256~`. // OpenShift 4 user tokens are prefixed with `sha256~`.
+1 -2
View File
@@ -1,10 +1,9 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func PrivateKey() *config.Rule { func PrivateKey() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func PyPiUploadToken() *config.Rule { func PyPiUploadToken() *config.Rule {
+1 -1
View File
@@ -2,11 +2,11 @@ package rules
import ( import (
"encoding/base64" "encoding/base64"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func SentryAccessToken() *config.Rule { func SentryAccessToken() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func ShopifySharedSecret() *config.Rule { func ShopifySharedSecret() *config.Rule {
+1 -2
View File
@@ -1,11 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func SidekiqSecret() *config.Rule { func SidekiqSecret() *config.Rule {
+2 -3
View File
@@ -2,12 +2,11 @@ package rules
import ( import (
"fmt" "fmt"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
// https://api.slack.com/authentication/token-types#bot // https://api.slack.com/authentication/token-types#bot
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func TeamsWebhook() *config.Rule { func TeamsWebhook() *config.Rule {
+2 -4
View File
@@ -1,12 +1,10 @@
package rules package rules
import ( import (
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func Twilio() *config.Rule { func Twilio() *config.Rule {
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"strings" "strings"
regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/regexp"
) )
const ( const (
+3
View File
@@ -16,6 +16,7 @@ import (
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/detect" "github.com/zricethezav/gitleaks/v8/detect"
"github.com/zricethezav/gitleaks/v8/logging" "github.com/zricethezav/gitleaks/v8/logging"
"github.com/zricethezav/gitleaks/v8/regexp"
"github.com/zricethezav/gitleaks/v8/report" "github.com/zricethezav/gitleaks/v8/report"
) )
@@ -110,6 +111,8 @@ func initConfig(source string) {
_, _ = fmt.Fprint(os.Stderr, banner) _, _ = fmt.Fprint(os.Stderr, banner)
} }
logging.Debug().Msgf("using %s regex engine", regexp.Version)
cfgPath, err := rootCmd.Flags().GetString("config") cfgPath, err := rootCmd.Flags().GetString("config")
if err != nil { if err != nil {
logging.Fatal().Msg(err.Error()) logging.Fatal().Msg(err.Error())
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt" "fmt"
"strings" "strings"
regexp "github.com/wasilibs/go-re2"
"golang.org/x/exp/maps" "golang.org/x/exp/maps"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
type AllowlistMatchCondition int type AllowlistMatchCondition int
+2 -1
View File
@@ -7,7 +7,8 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
func TestCommitAllowed(t *testing.T) { func TestCommitAllowed(t *testing.T) {
+1 -1
View File
@@ -7,9 +7,9 @@ import (
"strings" "strings"
"github.com/spf13/viper" "github.com/spf13/viper"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/logging" "github.com/zricethezav/gitleaks/v8/logging"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
//go:embed gitleaks.toml //go:embed gitleaks.toml
+2 -2
View File
@@ -5,11 +5,11 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
regexp "github.com/wasilibs/go-re2"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/zricethezav/gitleaks/v8/regexp"
) )
const configPath = "../testdata/config/" const configPath = "../testdata/config/"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/regexp"
) )
// Rules contain information that define details on how to detect secrets // Rules contain information that define details on how to detect secrets
+1 -1
View File
@@ -1,7 +1,7 @@
package config package config
import ( import (
regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/regexp"
) )
func anyRegexMatch(f string, res []*regexp.Regexp) bool { func anyRegexMatch(f string, res []*regexp.Regexp) bool {
+1 -1
View File
@@ -5,13 +5,13 @@ import (
"context" "context"
"fmt" "fmt"
"os" "os"
"regexp"
"strings" "strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/logging" "github.com/zricethezav/gitleaks/v8/logging"
"github.com/zricethezav/gitleaks/v8/regexp"
"github.com/zricethezav/gitleaks/v8/report" "github.com/zricethezav/gitleaks/v8/report"
ahocorasick "github.com/BobuSumisu/aho-corasick" ahocorasick "github.com/BobuSumisu/aho-corasick"
+1 -1
View File
@@ -12,10 +12,10 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
regexp "github.com/wasilibs/go-re2"
"github.com/zricethezav/gitleaks/v8/cmd/scm" "github.com/zricethezav/gitleaks/v8/cmd/scm"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/regexp"
"github.com/zricethezav/gitleaks/v8/report" "github.com/zricethezav/gitleaks/v8/report"
"github.com/zricethezav/gitleaks/v8/sources" "github.com/zricethezav/gitleaks/v8/sources"
) )
-2
View File
@@ -6,8 +6,6 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
) )
// TODO: Should this be a pointer?
// https://github.com/rs/zerolog/issues/1
var Logger zerolog.Logger var Logger zerolog.Logger
func init() { func init() {
+15
View File
@@ -0,0 +1,15 @@
//go:build stdregex
package regexp
import (
re "regexp"
)
const Version = "stdlib"
type Regexp = re.Regexp
func MustCompile(str string) *re.Regexp {
return re.MustCompile(str)
}
+15
View File
@@ -0,0 +1,15 @@
//go:build !stdregex
package regexp
import (
re "github.com/wasilibs/go-re2"
)
const Version = "github.com/wasilibs/go-re2"
type Regexp = re.Regexp
func MustCompile(str string) *re.Regexp {
return re.MustCompile(str)
}