Prompt Injection Surface and Controls: Worked Example β Governance, Safety, and Risk Management (Claude Certified Architect - Professional)
Prompt Injection Surface and Controls β Worked Example In the context of the Claude Certified Architect - Professional exam, understanding how to...
Prompt Injection Surface and Controls β Worked Example
In the context of the Claude Certified Architect - Professional exam, understanding how to analyse and control the prompt injection surface is critical for ensuring safe and reliable AI deployments. This worked example demonstrates a step-by-step approach to identifying prompt injection risks and selecting appropriate controls within an architecture that integrates multiple context sources.
Scenario Description
An enterprise AI solution uses the Claude API to generate responses based on a combined context that includes:
- Retrieved documents from an internal knowledge base
- Real-time tool results from an external analytics service
- Responses from a Claude Managed Agents (MCP) server
- Third-party Agent Skills for specialized tasks
The architecture must prevent untrusted content from being interpreted as instructions by the Claude model, avoiding prompt injection attacks that could lead to misuse or data leakage.
Step 1: Identify the Prompt Injection Surfaces
Each context source represents a potential injection surface:
- Retrieved documents: Potentially contain user-generated or external content that might embed malicious instructions.
- Tool results: Dynamic outputs from external services that may be manipulated or corrupted.
- MCP server responses: Aggregated data or instructions that could be compromised.
- Third-party Skills: External code or prompts that may introduce unexpected instructions.
Recognizing these surfaces is essential to apply controls that prevent untrusted content from being treated as executable instructions.
Step 2: Analyse Misuse Paths for Each Surface
For each surface, consider how an attacker might craft input to alter the modelβs behaviour:
- Injected instructions in documents: Malicious text that tries to override the prompt or change the response.
- Manipulated tool outputs: Data that includes prompt-like commands.
- Compromised MCP responses: Instructions embedded in agent replies.
- Malicious third-party Skills: Skills that embed harmful prompt sequences.
Step 3: Select Controls to Close the Injection Paths
Controls must block injection without degrading legitimate use cases. Recommended controls include:
- Output filtering via separate classifier calls: Before including retrieved documents or tool outputs in the prompt, pass them through a content classifier to detect and redact suspicious instructions.
- Context sanitization: Implement strict sanitization rules to remove or neutralize prompt-like tokens or keywords from untrusted inputs.
- Segmentation of context: Use the Model Context Protocol (MCP) to separate trusted instructions from untrusted content, ensuring the model treats them differently.
- Prompt caching: Cache trusted prompt segments separately from dynamic content to reduce injection risk.
- Access controls on third-party Skills: Vet and sandbox Skills to prevent them from injecting harmful instructions.
Step 4: Validate Control Effectiveness
Test the architecture by simulating injection attempts, such as embedding commands in documents or tool outputs, and verify that the controls prevent these from influencing the modelβs instructions. Use logs and trace excerpts to confirm that suspicious content is detected and blocked.
Step 5: Document and Monitor
Maintain audit logs of content filtering and injection detection events. Monitor for anomalies in model behaviour that might indicate bypass attempts. Incorporate human-in-the-loop checkpoints for high-risk outputs to ensure safety without blocking legitimate use.
Worked Example Summary
Problem: An AI system uses retrieved documents and third-party Skills in its prompt context. How do you prevent prompt injection?
Solution:
- Identify injection surfaces: documents, Skills.
- Analyse misuse paths: embedded instructions in documents or Skills output.
- Implement controls: content classification and redaction, MCP context segmentation, vetting Skills.
- Test controls by simulating injection attempts.
- Use audit logs and human checkpoints for ongoing safety.
This approach aligns with Exam Domain 5 requirements, focusing on prompt-injection controls within the Claude platform's architecture, ensuring safe and compliant AI deployments.
More in this topic
Preparing for the Claude Certified Architect Professional exam?
Start free with 5 practice quizzes a day and track your progress.
Practise Claude Certified Architect Professional questions free →