← Insecure Output Handling

Output Handling & Excessive Agency

Developers who would never innerHTML a form field will happily innerHTML a model response, because it "came from our AI." The model is a text generator influenced by attacker-controllable context. Not a trusted component.

Output flows intoClassic bugFix
innerHTML / markdownXSSContextual encoding, sanitise
eval / generated codeRCENever auto-execute; sandbox
SQL stringSQLiParameterised — model supplies values, never SQL
Shell commandCommand injectionexecFile with an arg array
Model-supplied URLSSRFHost allow-list; block internal ranges
Auto-fetched markdown imageData exfiltrationDon't auto-fetch remote content

Nothing in that column is AI-specific. The AI is a new source of untrusted data, not a new sink.

Excessive agency — three failures: excessive permissions (credential too broad), excessive functionality (run_sql(query) when you need get_order(id)), excessive autonomy (acts irreversibly without confirmation).

Design so that a fully compromised model still can't do serious damage. Assume injection succeeds; ask what it buys. If the answer is "everything," the tool design is wrong — not the prompt.

Authorization never belongs in the model. Asking it to "only show the current user's data" isn't access control; it has no reliable notion of identity and can be argued with. Enforce in the tool, from the session identity.