Browse Source

Fix Plaid, add Plaid access token (#903)

* adding airtable and adafruit

* Fix plaid, add plaid-access-token
Zachary Rice 3 years ago
parent
commit
e78a22e19c
3 changed files with 37 additions and 5 deletions
  1. 1 0
      cmd/generate/config/main.go
  2. 25 3
      cmd/generate/config/rules/plaid.go
  3. 11 2
      config/gitleaks.toml

+ 1 - 0
cmd/generate/config/main.go

@@ -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())

+ 25 - 3
cmd/generate/config/rules/plaid.go

@@ -1,6 +1,8 @@
 package rules
 
 import (
+	"fmt"
+
 	"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
 	"github.com/zricethezav/gitleaks/v8/config"
 )
@@ -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{
@@ -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)
+}

+ 11 - 2
config/gitleaks.toml

@@ -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"