Published on : 2026-06-06 Reading time : 8 min Tags : #security #python #audit #devops Overview Over 3 months, I developed and audited 6 Python projects (3 bots + 3 libraries): a FastAPI + Telegram Bot + LLM integration system. I discovered 25 security/code issues and fixed 23 immediately. Audit scope : 91 Python files Issues found : 25 (5 critical, 18 medium, 2 minor) Fix rate : 92% (23/25) Critical Issues - 5 1. API Keys Exposed in Git History 🔴 Problem : Anthropic, Supabase, and Telegram API keys committed in .env file # ❌ Exposed (visible in git log) ANTHROPIC_API_KEY = sk - ant - api03 - xxxxxxxxxx SUPABASE_KEY = sb_publishable_xxxxxxxxxx Risk : Anyone can access previous commits and steal API keys → resource abuse, data breach Solution : # 1. Clean history with BFG bfg --delete-files ".env" --no-blob-protection . # 2. Remove from Git git rm --cached .env echo ".env" >> .gitignore # 3. Rotate API keys (mandatory) 2. SSL Verification Disabled (MITM Attack Risk) 🔴 Problem : verify=False used in 10 places # ❌ Insecure response = requests . get ( url , verify = False ) # ✅ Secure response = requests . get ( url , verify = True ) # default Impact : HTTPS man-in-the-middle attacks possible → sensitive data exposed 3. Overly Broad Exception Handling 🔴 Problem : except Exception silencing all errors (114 instances) # ❌ No error tracking try : result = await db_select ( " contests " ) except Exception : print ( " failed " ) # What error? Unknown. # ✅ Specific handling try : result = await db_select ( " contests " ) except requests . HTTPError as e : logger . error ( f " DB error: { e } " , exc_info = True ) raise Impact : Production incidents hard to debug → increased MTTR 4. Empty Library init.py Files Problem : llm-router, supabase-async, telegram-agent had empty init.py # ❌ Before (empty file)

Security Audit of 6 Python Projects: 25 Issues Found & Fixed
JustJinoIT

