diff --git a/cmd/generate/config/base/config.go b/cmd/generate/config/base/config.go index bb1a95db..8728d75f 100644 --- a/cmd/generate/config/base/config.go +++ b/cmd/generate/config/base/config.go @@ -2,9 +2,9 @@ package base import ( "fmt" - "regexp" "strings" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/config" ) diff --git a/cmd/generate/config/rules/1password.go b/cmd/generate/config/rules/1password.go index 6074b387..d1da4f92 100644 --- a/cmd/generate/config/rules/1password.go +++ b/cmd/generate/config/rules/1password.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" diff --git a/cmd/generate/config/rules/age.go b/cmd/generate/config/rules/age.go index 62986e44..08b97cd8 100644 --- a/cmd/generate/config/rules/age.go +++ b/cmd/generate/config/rules/age.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/aws.go b/cmd/generate/config/rules/aws.go index 10f48db3..bf0977ca 100644 --- a/cmd/generate/config/rules/aws.go +++ b/cmd/generate/config/rules/aws.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" diff --git a/cmd/generate/config/rules/azure.go b/cmd/generate/config/rules/azure.go index 0f73cf7f..8460d1c4 100644 --- a/cmd/generate/config/rules/azure.go +++ b/cmd/generate/config/rules/azure.go @@ -2,7 +2,8 @@ package rules import ( "fmt" - "regexp" + + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/clojars.go b/cmd/generate/config/rules/clojars.go index 01096241..454c3f73 100644 --- a/cmd/generate/config/rules/clojars.go +++ b/cmd/generate/config/rules/clojars.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/curl.go b/cmd/generate/config/rules/curl.go index 5b978c28..a107df4b 100644 --- a/cmd/generate/config/rules/curl.go +++ b/cmd/generate/config/rules/curl.go @@ -2,7 +2,7 @@ package rules import ( "fmt" - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/doppler.go b/cmd/generate/config/rules/doppler.go index 2f269777..a5cf0b71 100644 --- a/cmd/generate/config/rules/doppler.go +++ b/cmd/generate/config/rules/doppler.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/duffel.go b/cmd/generate/config/rules/duffel.go index 0bbe7ffe..5c249916 100644 --- a/cmd/generate/config/rules/duffel.go +++ b/cmd/generate/config/rules/duffel.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/dynatrace.go b/cmd/generate/config/rules/dynatrace.go index 9051242d..698d1c14 100644 --- a/cmd/generate/config/rules/dynatrace.go +++ b/cmd/generate/config/rules/dynatrace.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/easypost.go b/cmd/generate/config/rules/easypost.go index 2719be17..0d159682 100644 --- a/cmd/generate/config/rules/easypost.go +++ b/cmd/generate/config/rules/easypost.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/flutterwave.go b/cmd/generate/config/rules/flutterwave.go index 1f9add49..eaaa7f13 100644 --- a/cmd/generate/config/rules/flutterwave.go +++ b/cmd/generate/config/rules/flutterwave.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/frameio.go b/cmd/generate/config/rules/frameio.go index 2de2dc2b..738e913b 100644 --- a/cmd/generate/config/rules/frameio.go +++ b/cmd/generate/config/rules/frameio.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/freemius.go b/cmd/generate/config/rules/freemius.go index 933647ad..2c926f28 100644 --- a/cmd/generate/config/rules/freemius.go +++ b/cmd/generate/config/rules/freemius.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/gcp.go b/cmd/generate/config/rules/gcp.go index 854d3718..0ddbe7c2 100644 --- a/cmd/generate/config/rules/gcp.go +++ b/cmd/generate/config/rules/gcp.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/generic.go b/cmd/generate/config/rules/generic.go index 45a893ff..0d71b3ca 100644 --- a/cmd/generate/config/rules/generic.go +++ b/cmd/generate/config/rules/generic.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" @@ -127,7 +127,7 @@ func GenericCredential() *config.Rule { `[DEBUG] org.neo4j.neo4j-graphdb-api:jar:3.5.12:test`, `apiUrl=apigee.corpint.com`, // TODO: Jetbrains IML files (requires line-level allowlist). - //`` + // `` // Auth `author = "james.fake@ymail.com",`, @@ -156,9 +156,9 @@ func GenericCredential() *config.Rule { `minisat-master-keying:x64-uwp=fail`, `IceSSL.KeyFile=s_rsa1024_priv.pem`, `"bucket_key": "SalesResults-1.2"`, - //``, + // ``, ``, - //`packageKey":` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`), + // `packageKey":` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`), `schemaKey = 'DOC_Vector_5_32'`, `sequenceKey = "18"`, `app.keystore.file=env/cert.p12`, @@ -166,15 +166,15 @@ func GenericCredential() *config.Rule { ` doc.Security.KeySize = PdfEncryptionKeySize.Key128Bit;`, `o.keySelector=n,o.haKey=!1,`, // TODO: Requires line-level allowlists. - //``, + // ``, // `secret: - //secretName: app-decryption-secret - //items: + // secretName: app-decryption-secret + // items: // - key: app-k8s.yml // path: app-k8s.yml`, // TODO: https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-theme-resources - //`#FFBAE4FF`, + // `#FFBAE4FF`, // Password `password combination. diff --git a/cmd/generate/config/rules/github.go b/cmd/generate/config/rules/github.go index f719cd25..46fc7aa8 100644 --- a/cmd/generate/config/rules/github.go +++ b/cmd/generate/config/rules/github.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/gitlab.go b/cmd/generate/config/rules/gitlab.go index b36481ba..80227ca1 100644 --- a/cmd/generate/config/rules/gitlab.go +++ b/cmd/generate/config/rules/gitlab.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/harness.go b/cmd/generate/config/rules/harness.go index 151c1f8f..c2b7f25c 100644 --- a/cmd/generate/config/rules/harness.go +++ b/cmd/generate/config/rules/harness.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/hashicorp.go b/cmd/generate/config/rules/hashicorp.go index 3c491bfe..faca380e 100644 --- a/cmd/generate/config/rules/hashicorp.go +++ b/cmd/generate/config/rules/hashicorp.go @@ -2,7 +2,8 @@ package rules import ( "fmt" - "regexp" + + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/hashicorp_vault.go b/cmd/generate/config/rules/hashicorp_vault.go index 4ea935c6..3f644607 100644 --- a/cmd/generate/config/rules/hashicorp_vault.go +++ b/cmd/generate/config/rules/hashicorp_vault.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/jwt.go b/cmd/generate/config/rules/jwt.go index fca91952..de0b66f8 100644 --- a/cmd/generate/config/rules/jwt.go +++ b/cmd/generate/config/rules/jwt.go @@ -3,8 +3,8 @@ package rules import ( b64 "encoding/base64" "fmt" - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/kubernetes.go b/cmd/generate/config/rules/kubernetes.go index c29e1699..7c460b02 100644 --- a/cmd/generate/config/rules/kubernetes.go +++ b/cmd/generate/config/rules/kubernetes.go @@ -2,7 +2,8 @@ package rules import ( "fmt" - "regexp" + + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/config" @@ -42,7 +43,7 @@ func KubernetesSecret() *config.Rule { regexp.MustCompile(`[\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:\{\{[ \t\w"|$:=,.-]+}}|""|'')`), // TODO: Requires multiple allowlists to target match. // Avoid overreach between directives. - //regexp.MustCompile(`(kind:(.|\s)+\n---\n(.|\s)+\bdata:|data:(.|\s)+\n---\n(.|\s)+\bkind:)`), + // regexp.MustCompile(`(kind:(.|\s)+\n---\n(.|\s)+\bdata:|data:(.|\s)+\n---\n(.|\s)+\bkind:)`), }, }, }, @@ -250,9 +251,9 @@ type: Opaque // name: mysecret // creationPolicy: Owner // - //--- + // --- // - //kind: ConfigMap + // kind: ConfigMap // data: // conversionStrategy: Default // decodingStrategy: None diff --git a/cmd/generate/config/rules/linear.go b/cmd/generate/config/rules/linear.go index 3ff257ad..6ca10835 100644 --- a/cmd/generate/config/rules/linear.go +++ b/cmd/generate/config/rules/linear.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/nuget.go b/cmd/generate/config/rules/nuget.go index 0035ac09..820df91e 100644 --- a/cmd/generate/config/rules/nuget.go +++ b/cmd/generate/config/rules/nuget.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/openshift.go b/cmd/generate/config/rules/openshift.go index 8ecf1b84..bcc7ac33 100644 --- a/cmd/generate/config/rules/openshift.go +++ b/cmd/generate/config/rules/openshift.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/privatekey.go b/cmd/generate/config/rules/privatekey.go index dca4383c..567aea33 100644 --- a/cmd/generate/config/rules/privatekey.go +++ b/cmd/generate/config/rules/privatekey.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/pypi.go b/cmd/generate/config/rules/pypi.go index 8b6f9852..aed4ce3c 100644 --- a/cmd/generate/config/rules/pypi.go +++ b/cmd/generate/config/rules/pypi.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/sentry.go b/cmd/generate/config/rules/sentry.go index 945ec92c..5055bd14 100644 --- a/cmd/generate/config/rules/sentry.go +++ b/cmd/generate/config/rules/sentry.go @@ -2,7 +2,7 @@ package rules import ( "encoding/base64" - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" diff --git a/cmd/generate/config/rules/shopify.go b/cmd/generate/config/rules/shopify.go index 87bddd66..b16fce71 100644 --- a/cmd/generate/config/rules/shopify.go +++ b/cmd/generate/config/rules/shopify.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/sidekiq.go b/cmd/generate/config/rules/sidekiq.go index 711db089..a3bf81df 100644 --- a/cmd/generate/config/rules/sidekiq.go +++ b/cmd/generate/config/rules/sidekiq.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" diff --git a/cmd/generate/config/rules/slack.go b/cmd/generate/config/rules/slack.go index 51baf2b7..caee497a 100644 --- a/cmd/generate/config/rules/slack.go +++ b/cmd/generate/config/rules/slack.go @@ -2,7 +2,7 @@ package rules import ( "fmt" - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/teams.go b/cmd/generate/config/rules/teams.go index aae5aa92..64920565 100644 --- a/cmd/generate/config/rules/teams.go +++ b/cmd/generate/config/rules/teams.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/rules/twilio.go b/cmd/generate/config/rules/twilio.go index 0ab5986d..3b078772 100644 --- a/cmd/generate/config/rules/twilio.go +++ b/cmd/generate/config/rules/twilio.go @@ -1,7 +1,7 @@ package rules import ( - "regexp" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils" "github.com/zricethezav/gitleaks/v8/config" diff --git a/cmd/generate/config/utils/generate.go b/cmd/generate/config/utils/generate.go index 7cf5df56..2acf2c86 100644 --- a/cmd/generate/config/utils/generate.go +++ b/cmd/generate/config/utils/generate.go @@ -6,8 +6,9 @@ package utils import ( "fmt" - "regexp" "strings" + + regexp "github.com/wasilibs/go-re2" ) const ( @@ -92,20 +93,20 @@ func GenerateSampleSecrets(identifier string, secret string) []string { "ini - unquoted2": "{i}Token = {s}", // JSON "json - string": "{\n \"{i}_token\": \"{s}\"\n}", - //TODO: "json - escaped string": "\\{\n \\\"{i}_token\\\": \\\"{s}\\\"\n\\}", - //TODO: "json - string key/value": "{\n \"name\": \"{i}_token\",\n \"value\": \"{s}\"\n}", + // TODO: "json - escaped string": "\\{\n \\\"{i}_token\\\": \\\"{s}\\\"\n\\}", + // TODO: "json - string key/value": "{\n \"name\": \"{i}_token\",\n \"value\": \"{s}\"\n}", // XML - //TODO: "xml - element": "<{i}Token>{s}", + // TODO: "xml - element": "<{i}Token>{s}", "xml - element multiline": "<{i}Token>\n {s}\n", - //TODO: "xml - attribute": "", - //TODO: "xml - key/value elements": "\n \n \n", + // TODO: "xml - attribute": "", + // TODO: "xml - key/value elements": "\n \n \n", // YAML "yaml - singleline - unquoted": "{i}_token: {s}", "yaml - singleline - single quote": "{i}_token: '{s}'", "yaml - singleline - double quote": "{i}_token: \"{s}\"", - //TODO: "yaml - multiline - literal": "{i}_token: |\n {s}", - //TODO: "yaml - multiline - folding": "{i}_token: >\n {s}", - //"": "", + // TODO: "yaml - multiline - literal": "{i}_token: |\n {s}", + // TODO: "yaml - multiline - folding": "{i}_token: >\n {s}", + // "": "", // Programming Languages "C#": `string {i}Token = "{s}";`, @@ -113,26 +114,26 @@ func GenerateSampleSecrets(identifier string, secret string) []string { "go - short": `{i}Token := "{s}"`, "go - backticks": "{i}Token := `{s}`", "java": "String {i}Token = \"{s}\";", - //TODO: "java - escaped quotes": `config.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"JDOE35\" {i}Token=\"{s}\""`, - //TODO:"kotlin - type": "var {i}Token: string = \"{s}\"", + // TODO: "java - escaped quotes": `config.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"JDOE35\" {i}Token=\"{s}\""`, + // TODO:"kotlin - type": "var {i}Token: string = \"{s}\"", "kotlin - notype": "var {i}Token = \"{s}\"", "php - string concat": `${i}Token .= "{s}"`, - //TODO: "php - null coalesce": `${i}Token ??= "{s}"`, + // TODO: "php - null coalesce": `${i}Token ??= "{s}"`, "python - single quote": "{i}Token = '{s}'", "python - double quote": `{i}Token = "{s}"`, - //"": "", + // "": "", // Miscellaneous - //TODO: "url - basic auth": `https://{i}:{s}@example.com/`, - //TODO: "url - query parameter": "https://example.com?{i}Token={s}&fooBar=baz", - //TODO: "comment - slash": "//{s} is the password", - //TODO: "comment - slash multiline": "/*{s} is the password", - //TODO: "comment - hashtag": "#{s} is the password", - //TODO: "comment - semicolon": ";{s} is the password", - //TODO: "csv - unquoted": `{i}Token,{s},`, + // TODO: "url - basic auth": `https://{i}:{s}@example.com/`, + // TODO: "url - query parameter": "https://example.com?{i}Token={s}&fooBar=baz", + // TODO: "comment - slash": "//{s} is the password", + // TODO: "comment - slash multiline": "/*{s} is the password", + // TODO: "comment - hashtag": "#{s} is the password", + // TODO: "comment - semicolon": ";{s} is the password", + // TODO: "csv - unquoted": `{i}Token,{s},`, "logstash": " \"{i}Token\" => \"{s}\"", - //TODO: "sql - tabular": "|{s}|", - //TODO: "sql": "", + // TODO: "sql - tabular": "|{s}|", + // TODO: "sql": "", // Makefile // See: https://github.com/gitleaks/gitleaks/pull/1191 @@ -141,9 +142,9 @@ func GenerateSampleSecrets(identifier string, secret string) []string { "make - shell assignment": "{i}_TOKEN ::= \"{s}\"", "make - evaluated shell assignment": "{i}_TOKEN :::= \"{s}\"", "make - conditional assignment": "{i}_TOKEN ?= \"{s}\"", - //TODO: "make - append": "{i}_TOKEN += \"{s}\"", + // TODO: "make - append": "{i}_TOKEN += \"{s}\"", - //"": "", + // "": "", } replacer := strings.NewReplacer("{i}", identifier, "{s}", secret) diff --git a/config/allowlist.go b/config/allowlist.go index 39ae8632..0ae8b7b7 100644 --- a/config/allowlist.go +++ b/config/allowlist.go @@ -2,9 +2,9 @@ package config import ( "fmt" - "regexp" "strings" + regexp "github.com/wasilibs/go-re2" "golang.org/x/exp/maps" ) diff --git a/config/allowlist_test.go b/config/allowlist_test.go index c66304bb..827a31e6 100644 --- a/config/allowlist_test.go +++ b/config/allowlist_test.go @@ -2,12 +2,12 @@ package config import ( "errors" - "regexp" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/assert" + regexp "github.com/wasilibs/go-re2" ) func TestCommitAllowed(t *testing.T) { diff --git a/config/config.go b/config/config.go index c04a19be..0d167b18 100644 --- a/config/config.go +++ b/config/config.go @@ -3,12 +3,12 @@ package config import ( _ "embed" "fmt" - "regexp" "sort" "strings" "github.com/rs/zerolog/log" "github.com/spf13/viper" + regexp "github.com/wasilibs/go-re2" ) //go:embed gitleaks.toml diff --git a/config/config_test.go b/config/config_test.go index d1385737..a0ddbc58 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -2,10 +2,10 @@ package config import ( "fmt" - "regexp" "testing" "github.com/google/go-cmp/cmp" + regexp "github.com/wasilibs/go-re2" "github.com/spf13/viper" "github.com/stretchr/testify/assert" diff --git a/config/rule.go b/config/rule.go index bee767de..b32f556b 100644 --- a/config/rule.go +++ b/config/rule.go @@ -2,8 +2,9 @@ package config import ( "fmt" - "regexp" "strings" + + regexp "github.com/wasilibs/go-re2" ) // Rules contain information that define details on how to detect secrets diff --git a/config/utils.go b/config/utils.go index ada6ff0f..04161b96 100644 --- a/config/utils.go +++ b/config/utils.go @@ -1,7 +1,7 @@ package config import ( - "regexp" + regexp "github.com/wasilibs/go-re2" ) func anyRegexMatch(f string, res []*regexp.Regexp) bool { diff --git a/detect/detect_test.go b/detect/detect_test.go index 2432e9de..0cca5488 100644 --- a/detect/detect_test.go +++ b/detect/detect_test.go @@ -4,7 +4,6 @@ import ( "fmt" "os" "path/filepath" - "regexp" "testing" "github.com/google/go-cmp/cmp" @@ -12,6 +11,7 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + regexp "github.com/wasilibs/go-re2" "github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/report" diff --git a/go.mod b/go.mod index cfcd3aa1..81ef1111 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/rs/zerolog v1.26.1 github.com/spf13/cobra v1.2.1 github.com/spf13/viper v1.8.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 ) @@ -32,6 +32,8 @@ require ( github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68 // indirect github.com/muesli/termenv v0.15.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect + github.com/tetratelabs/wazero v1.8.2 // indirect + github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect golang.org/x/crypto v0.29.0 // indirect ) @@ -50,6 +52,7 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.2.0 // indirect + github.com/wasilibs/go-re2 v1.8.0 golang.org/x/sync v0.9.0 // indirect golang.org/x/sys v0.27.0 // indirect golang.org/x/text v0.20.0 // indirect diff --git a/go.sum b/go.sum index a80d5378..bf45e1f8 100644 --- a/go.sum +++ b/go.sum @@ -284,10 +284,17 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tetratelabs/wazero v1.8.2 h1:yIgLR/b2bN31bjxwXHD8a3d+BogigR952csSDdLYEv4= +github.com/tetratelabs/wazero v1.8.2/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= +github.com/wasilibs/go-re2 v1.8.0 h1:6wpqZ31vdoJRSOM41bWEd1AbSmRe161yQkTzoihqwEg= +github.com/wasilibs/go-re2 v1.8.0/go.mod h1:RjA3Y/yW6xFL8Iyz8f5sVhttLq5b5DRF8baZ7Sh+elk= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4= +github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=