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"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
@@ -10,7 +11,7 @@ func ShippoAPIToken() *config.Rule {
r := config.Rule{
RuleID: "shippo-api-token",
Description: "Discovered a Shippo API token, potentially compromising shipping services and customer order data.",
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
Regex: utils.GenerateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
Keywords: []string{
"shippo_",
@@ -19,8 +20,8 @@ func ShippoAPIToken() *config.Rule {
// validate
tps := []string{
generateSampleSecret("shippo", "shippo_live_"+secrets.NewSecret(hex("40"))),
generateSampleSecret("shippo", "shippo_test_"+secrets.NewSecret(hex("40"))),
utils.GenerateSampleSecret("shippo", "shippo_live_"+secrets.NewSecret(utils.Hex("40"))),
utils.GenerateSampleSecret("shippo", "shippo_test_"+secrets.NewSecret(utils.Hex("40"))),
}
return validate(r, tps, nil)
return utils.Validate(r, tps, nil)
}