forked from UnsecuredAPIKeys-com/UnsecuredAPIKeys.Lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyze-unmatched-keys.ps1
More file actions
66 lines (59 loc) · 2.21 KB
/
analyze-unmatched-keys.ps1
File metadata and controls
66 lines (59 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Analyze unmatched API keys in the verification bot
# First, let's see what providers we have
Write-Host "=== ANALYZING UNMATCHED KEYS ===" -ForegroundColor Cyan
Write-Host ""
# List all AI providers
Write-Host "Current AI Providers registered:" -ForegroundColor Yellow
$providers = @(
"AnthropicProvider",
"CohereProvider",
"DeepSeekProvider",
"ElevenLabsProvider",
"GoogleProvider",
"GroqProvider",
"HuggingFaceProvider",
"MistralAIProvider",
"OpenAIProvider",
"OpenRouterProvider",
"PerplexityAIProvider",
"ReplicateProvider",
"StabilityAIProvider",
"TogetherAIProvider"
)
$providers | ForEach-Object { Write-Host " - $_" }
Write-Host ""
Write-Host "Common API key patterns that might be missing:" -ForegroundColor Yellow
Write-Host " - Gemini API keys"
Write-Host " - Claude API keys (different from Anthropic format)"
Write-Host " - Azure OpenAI keys"
Write-Host " - AWS Bedrock keys"
Write-Host " - Vertex AI keys"
Write-Host " - Local LLM server keys"
Write-Host " - Custom/Enterprise API keys"
Write-Host ""
Write-Host "The message 'Processing 1000 keys with unknown pattern' means:" -ForegroundColor Green
Write-Host " 1. The bot found 1000 keys that don't match ANY provider's regex patterns"
Write-Host " 2. These keys will be tested against ALL providers (slow!)"
Write-Host " 3. This significantly impacts performance"
Write-Host ""
Write-Host "To fix this issue:" -ForegroundColor Magenta
Write-Host " 1. Query the database to see what these unmatched keys look like"
Write-Host " 2. Identify which services they belong to"
Write-Host " 3. Either:"
Write-Host " a) Add new providers for missing services"
Write-Host " b) Update existing provider regex patterns"
Write-Host " c) Mark false-positive keys as invalid"
Write-Host ""
Write-Host "SQL query to find unmatched key patterns:" -ForegroundColor Cyan
Write-Host @"
-- This query would help identify unmatched keys
SELECT
SUBSTRING(ApiKey, 1, 10) as key_prefix,
COUNT(*) as count,
STRING_AGG(DISTINCT SearchProvider::text, ', ') as search_providers
FROM APIKeys
WHERE Status NOT IN ('Invalid', 'Removed', 'FlaggedForRemoval')
GROUP BY SUBSTRING(ApiKey, 1, 10)
ORDER BY count DESC
LIMIT 50;
"@