Basic Concept: Suspicious or unexpected AI system outputs are often caused by malicious or malformed user inputs that exploit the AI ' s input processing. Validating and sanitizing user inputs before they reach the AI model prevents many classes of attacks including prompt injection, data exfiltration attempts, and input manipulation. CompTIA SecAI+ Study Guide emphasizes input validation as a foundational AI security control.
Why B is Correct: Implementing user input validation applies checks and constraints to all user-submitted content before it is processed by the AI system. Input validation can enforce length limits, detect injection patterns, filter disallowed characters or command structures, and ensure inputs conform to expected formats. By rejecting malicious or malformed inputs at the entry point, this control prevents them from reaching the model and causing the suspicious outputs observed.
Why A is Wrong: Data sanitization processes data to remove harmful elements and is closely related to validation. However, input validation is broader and more proactive, checking conformance to rules before processing, while sanitization typically operates during or after processing. Validation at the input boundary is the more appropriate first-line control.
Why C is Wrong: Monitoring logs for attack keywords is a detective control that identifies attacks after they have already affected the system. It does not prevent suspicious outputs from being generated in the first place.
Why D is Wrong: Hardening the Model Context Protocol server improves the security of the infrastructure hosting the AI components. While important for infrastructure security, it does not directly validate or inspect the content of user inputs that cause suspicious outputs.