Преглед изворни кода

feat: add Airtable Personnal Access Token detection (#1952)

Samuel Gaist пре 2 месеци
родитељ
комит
c98e5e0d27
3 измењених фајлова са 25 додато и 2 уклоњено
  1. 2 1
      cmd/generate/config/main.go
  2. 17 1
      cmd/generate/config/rules/airtable.go
  3. 6 0
      config/gitleaks.toml

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

@@ -31,7 +31,8 @@ func main() {
 		rules.AdobeClientID(),
 		rules.AdobeClientID(),
 		rules.AdobeClientSecret(),
 		rules.AdobeClientSecret(),
 		rules.AgeSecretKey(),
 		rules.AgeSecretKey(),
-		rules.Airtable(),
+		rules.AirtableApiKey(),
+		rules.AirtablePersonalAccessToken(),
 		rules.AlgoliaApiKey(),
 		rules.AlgoliaApiKey(),
 		rules.AlibabaAccessKey(),
 		rules.AlibabaAccessKey(),
 		rules.AlibabaSecretKey(),
 		rules.AlibabaSecretKey(),

+ 17 - 1
cmd/generate/config/rules/airtable.go

@@ -1,12 +1,14 @@
 package rules
 package rules
 
 
 import (
 import (
+	"regexp"
+
 	"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
 	"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
 	"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
 	"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
 	"github.com/zricethezav/gitleaks/v8/config"
 	"github.com/zricethezav/gitleaks/v8/config"
 )
 )
 
 
-func Airtable() *config.Rule {
+func AirtableApiKey() *config.Rule {
 	// define rule
 	// define rule
 	r := config.Rule{
 	r := config.Rule{
 		Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
 		Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
@@ -19,3 +21,17 @@ func Airtable() *config.Rule {
 	tps := utils.GenerateSampleSecrets("airtable", secrets.NewSecret(utils.AlphaNumeric("17")))
 	tps := utils.GenerateSampleSecrets("airtable", secrets.NewSecret(utils.AlphaNumeric("17")))
 	return utils.Validate(r, tps, nil)
 	return utils.Validate(r, tps, nil)
 }
 }
+
+func AirtablePersonalAccessToken() *config.Rule {
+	// define rule
+	r := config.Rule{
+		Description: "Uncovered a possible Airtable Personal AccessToken, potentially compromising database access and leading to data leakage or alteration.",
+		RuleID:      "airtable-personnal-access-token",
+		Regex:       regexp.MustCompile(`\b(pat[[:alnum:]]{14}\.[a-f0-9]{64})\b`),
+		Keywords:    []string{"airtable"},
+	}
+
+	// validate
+	tps := utils.GenerateSampleSecrets("airtable", "pat"+secrets.NewSecret(utils.AlphaNumeric("14")+"\\."+utils.Hex("64")))
+	return utils.Validate(r, tps, nil)
+}

+ 6 - 0
config/gitleaks.toml

@@ -114,6 +114,12 @@ description = "Uncovered a possible Airtable API Key, potentially compromising d
 regex = '''(?i)[\w.-]{0,50}?(?:airtable)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{17})(?:[\x60'"\s;]|\\[nr]|$)'''
 regex = '''(?i)[\w.-]{0,50}?(?:airtable)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{17})(?:[\x60'"\s;]|\\[nr]|$)'''
 keywords = ["airtable"]
 keywords = ["airtable"]
 
 
+[[rules]]
+id = "airtable-personnal-access-token"
+description = "Uncovered a possible Airtable Personal AccessToken, potentially compromising database access and leading to data leakage or alteration."
+regex = '''\b(pat[[:alnum:]]{14}\.[a-f0-9]{64})\b'''
+keywords = ["airtable"]
+
 [[rules]]
 [[rules]]
 id = "algolia-api-key"
 id = "algolia-api-key"
 description = "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms."
 description = "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms."