CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P) - December 7 onwards· Lessons

    Domain 5 · Lesson 28/39

    Guardrail placement: closing a misuse path without breaking the legitimate use

    Guardrail Placement

    17 min read
    2.67% of exam
    7 sources
    Published 18 Nov 2026
    Docs as of 18 Nov 2026

    What you will be able to do

    • Trace a described misuse path from where the attacker's input enters to the action that causes harm
    • Explain why an instruction in a system prompt does not count as a security control, and where deterministic checks belong instead
    • Choose the control that closes a misuse path while keeping a stated legitimate use case working
    • Reject controls that sit at the wrong point on the path, or that close it by also blocking the legitimate use

    Key concept

    Guardrail placement — Guardrail placement means putting each control at the point on a misuse path where the harmful action becomes possible, and enforcing it in code or configuration rather than in model instructions. The right control blocks only the harmful version of the action and leaves the legitimate version alone.

    1.A misuse path has an entry point, a carrier and a harmful action

    Every misuse path runs from an entry point, through the model, to an action that causes harm. Finding the right guardrail starts with tracing that path. The attacker's text gets in somewhere: a chat message, a wiki page, a code comment, a tool result. The model carries it. Then a tool call does the damage, such as sending an email, running a shell command or returning another person's data. You can put a control at any point along the path, but they don't all work equally well.

    The entry point decides which screens can see the attack at all. Direct injection and jailbreaks come from the user typing into your application. Indirect injection comes from content the model reads while working for a trusted user. In the indirect case, the attacker never types into your input box. The instructions arrive inside webpages, emails, documents or tool results. A screen that only checks what the user typed can't catch an attack that arrives through retrieval. The prompt injection surface lesson maps these entry points in detail. For placement, the point is that a screen only protects the channel it sits on.

    The harmful action is where enforcement holds most reliably. Claude resists injected instructions well, but resistance is a property of the model, not a control you can configure, test and audit. Hardened system prompts, delimiters and untrusted-content policies all lower the odds that the model follows an attack. None of them guarantees it won't. A guardrail that has to hold every time has to stand outside the model: in the tool's code, a permission rule, a hook or the runtime environment.

    Checkpoint 1 of 9· Check yourself

    An internal research assistant summarizes wiki pages for employees and has a tool that sends email. An attacker edits a wiki page to add hidden instructions telling the assistant to email confidential notes to an outside address. The team had already put a lightweight classifier on every chat message employees type, but it never flagged the attack. What is the most likely reason?

    Checkpoint 2 of 9· Check yourself

    For the same assistant, sending email to colleagues inside the company is a legitimate use that must keep working. Which change closes the path from a planted wiki instruction to emailing data outside the company?

    Checkpoint 3 of 9· Exam question

    An internal assistant uses retrieval over the company wiki and has a send_email tool. A contractor edits a wiki page to include hidden text instructing the assistant to email the quarterly forecast to an outside address. Employees legitimately ask the assistant to email summaries to colleagues. Which placement of a control closes the path while keeping that use?

    Sources12

    2.Where each layer sits, and what it can and cannot see

    The available controls sit at different points on the path, and each one sees a different slice of it. Input screening runs a small classifier over user input before the main conversation, using a lightweight model such as Claude Haiku 5.5 with structured output and a single verdict field. Tool-output screening runs the same kind of classifier over what tools return, before the model acts on it. Prompt hardening tells the model what untrusted content is and how to treat it. Action-layer checks, meaning validation in tool code, permission rules and hooks, inspect the concrete call the model proposes. Environment limits, meaning sandboxing, egress restrictions and credential placement, limit what any action can reach.

    Guardrail layers by position on the misuse path
    LayerWhere it runsCatchesMisses
    Harmlessness screen on user inputBefore the main conversationDirect injection and jailbreaks typed by the userInstructions hidden in retrieved documents or tool results
    Injection screen on tool outputBetween the tool and the tool_result blockIndirect injection in fetched or retrieved contentA harmful action the model takes without any injection
    System prompt policy, JSON-encoded tool resultsInside the model's contextMakes injected text clearly data, which lowers the odds it is followedAny case where the model follows the text anyway
    Least privilege on data and actionsTool set, secrets, sandboxLimits the damage from any successful injectionMisuse that only uses actions the job legitimately needs

    Screening tool output catches more than screening the question, but a classifier's verdict is still a probability. When the attack ends in a tool with real reach, such as email, the check that reliably closes the path sits inside the tool itself. In a managed deployment, custom tools run in your application and are limited only by your code. Platform settings don't secure them. A send_email tool that checks each recipient against a company-domain allowlist after the model proposes the call rejects the outside address no matter how persuasive the injected text was. Employees can still email summaries to colleagues.

    Two other fixes go wrong in opposite directions. Removing the email tool closes the path, but it also removes the use case the assistant exists for. Wrapping retrieved passages in delimiters and adding a system prompt rule is good practice, since Claude treats tool-result content with skepticism. Still, it leaves the decision with the model. Use it as a layer, never as the closing control.

    Checkpoint 4 of 9· Match them up

    Each guardrail layer leaves a different gap on the misuse path. Match each layer to what it misses.

    Tap a term, then the definition that fits it.

    Sources21

    3.Closing the path without removing the capability

    When a capability is both what the legitimate job needs and what the attacker wants, restrict the dangerous forms of it instead of removing it. Take a Claude Code CLI job that reviews pull requests from external contributors. It has to read every source file and run unit tests, so it needs Bash. An injected code comment asks it to curl the deploy token to an outside host. That path needs three things: a network-capable command, a credential within reach and a route out. Take away any one of them and the path is closed.

    Permission rules handle the first one. Allow rules let a tool run without approval, ask rules prompt for approval, and deny rules block it. A configuration can allow the exact test-runner commands the job needs and deny network-capable commands. Rule syntax needs care. A * matches whatever text is in its place, so Bash(git * main) also matches git -c core.fsmonitor=<script> diff main, which makes git run a program you name. Write allow rules narrowly enough that a wildcard can't become an escape.

    Permission rules that allow specific commands and deny anotherjson
    {
      "permissions": {
        "allow": [
          "Bash(npm run *)",
          "Bash(git commit *)"
        ],
        "deny": [
          "Bash(git push *)"
        ]
      }
    }

    The environment handles the other two. Claude Code's sandbox restricts writes by default, but it can still read most of the machine, including files such as ~/.ssh and ~/.aws/credentials. Environment variables, secrets included, are inherited. A runner that never holds the deploy token leaves nothing to steal, whatever the agent is talked into. Restricting outbound traffic to an allowlist, for example only the package registry, means a stolen secret has nowhere to go. In larger deployments, a proxy outside the agent's container can inject credentials, so the agent never sees the real credentials at all. That kind of least-privilege configuration limits the damage from attacks nobody predicted.

    The tempting alternatives each fail one side of the trade-off:

    • Disabling Bash closes the path, but the job can no longer run its tests.
    • A CLAUDE.md rule about untrusted comments is prompt-only, so it's model behaviour, not a control.
    • A keyword filter for curl over changed files fails any legitimate pull request that mentions the word. It also inspects text, not the command the agent actually runs.

    Checkpoint 5 of 9· Fill the gap

    This settings file has to let the agent run npm scripts and make commits without approval. It also has to stop the agent from pushing, even if an injected instruction tells it to push. Which key completes the configuration?

    {
      "permissions": {
        "allow": [
          "Bash(npm run *)",
          "Bash(git commit *)"
        ],
        " ? ": [
          "Bash(git push *)"
        ]
      }
    }

    Checkpoint 6 of 9· Exam question

    A team runs the Claude Code CLI in a CI job to review pull requests from external contributors. A red-team pull request contains a code comment telling the agent to run curl with the repository's deploy token against an outside host. The job must still run the project's unit tests and read every source file. Choose two.(Select 2)

    0 of 2 selected

    Sources345

    4.Parameters the model supplies are untrusted input

    Any argument the model writes into a tool call can be steered by whoever wrote the conversation, so never let a model-supplied argument decide whose data is accessed. Take a bank chatbot whose get_account_summary tool accepts a customer identifier from the model. A user types another customer's name and gets that customer's balance. Nothing went wrong in the model's reasoning. The tool simply trusted a parameter that an untrusted user effectively chose. Overeager agents can produce the same failure with no attacker involved, by inferring a target the user never specified.

    The control that closes this path takes the identity from a source the model can't influence. The server reads the customer ID from the signed-in user's session, passes that to the tool and ignores whatever identifier the model wrote. Authenticated customers still see their own full balances and transactions, because nothing about their own data is hidden. In Claude Code and the Agent SDK, a PreToolUse hook offers the same kind of mechanism. It can deny a call, or rewrite the tool's input parameters before execution through updatedInput. Deny and ask rules are still evaluated regardless of what the hook returns. Deriving identity this way is part of the authorization posture of the system.

    Output-side fixes fail the legitimate use. A regex that masks balances, or a second model call that redacts personal data from tool results, hides the very figures authenticated customers are entitled to see. A system prompt instruction with refusal examples leaves the boundary in the model's hands. When the stated legitimate use is "full details for your own account", any control that weakens the output is the wrong one. The fix belongs at the input to the tool.

    Checkpoint 7 of 9· Check yourself

    No attacker is involved in this case. A subscription-support agent has a cancel_subscription tool that takes an account ID. A signed-in customer types "cancel my plan". The agent looks up accounts, picks the closest name match, and cancels another customer's plan. Customers must still be able to view their full plan details and cancel their own plan. Which control closes this path?

    Checkpoint 8 of 9· Exam question

    A bank's public chatbot calls a get_account_summary tool. In testing, a user typed another customer's name and received that customer's balance and recent transactions. Authenticated customers legitimately ask for their own full balances and transaction details. Which control best closes this path?

    Sources167

    5.Layers complement each other; they do not replace each other

    Each layer covers a gap the others leave, so a strong control at one point doesn't make the rest unnecessary. Limiting an environment's network hosts doesn't stop the agent from using a credential on a host you allowed. The sandbox proxy checks the hostname the client supplies and doesn't inspect encrypted traffic by default, so code inside could use domain fronting to reach other hosts. In Claude Code, the sandbox doesn't cover the built-in file and web tools. A denyRead entry doesn't stop the Read tool, and allowedDomains doesn't limit WebFetch. Those tools follow permission rules instead.

    The working design has a closing control at the harmful action, backed by screening and prompt hardening that lower how often the closing control is even tested. Then it gets verified. Before deploying, red-team the workflow with documents, emails and tool outputs that contain injection attempts. Confirm that the model ignores them and that the screening and confirmation steps catch what's left. Where an action is risky enough that no automated check should decide alone, a human approval checkpoint is the next layer.

    Checkpoint 9 of 9· Check yourself

    After enabling Claude Code's sandbox, a team adds ~/.aws/credentials to filesystem.denyRead and sets network.allowedDomains to the package registry only. They conclude that the agent can neither read the credentials file nor send its contents to an outside host. What did they miss?

    Sources1452

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Claude is inherently resilient to it, but model behavior is not a security control.”
      ↩︎ A misuse path has an entry point, a carrier and a harmful action
      “The settings do not secure your custom tools, your MCP servers, or your self-hosted infrastructure.”
      ↩︎ Where each layer sits, and what it can and cannot see
      “Smallest tool set, untrusted input kept away from powerful tools, approvals for risky actions”
      ↩︎ Parameters the model supplies are untrusted input
      “These limits do not replace each other.”
      ↩︎ Layers complement each other; they do not replace each other
      “Claude is inherently resilient to it, but model behavior is not a security control.”
      ↩︎ Key concept
      “model behavior is not a security control”
      ↩︎ Exam trap 2
      “These limits do not replace each other.”
      ↩︎ Exam trap 3
    2. 2.
      “where the user is trusted but Claude processes third-party content (webpages, emails, documents, tool results) that contains adversarial instructions”
      ↩︎ A misuse path has an entry point, a carrier and a harmful action
      “Use a lightweight model such as Claude Haiku 5.5 to pre-screen user input before it reaches your main conversation.”
      ↩︎ Where each layer sits, and what it can and cannot see
      “Apply the principle of least privilege so that a successful injection can do minimal damage”
      ↩︎ Where each layer sits, and what it can and cannot see
      “Claude is trained to treat instructions that appear inside tool results with appropriate skepticism.”
      ↩︎ Where each layer sits, and what it can and cannot see
      “Before deploying, test your workflow with documents, emails, and tool outputs that deliberately contain injection attempts”
      ↩︎ Layers complement each other; they do not replace each other
      “where the user is trusted but Claude processes third-party content (webpages, emails, documents, tool results) that contains adversarial instructions”
      ↩︎ Exam trap 1
      “Indirect prompt injection, where the user is trusted but Claude processes third-party content (webpages, emails, documents, tool results) that contains adversarial instructions.”
      ↩︎ Checkpoint
      “Apply the same lightweight-model screening pattern you use for user input to the content your tools return.”
      ↩︎ Prediction
      “Indirect prompt injection, where the user is trusted but Claude processes third-party content (webpages, emails, documents, tool results) that contains adversarial instructions.”
      ↩︎ Checkpoint
    3. 3.
      “Deny rules prevent Claude Code from using the specified tool.”
      ↩︎ Closing the path without removing the capability
      “That includes -c, which makes git run a program you name.”
      ↩︎ Closing the path without removing the capability
    4. 4.
      “Most of the machine, including credential files such as ~/.ssh and ~/.aws/credentials”
      ↩︎ Closing the path without removing the capability
      “A denyRead entry doesn’t stop the Read tool, and allowedDomains doesn’t limit WebFetch”
      ↩︎ Layers complement each other; they do not replace each other
    5. 5.
      “The agent never sees the actual credentials”
      ↩︎ Closing the path without removing the capability
      “ensure it cannot use that domain to trigger other network requests or to exfiltrate data”
      ↩︎ Closing the path without removing the capability
      “Code running inside the sandbox can potentially use domain fronting or similar techniques to reach hosts outside the allowlist.”
      ↩︎ Layers complement each other; they do not replace each other
    6. 6.
      “picked the closest match by name similarity, and tried to delete it”
      ↩︎ Parameters the model supplies are untrusted input
      “picked the closest match by name similarity, and tried to delete it”
      ↩︎ Exam trap 4
      “This is blocked since the specific target may not have been what the user intended, and could have been owned by someone else.”
      ↩︎ Checkpoint
    7. 7.
      “input parameters before execution. Replaces the entire input object, so include unchanged fields alongside modified ones.”
      ↩︎ Parameters the model supplies are untrusted input
      “Deny and ask rules are still evaluated regardless of what the hook returns”
      ↩︎ Parameters the model supplies are untrusted input

    Ready to test yourself?

    Practise Anthropic Claude Certified Architect – Professional (CCAR-P) - December 7 onwards in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.