Make config generation utils public (#1480)

* chore(generate): make utils public

* chore(generate): change validate log messages

* chore(generate): split functions into files

* chore(config): add warning for public funcs
This commit is contained in:
Richard Gomez authored and GitHub committed 2024-08-26 13:11:18 -05:00
1 parent 3be7faa1ff
commit bd81872eee
114 files changed
+862 -713

No files matched your search

+5 -4
View File
@@ -1,6 +1,7 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
@@ -21,7 +22,7 @@ func GCPServiceAccount() *config.Rule {
tps := []string{
`"type": "service_account"`,
}
return validate(r, tps, nil)
return utils.Validate(r, tps, nil)
}
func GCPAPIKey() *config.Rule {
@@ -29,7 +30,7 @@ func GCPAPIKey() *config.Rule {
r := config.Rule{
RuleID: "gcp-api-key",
Description: "Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches.",
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
Regex: utils.GenerateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
Keywords: []string{
"AIza",
@@ -38,7 +39,7 @@ func GCPAPIKey() *config.Rule {
// validate
tps := []string{
generateSampleSecret("gcp", secrets.NewSecret(`AIza[0-9A-Za-z\\-_]{35}`)),
utils.GenerateSampleSecret("gcp", secrets.NewSecret(`AIza[0-9A-Za-z\\-_]{35}`)),
}
return validate(r, tps, nil)
return utils.Validate(r, tps, nil)
}