Skip to content

Commit eb867a6

Browse files
committed
Add custom regex patterns for API keys and credentials in regex.txt example
1 parent 2c3f928 commit eb867a6

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

examples/regex.txt

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,35 @@
33
# You can customize this file and use it with the --regex-file flag
44

55
REGEX_PATTERNS = {
6-
"aws_access_key": "AKIA[0-9A-Z]{16}",
7-
"aws_secret_key": "[0-9a-zA-Z/+]{40}",
8-
"github_token": "github_pat_[0-9a-zA-Z_]{82}",
9-
"google_api_key": "AIza[0-9A-Za-z-_]{35}",
10-
"firebase_key": "AAAA[A-Za-z0-9_-]{7}:[A-Za-z0-9_-]{140}",
11-
"slack_token": "xox[pboa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32}",
12-
"jwt_token": "eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+",
13-
"private_key": "-----BEGIN [A-Z]+ PRIVATE KEY-----",
14-
"password_in_code": "(?i)(pass|password|pwd|secret)\\s*[=:]\\s*['\"][^'\"]+['\"]",
15-
"api_key_generic": "(?i)(api[-_]?key|apikey)\\s*[=:]\\s*['\"][^'\"]+['\"]"
6+
// Custom API keys
7+
"custom_api_key": "CustomApi[A-Za-z0-9]{24}",
8+
"internal_token": "INT_[A-Za-z0-9_]{20,30}",
9+
10+
// Custom credentials
11+
"internal_password": "(?i)(internal_password|system_pwd)\\s*[:=]\\s*['\"](\\w{8,})['\"](\\s|$)",
12+
"dev_key": "DEV_KEY_[a-zA-Z0-9]{16}",
13+
14+
// Project-specific patterns
15+
"project_secret": "PRJ_[a-zA-Z0-9]{5}_SECRET_[a-zA-Z0-9]{10}",
16+
"config_password": "CONFIG_PWD[\"']\\s*:\\s*[\"']([^\"']{8,})[\"']",
17+
18+
// Database connection strings
19+
"mongodb_uri": "mongodb(\\+srv)?://[^:]+:[^@]+@[^/]+/[^\\s\"']+",
20+
"postgresql_conn": "postgresql://[^:]+:[^@]+@[^/]+/[^\\s\"']+",
21+
22+
// Environment-specific
23+
"staging_key": "stg_[a-z]{3,5}_[A-Za-z0-9]{12}",
24+
"testing_token": "test_token_[a-zA-Z0-9_]{16,24}"
1625
}
26+
27+
// Example exclusions (optional)
28+
EXCLUSION_PATTERNS = [
29+
// Standard test values that should be excluded
30+
"test_token_placeholder",
31+
"DEV_KEY_PLACEHOLDER",
32+
33+
// Common development patterns
34+
"stg_key_0000000000",
35+
"PRJ_TEST_SECRET_0000000000"
36+
]
37+

0 commit comments

Comments
 (0)