mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
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:
1 parent
3be7faa1ff
commit
bd81872eee
114 files changed
+862
-713
No files matched your search
@@ -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,15 +11,15 @@ func DiscordAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Detected a Discord API key, potentially compromising communication channels and user data privacy on Discord.",
|
||||
RuleID: "discord-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64"), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.Hex("64"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("discord", secrets.NewSecret(hex("64"))),
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Hex("64"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func DiscordClientID() *config.Rule {
|
||||
@@ -26,15 +27,15 @@ func DiscordClientID() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a Discord client ID, which may lead to unauthorized integrations and data exposure in Discord applications.",
|
||||
RuleID: "discord-client-id",
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18"), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.Numeric("18"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("discord", secrets.NewSecret(numeric("18"))),
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("18"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func DiscordClientSecret() *config.Rule {
|
||||
@@ -42,13 +43,13 @@ func DiscordClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a potential Discord client secret, risking compromised Discord bot integrations and data leaks.",
|
||||
RuleID: "discord-client-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32"), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"discord"}, utils.AlphaNumericExtended("32"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("discord", secrets.NewSecret(numeric("32"))),
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("32"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
Reference in new issue
Block a user