Sanitization helps reduce risks when untrusted input reaches a language model or model-generated output reaches an application. It cannot eliminate prompt injection: models may treat instructions and external data alike. section 13.2.1 section 13.2.2
Reduce risk at the application boundary:
- Give the model only the minimum access needed for its function. section 13.2.1
- Validate input and output; use prepared statements for database queries, enforce database permissions, and audit frequently. section 13.2.2
Model-generated SQL
A request such as “Generate a report for users; DROP TABLE users” could lead to a query that deletes the users table if executed directly. Validate generated queries and use prepared statements rather than trusting model output. section 13.2.2


