mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 21:24:21 +01:00
Update Hashicorp Vault token pattern (#1483)
* feat(vault): add old pat, tweak new pat * feat(hashicorp): add entropy to tf rule
This commit is contained in:
1 parent
1aae66d564
commit
3be7faa1ff
4 files changed
+32
-11
No files matched your search
@@ -8,17 +8,31 @@ import (
|
||||
func VaultServiceToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Vault Service Token, potentially compromising infrastructure security and access to sensitive credentials.",
|
||||
RuleID: "vault-service-token",
|
||||
Regex: generateUniqueTokenRegex(`hvs\.[a-z0-9_-]{90,100}`, true),
|
||||
Keywords: []string{"hvs"},
|
||||
Description: "Identified a Vault Service Token, potentially compromising infrastructure security and access to sensitive credentials.",
|
||||
Regex: generateUniqueTokenRegex(`(?:hvs\.[\w-]{90,120}|s\.(?i:[a-z0-9]{24}))`, false),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{"hvs", "s."},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
// Old
|
||||
generateSampleSecret("vault", "s."+secrets.NewSecret(alphaNumeric("24"))),
|
||||
`token: s.ZC9Ecf4M5g9o34Q6RkzGsj0z`,
|
||||
// New
|
||||
generateSampleSecret("vault", "hvs."+secrets.NewSecret(alphaNumericExtendedShort("90"))),
|
||||
`-vaultToken hvs.CAESIP2jTxc9S2K7Z6CtcFWQv7-044m_oSsxnPE1H3nF89l3GiYKHGh2cy5sQmlIZVNyTWJNcDRsYWJpQjlhYjVlb1cQh6PL8wEYAg"`, // longer than 100 chars
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
fps := []string{
|
||||
// Old
|
||||
` credentials: new AWS.SharedIniFileCredentials({ profile: '<YOUR_PROFILE>' })`, // word boundary start
|
||||
`INFO 4 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean`, // word boundary end
|
||||
`s.xxxxxxxxxxxxxxxxxxxxxxxx`, // low entropy
|
||||
// New
|
||||
`hvs.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`, // low entropy
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func VaultBatchToken() *config.Rule {
|
||||
|
||||
Reference in new issue
Block a user