$ show YouChenJun/Keydd
Keydd is an HTTP(s) proxy tool that performs sensitive information detection and AI-driven API business logic analysis. It acts as a MITM proxy to intercept traffic, matches content against 30+ regex patterns for credentials/API keys, and optionally uses LLMs to analyze API endpoints for business purpose, sensitivity, and penetration priority. The architecture features separate layers for proxy handling, rule-based detection, AI analysis (with rate limiting, token tracking, and metrics), database persistence (SQLite/MySQL/PostgreSQL), and notifications. Key entry points include main.go for startup, proxy/handler.go for traffic processing, and cmd/match_rules.go for sensitive pattern matching.
The LLM identified 4 files worth highlighting for reuse:
Implements a sophisticated rate limiter for LLM APIs combining sliding window request counting, semaphore-based concurrency control, and exponential backoff with jitter for 429 retries. Includes comprehensive metrics tracking and context-aware cancellation. This isolated component could be extracted for any LLM API rate limiting needs with minimal modification.
Provides thread-safe metrics collection for AI analysis systems tracking request counts, success/failure rates, latency percentiles (P95), and categorized error types (timeout, LLM errors, parse errors, rate limiting). Uses atomic operations for counters and mutex-protected sliding window for latency measurements. Demonstrates non-obvious skill in lock-free design where possible and proper error categorization.
Defines a clean database adapter interface with implementations for SQLite, MySQL, and PostgreSQL. Provides consistent API for traffic signature storage, analysis results, token statistics, and task management across different database backends. Shows excellent separation of concerns with minimal coupling to application logic.
Contains reusable utility functions for LLM interactions including robust JSON extraction from LLM responses, risk level and penetration priority extraction from text, binary content detection, and string sanitization. These zero-dependency functions demonstrate non-obvious skill in handling edge cases and LLM response variability.