Skip to content

Commit 63c7c6d

Browse files
committed
Update precommit hook for API keys from AI providers
1 parent cce396c commit 63c7c6d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ check_pattern '(mongodb|postgres|mysql|redis)://[^:]+:[^@]+@' "Database Connecti
8888
# JWT tokens
8989
check_pattern 'eyJ[a-zA-Z0-9_-]*\.eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*' "JWT Token"
9090

91+
# OpenAI API keys (sk-proj-... or sk-...)
92+
check_pattern 'sk-proj-[a-zA-Z0-9_-]{40,}' "OpenAI Project API Key"
93+
check_pattern 'sk-[a-zA-Z0-9]{48,}' "OpenAI API Key"
94+
95+
# Anthropic API keys (sk-ant-...)
96+
check_pattern 'sk-ant-[a-zA-Z0-9_-]{40,}' "Anthropic API Key"
97+
98+
# OpenRouter API keys (sk-or-...)
99+
check_pattern 'sk-or-[a-zA-Z0-9_-]{40,}' "OpenRouter API Key"
100+
91101
# Check result
92102
if [ "$SECRETS_FOUND" -eq 1 ]; then
93103
echo ""

0 commit comments

Comments
 (0)