NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new
Advanced
Detection and Incident Response
35 min readChapter 6Core

1. Detection and incident response

Detection and incident response for an LLM feature means recording enough about each model call to notice an attack, then having a plan to stop it, measure the damage, and keep it from happening again. Prevention will eventually fail, so every request leaves a structured security record of who asked, what was retrieved, which tools ran, and how much data left. Detectors watch those records for attack patterns, and responders use them to switch off the exploited path and find every affected customer.

Our example is a support assistant shared by many customer companies (tenants). It answers from each tenant's tickets and can call search_tickets and send_email. You need this work when such a feature reads untrusted content, calls tools, or returns customer data. An internal prototype with no customer data and no tools doesn't need it yet, because ordinary logs and access control are enough. Judging whether answers are good is quality monitoring, covered in AI Evals Production Evals and Monitoring.

This topic usually comes up in the last ten minutes of a threat-modeling or prevention answer, and a clear reply stands out at the senior level. A mid-level answer names the fields to log, three signals, and the contain, scope, fix, test sequence. A senior answer also owns the privacy trade-off in logging, ranks alerts by impact, and scopes damage by what the attacker achieved rather than what they typed. The chapters follow the order the data flows: the record, the detectors that read it, then the response that queries it.

premium content mask
Upgrade to premium and unlock full chapter
Spot an issue or have a suggestion?
AI Governance and Compliance  |

Discussion

Upgrade to premium to read and join the discussion.