mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
fix(vault-service-token): ensure that TPS contains digits (#1614)
* fix(vault-service-token): ensure that TPS contains digits Chances of randomly generating a 24 letter string without digits: P = ( (26+26) / (26+26+10) ) ^ 24 = 1.46 % * fixt --------- Co-authored-by: Zachary Rice <zricer@protonmail.com> Co-authored-by: Zachary Rice <zachary.rice@trufflesec.com>
This commit is contained in:
1 file changed
+8
-9
@@ -1,10 +1,11 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func VaultServiceToken() *config.Rule {
|
||||
@@ -26,16 +27,14 @@ func VaultServiceToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
// Old
|
||||
tps := utils.GenerateSampleSecrets("vault", "s."+secrets.NewSecret(`s\.[a-zA-Z0-9]{24}`))
|
||||
tps = append(tps,
|
||||
tps := []string{
|
||||
// Old
|
||||
utils.GenerateSampleSecret("vault", secrets.NewSecret(`s\.[0-9][a-zA-Z0-9]{23}`)),
|
||||
`token: s.ZC9Ecf4M5g9o34Q6RkzGsj0z`,
|
||||
)
|
||||
// New
|
||||
tps = append(tps, utils.GenerateSampleSecrets("vault", secrets.NewSecret(`hvs\.[\w\-]{90}`))...)
|
||||
tps = append(tps,
|
||||
// New
|
||||
utils.GenerateSampleSecret("vault", secrets.NewSecret(`hvs\.[0-9][\w\-]{89}`)),
|
||||
`-vaultToken hvs.CAESIP2jTxc9S2K7Z6CtcFWQv7-044m_oSsxnPE1H3nF89l3GiYKHGh2cy5sQmlIZVNyTWJNcDRsYWJpQjlhYjVlb1cQh6PL8wEYAg"`, // longer than 100 chars
|
||||
)
|
||||
}
|
||||
|
||||
fps := []string{
|
||||
// Old
|
||||
|
||||
Reference in new issue
Block a user