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,7 +11,7 @@ func YandexAWSAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "yandex-aws-access-token",
|
||||
Description: "Uncovered a Yandex AWS Access Token, potentially compromising cloud resource access and data security on Yandex Cloud.",
|
||||
Regex: generateSemiGenericRegex([]string{"yandex"},
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"yandex"},
|
||||
`YC[a-zA-Z0-9_\-]{38}`, true),
|
||||
Keywords: []string{
|
||||
"yandex",
|
||||
@@ -19,10 +20,10 @@ func YandexAWSAccessToken() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("yandex",
|
||||
utils.GenerateSampleSecret("yandex",
|
||||
secrets.NewSecret(`YC[a-zA-Z0-9_\-]{38}`)),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func YandexAPIKey() *config.Rule {
|
||||
@@ -30,7 +31,7 @@ func YandexAPIKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "yandex-api-key",
|
||||
Description: "Discovered a Yandex API Key, which could lead to unauthorized access to Yandex services and data manipulation.",
|
||||
Regex: generateSemiGenericRegex([]string{"yandex"},
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"yandex"},
|
||||
`AQVN[A-Za-z0-9_\-]{35,38}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
@@ -40,10 +41,10 @@ func YandexAPIKey() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("yandex",
|
||||
utils.GenerateSampleSecret("yandex",
|
||||
secrets.NewSecret(`AQVN[A-Za-z0-9_\-]{35,38}`)),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func YandexAccessToken() *config.Rule {
|
||||
@@ -51,7 +52,7 @@ func YandexAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "yandex-access-token",
|
||||
Description: "Found a Yandex Access Token, posing a risk to Yandex service integrations and user data privacy.",
|
||||
Regex: generateSemiGenericRegex([]string{"yandex"},
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"yandex"},
|
||||
`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
@@ -61,8 +62,8 @@ func YandexAccessToken() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("yandex",
|
||||
utils.GenerateSampleSecret("yandex",
|
||||
secrets.NewSecret(`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`)),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
Reference in new issue
Block a user