Generate tps (#845)

* WIP

* simplify tp generation
This commit is contained in:
Zachary Rice authored and GitHub committed 2022-04-18 21:59:38 -05:00
1 parent d8cd93cabe
commit 3474c58c9e
58 files changed
+264 -337

No files matched your search

+5 -6
View File
@@ -1,8 +1,7 @@
package rules
import (
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
@@ -11,14 +10,14 @@ func AdobeClientID() *config.Rule {
r := config.Rule{
Description: "Adobe Client ID (Oauth Web)",
RuleID: "adobe-client-id",
Regex: generateSemiGenericRegex([]string{"adobe"}, hex32),
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32")),
SecretGroup: 1,
Keywords: []string{"adobe"},
}
// validate
tps := []string{
"adobeClient := \"" + sampleHex32Token + "\"",
generateSampleSecret("adobe", secrets.NewSecret(hex("32"))),
}
return validate(r, tps)
}
@@ -28,13 +27,13 @@ func AdobeClientSecret() *config.Rule {
r := config.Rule{
Description: "Adobe Client Secret",
RuleID: "adobe-client-secret",
Regex: regexp.MustCompile(`(p8e-)(?i)[a-z0-9]{32}`),
Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`),
Keywords: []string{"p8e-"},
}
// validate
tps := []string{
"adobeClient := \"p8e-" + sampleHex32Token + "\"",
"adobeClient := \"p8e-" + secrets.NewSecret(hex("32")) + "\"",
}
return validate(r, tps)
}