Skip to content

Commit

Permalink
Fix Plaid, add Plaid access token (#903)
Browse files Browse the repository at this point in the history
* adding airtable and adafruit

* Fix plaid, add plaid-access-token
  • Loading branch information
zricethezav committed Jun 27, 2022
1 parent 9cc19ec commit e78a22e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmd/generate/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func main() {
configRules = append(configRules, rules.NPM())
configRules = append(configRules, rules.NytimesAccessToken())
configRules = append(configRules, rules.PlaidAccessID())
configRules = append(configRules, rules.PlaidSecretKey())
configRules = append(configRules, rules.PlaidAccessToken())
configRules = append(configRules, rules.PlanetScalePassword())
configRules = append(configRules, rules.PlanetScaleAPIToken())
Expand Down
28 changes: 25 additions & 3 deletions cmd/generate/config/rules/plaid.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package rules

import (
"fmt"

"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
Expand All @@ -24,11 +26,11 @@ func PlaidAccessID() *config.Rule {
return validate(r, tps, nil)
}

func PlaidAccessToken() *config.Rule {
func PlaidSecretKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "plaid-api-secret",
Description: "Plaid API Secret",
RuleID: "plaid-secret-key",
Description: "Plaid Secret key",
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30")),
SecretGroup: 1,
Keywords: []string{
Expand All @@ -42,3 +44,23 @@ func PlaidAccessToken() *config.Rule {
}
return validate(r, tps, nil)
}

func PlaidAccessToken() *config.Rule {
// define rule
r := config.Rule{
RuleID: "plaid-api-token",
Description: "Plaid API Token",
Regex: generateSemiGenericRegex([]string{"plaid"},
fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12())),
SecretGroup: 1,
Keywords: []string{
"plaid",
},
}

// validate
tps := []string{
generateSampleSecret("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()))),
}
return validate(r, tps, nil)
}
13 changes: 11 additions & 2 deletions config/gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,23 @@ keywords = [
]

[[rules]]
description = "Plaid API Secret"
id = "plaid-api-secret"
description = "Plaid Secret key"
id = "plaid-secret-key"
regex = '''(?i)(?:plaid)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{30})(?:['|\"|\n|\r|\s|\x60]|$)'''
secretGroup = 1
keywords = [
"plaid",
]

[[rules]]
description = "Plaid API Token"
id = "plaid-api-token"
regex = '''(?i)(?:plaid)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60]|$)'''
secretGroup = 1
keywords = [
"plaid",
]

[[rules]]
description = "PlanetScale password"
id = "planetscale-password"
Expand Down

0 comments on commit e78a22e

Please sign in to comment.