Generative AI Leader Google Cloud's Generative AI Offerings Practice Question
A security team wants to prevent prompt injection attacks on their generative AI application hosted on Vertex AI. Which best practice should they implement?
⚠ Common exam trap
Many candidates confuse network-level security controls (like private endpoints) with application-layer security controls, assuming that restricting network access alone can prevent content-based attacks like prompt injection.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Implement input validation and output filtering
Prompt injection attacks exploit the model's inability to distinguish between user instructions and untrusted input. Implementing input validation (e.g., sanitizing special characters or known injection patterns) and output filtering (e.g., using a classifier to detect and block malicious responses) directly mitigates this risk by controlling what the model processes and returns. On Vertex AI, this can be enforced via custom safety attributes or integration with services like Cloud DLP for data loss prevention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a custom model instead of a foundation model
Why it's wrong here
Prompt injection exploits instruction-following in the model's input handling; swapping to a custom model leaves that attack surface intact because the model still processes untrusted text. Custom models suit domain-specific accuracy or proprietary data training, not injection defence.
- ✗
Disable all logging
Why it's wrong here
Disabling logging removes the audit trail needed to detect and investigate injection attempts, and does nothing to stop malicious instructions reaching the model. Logging is retained for monitoring and forensics; disabling it would only be considered where data-retention rules forbid recording prompts.
- ✗
Use a private endpoint
Why it's wrong here
A private endpoint secures network traffic between your VPC and the Vertex AI service, but prompt injection arrives as crafted input content, not as a network intrusion. Private endpoints suit preventing data exfiltration or public-internet exposure, not validating model instructions.
- ✓
Implement input validation and output filtering
Why this is correct
Input validation strips or neutralises injected instructions before they reach the model, while output filtering catches unsafe or manipulated responses. Together they directly counter prompt injection, satisfying the security team's requirement to prevent attacks on the Vertex AI application.
Go deeper
Related to this question
About these practice questions
This Generative AI Leader question is part of Courseiva's 1,008-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This Generative AI Leader practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Generative AI Leader exam.