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

+7 -6
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 KucoinAccessToken() *config.Rule {
r := config.Rule{
RuleID: "kucoin-access-token",
Description: "Found a Kucoin Access Token, risking unauthorized access to cryptocurrency exchange services and transactions.",
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24"), true),
Regex: utils.GenerateSemiGenericRegex([]string{"kucoin"}, utils.Hex("24"), true),
Keywords: []string{
"kucoin",
@@ -19,9 +20,9 @@ func KucoinAccessToken() *config.Rule {
// validate
tps := []string{
generateSampleSecret("kucoin", secrets.NewSecret(hex("24"))),
utils.GenerateSampleSecret("kucoin", secrets.NewSecret(utils.Hex("24"))),
}
return validate(r, tps, nil)
return utils.Validate(r, tps, nil)
}
func KucoinSecretKey() *config.Rule {
@@ -29,7 +30,7 @@ func KucoinSecretKey() *config.Rule {
r := config.Rule{
RuleID: "kucoin-secret-key",
Description: "Discovered a Kucoin Secret Key, which could lead to compromised cryptocurrency operations and financial data breaches.",
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12(), true),
Regex: utils.GenerateSemiGenericRegex([]string{"kucoin"}, utils.Hex8_4_4_4_12(), true),
Keywords: []string{
"kucoin",
@@ -38,7 +39,7 @@ func KucoinSecretKey() *config.Rule {
// validate
tps := []string{
generateSampleSecret("kucoin", secrets.NewSecret(hex8_4_4_4_12())),
utils.GenerateSampleSecret("kucoin", secrets.NewSecret(utils.Hex8_4_4_4_12())),
}
return validate(r, tps, nil)
return utils.Validate(r, tps, nil)
}