GenAI Security Engineering
10 episodes — short audio overviews on genai security engineering.
Prompt Injection Defense — chapter audio overview
Implementing Multi-Layer Defense Against Direct and Indirect Prompt Injection
Injection Taxonomy with Pydantic Models — lab audio overview
Define a structured prompt injection taxonomy using Pydantic models. Build enums for injection vectors (direct, indirect, context-manipulation), severity levels with numeric scores, and a DetectionResult model that carries classification metadata for downstream guard chain decisions.
Pattern-Based Injection Detector — lab audio overview
Implement a deterministic injection detector using compiled regex patterns and keyword rules. Build a PatternRule registry, a multi-pattern evaluator that returns the highest-severity match, and a FastAPI endpoint for real-time pattern scanning.
LLM-as-Judge Injection Classifier — lab audio overview
Build an LLM-as-judge classifier that uses LiteLLM to perform semantic injection detection. The judge analyzes user inputs for novel or obfuscated injection attempts that bypass pattern matching, returning structured JSON classification results.
Guard Chain Orchestrator — lab audio overview
Implement a guard chain orchestrator that runs an ordered set of independent, deterministic injection detectors (a keyword-pattern guard and a structural-anomaly guard) over input text. Each guard has a kind, weight, and required flag. The orchestrator collects per-guard verdicts and combines them w
Short-Circuit Logic for Guard Chain — lab audio overview
Add short circuit logic to the guard chain so high-confidence detections immediately block requests without running slower downstream guards. Implement latency budgets and Redis-based caching for repeat queries.
Guard Result Aggregator with Weighted Scoring — lab audio overview
Build a guard result aggregator that computes weighted confidence scores from multiple guard results. Implements configurable decision thresholds with Prometheus metric instrumentation for monitoring aggregation decisions.
Defense Pipeline as FastAPI Service — lab audio overview
Package the injection defense pipeline as a FastAPI microservice with scan, health, and configuration endpoints. Build async request handlers for maximum throughput with proper error handling and response models.
Helm Chart Generator with GKE Workload Identity — lab audio overview
Create a Python-based Helm chart generator that produces Kubernetes YAML manifests for the defense sidecar deployment. Includes Workload Identity configuration for secure GKE authentication without stored credentials.
HPA Configuration for Guard Service — lab audio overview
Configure Horizontal Pod Autoscaler for the defense guard service. Generate HPA YAML with CPU-based scaling, custom metrics for guard chain latency, stabilization windows, and scale-down policies.