Question
An internal user enters a client credit card number into an internal generative machine learning (ML) model:
```
#User prompt: Customer Jane Doe has a new credit card that she wants to add to her account. The number is 5555-5555-5555-5555
```
Which of the following is the most effective way to prevent prompt injection attacks against a large language model (LLM)?
- A. Guardrails Correct
- B. Antivirus
- C. Web application firewall (WAF)
- D. Role-based access control
Explanation
Guardrails sit around the LLM and inspect prompts and responses, blocking or rewriting input that tries to override the system instructions and output that exposes sensitive data such as card numbers. They are the control designed for prompt injection. Antivirus scans files for malware, a WAF inspects HTTP traffic for web attack signatures but does not understand natural-language instructions, and role-based access control limits who can use the model, not what a prompt can make it do.