LLM Red Team Lab In Progress

Interactive AI security lab with animated attack visualization, TechCorp scenario data, and measurable defense scorecards against live or mock LLMs.

At a glance

attack prompts across OWASP LLM categories
32
benign regression cases
6
scorecard metrics: block rate, benign pass rate, latency
3
Role
Project Lead / AI Security Engineer
Year
2026
Category
AI Software Dev

About This Project

Built a standalone Python red-team lab that compares vulnerable and hardened LLM chat pipelines side by side. Curated 32 attack prompts plus 6 benign regression cases across OWASP LLM Top 10 categories against a realistic TechCorp employee and infrastructure dataset. Added multi-layer input and output guardrails, redesigned the UI with step-by-step attack animation and side-by-side chat simulation, and shipped a scorecard that reports block rate, benign pass rate, and latency overhead. Supports mock LLM for CI and OpenRouter live models for real-world testing. Deployable via Railway or Docker and linked from the portfolio as an AI security case study.

Engineering Deep Dive

Why a "never reveal this" instruction fails as a control, and how a lab makes the failure measurable: the same attack through an unprotected and a hardened pipeline, deterministic input and output guardrails, and a scorecard that weighs block rate against benign pass rate.

Read the engineering deep dive

Technologies Used

PythonFastAPIPydanticOpenRouterpytestDockerRailwayGitHub Actions

Engineering Challenges

  1. 01

    Attack Coverage vs False Positives

    Tuned regex-based input scanning so obvious prompt-injection and exfiltration patterns were blocked while benign recruiter questions about APIs, skills, and experience still passed through.

  2. 02

    Realistic Scenario Data

    Embedded employee PII, salary bands, financial metrics, and AWS credentials in the system prompt so attacks target believable business data instead of abstract strings.

  3. 03

    Dual Pipeline Parity

    Ensured both vulnerable and hardened paths use the same LLM provider (mock or OpenRouter) so comparison results reflect defense layers rather than model variance.

  4. 04

    Visual Security Story

    Redesigned the lab UI with attack card grids, animated defense-layer breakdowns, and side-by-side chat panels so non-specialists can follow what each guardrail blocked.

Technical Highlights

Layered Guardrails: Implemented input scanning, server-side system prompt isolation, PII filtering, and credential blocking as separate defense layers with explicit audit results per request.

YAML Attack Catalog: Structured 32 attacks and 6 benign prompts across extraction, injection, and jailbreak files with OWASP categories and expected outcomes to drive automated regression testing.

Live Model Support: Added OpenRouter integration with a selectable model dropdown for testing defenses against real LLMs while keeping mock mode for local dev and CI.

Production-Ready Scaffold: FastAPI routes, Jinja lab UI with animated JavaScript visualization, pytest suite (unit and property-based), Docker image, Railway deploy config, and GitHub Actions CI with ruff, mypy, and bandit.

Business Logic

Recruiter-Friendly Demo: Visitors pick an attack card, watch the unprotected pipeline fail, see the protected pipeline block the same payload, and review a scorecard in under a minute.

Portfolio Separation: Kept Python runtime and demo hosting outside the Cloudflare Workers portfolio site while still linking the case study back to gssimao.com.

Interview Artifacts: Documented threat model, defense tradeoffs, sensitive-data scenario, and benchmark metrics recruiters and security engineers can discuss concretely.