mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +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
@@ -2,6 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
@@ -12,7 +13,7 @@ func PlaidAccessID() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "plaid-client-id",
|
||||
Description: "Uncovered a Plaid Client ID, which could lead to unauthorized financial service integrations and data breaches.",
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24"), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("24"), true),
|
||||
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{
|
||||
@@ -22,9 +23,9 @@ func PlaidAccessID() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("plaid", secrets.NewSecret(alphaNumeric("24"))),
|
||||
utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func PlaidSecretKey() *config.Rule {
|
||||
@@ -32,7 +33,7 @@ func PlaidSecretKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "plaid-secret-key",
|
||||
Description: "Detected a Plaid Secret key, risking unauthorized access to financial accounts and sensitive transaction data.",
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30"), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("30"), true),
|
||||
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{
|
||||
@@ -42,9 +43,9 @@ func PlaidSecretKey() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("plaid", secrets.NewSecret(alphaNumeric("30"))),
|
||||
utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("30"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func PlaidAccessToken() *config.Rule {
|
||||
@@ -52,8 +53,8 @@ func PlaidAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "plaid-api-token",
|
||||
Description: "Discovered a Plaid API Token, potentially compromising financial data aggregation and banking services.",
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"},
|
||||
fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"plaid"},
|
||||
fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()), true),
|
||||
|
||||
Keywords: []string{
|
||||
"plaid",
|
||||
@@ -62,7 +63,7 @@ func PlaidAccessToken() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()))),
|
||||
utils.GenerateSampleSecret("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
Reference in new issue
Block a user