Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Machine Learning Engineer practice bank has an additional 974 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
An enterprise deploys a multi-turn customer support agent on Vertex AI using Gemini. The agent retrieves untrusted email threads from Cloud Storage and invokes Model Context Protocol (MCP) tools. During red-team testing, two issues emerge:
PROMPT_INJECTION_AND_JAILBREAK filter to LOW_AND_ABOVE blocks legitimate prompts such as "Summarize my inbox and ignore the emails from the marketing vendor."Which configuration mitigates these attacks while eliminating the false positives?
SanitizeUserPrompt on each new user message only (excluding system prompts and chat history) and screening retrieved MCP tool inputs and outputs; add a regex exclusion rule with MATCHING_SCOPE_PARTIAL_MATCH using word boundaries that pairs ignore with specific target nouns such as emails; enclose retrieved email text in XML tags with explicit system instructions; and enable Sensitive Data Protection de-identification on Model Armor responses.This approach combines Model Armor inline prompt and tool-response sanitization, narrowly scoped regex exclusion rules, structural system instruction boundaries, and Sensitive Data Protection (SDP) de-identification to build a resilient multi-layered defense against both direct and indirect prompt injection.
SanitizeUserPrompt on each new user turn—while omitting system prompts and conversation history from userPromptData—ensures Model Armor evaluates only untrusted user input for adversarial intent without confusing system directives for injections.<email>...</email>) with explicit boundary directives prevents the model from interpreting retrieved text as executable instructions.MATCHING_SCOPE_PARTIAL_MATCH with a case-insensitive regex containing word boundaries (\b) and non-capturing groups ((?:...)) that pairs ignore exclusively with benign target nouns (like emails or spams) overrides false positives without masking genuine injection payloads elsewhere in the prompt.5xx errors, and integrating SDP DeidentifyTemplate rules masks PII in model egress traffic even if a novel injection bypasses upstream checks.\b word boundaries respects Model Armor's limit of 10 rules per rule set while preserving strict LOW_AND_ABOVE sensitivity.MATCH_FOUND verdicts allows the application to return safe generic responses instead of raw exception traces.Unlike Gemini's built-in content filters—which only inspect responses for predefined safety harms—this design actively screens untrusted inputs, external RAG/MCP data, and sensitive egress payloads simultaneously without creating security blind spots.
ignore and override on user inputs, configure Gemini's prebuilt content filters to BLOCK_LOW_AND_ABOVE for prompt inspection, and skip Model Armor screening on retrieved RAG documents and MCP tool outputs while relying on the primary model's system prompt to restrict tool usage.This option replaces Model Armor with Sensitive Data Protection (SDP) keyword blocklists, attempts to use Gemini's prebuilt content filters for input screening, and leaves retrieved RAG documents and MCP tool interactions unscreened.
ignore exacerbates the exact false-positive problem on benign email-triage prompts.BLOCK_LOW_AND_ABOVE does not screen incoming user prompts or external tool data.BLOCK_LOW_AND_ABOVE across all harm categories to block adversarial prompts before model execution, pass the concatenated system prompt, conversation history, and retrieved email context into SanitizeUserPrompt for holistic inspection, and add a dictionary exclusion rule for the standalone word ignore with MATCHING_SCOPE_PARTIAL_MATCH.This option relies on Gemini's prebuilt configurable safety filters, sends the full concatenated prompt context to SanitizeUserPrompt, and attempts to suppress false positives using a single-word dictionary exclusion rule.
BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH) operate only on model responses, not input prompts, and evaluate predefined harm categories (hate speech, harassment, sexually explicit, and dangerous content) rather than prompt injection or instruction-override attacks.SanitizeUserPrompt payload: Including system prompts and full conversation history in userPromptData violates Model Armor isolation practices. Because system instructions often contain imperative rules (such as "never reveal internal policies"), sending them in userPromptData degrades classification accuracy and increases false positives.MATCHING_SCOPE_PARTIAL_MATCH flips the matchState to NO_MATCH_FOUND for the entire filter whenever any substring matches, excluding the standalone word ignore allows an attacker to completely disable PROMPT_INJECTION_AND_JAILBREAK detection simply by embedding the word ignore anywhere in a malicious payload.piAndJailbreakFilterSettings confidence threshold to HIGH while setting Gemini content filters to BLOCK_ONLY_HIGH, and configure an exclusion rule with the regex .*ignore.* under MATCHING_SCOPE_PARTIAL_MATCH while failing open on Model Armor API timeouts.This approach loosens Model Armor and Gemini content filter thresholds, adds an unconstrained wildcard regex exclusion rule (.*ignore.*), and relies on natural-language system instructions with fail-open API error handling.
.*ignore.* with MATCHING_SCOPE_PARTIAL_MATCH causes any prompt containing the substring ignore (even inside another word or within an injection command like "ignore previous instructions") to override the entire PROMPT_INJECTION_AND_JAILBREAK filter result to NO_MATCH_FOUND, completely neutralizing prompt injection protection.piAndJailbreakFilterSettings to HIGH allows low- and medium-confidence adversarial prompts to pass unchallenged, while natural-language instructions lacking strong structural boundaries (such as XML tags) remain vulnerable to motivated indirect prompt injections inside retrieved emails.5xx errors creates an availability-triggered security bypass that attackers can exploit via resource exhaustion.BLOCK_ONLY_HIGH on Gemini filters permits moderately harmful outputs generated as a side effect of jailbreaks..*ignore.* are explicitly anti-patterns that undermine production AI security.Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated