11.1.9 · Skill in AI engineering

Guardrails

Checks that keep AI output safe, on topic and within policy.

Guardrails validate inputs and outputs, block unsafe content and limit what an agent can do. They range from simple rules to classifier models. They matter most where AI output reaches users or takes actions directly.

Your status · Guardrails

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

A language model follows instructions, and it cannot reliably tell your instructions from instructions hidden in an email, a web page or a support ticket. When its output reaches users, or when it can call tools, that weakness becomes a product risk. Input and output checks catch many problems, but not all of them. Product engineers decide the parts that do not depend on the model: what the agent can access, what it can do without approval, and where its output can go.

How to do it

  1. List what the feature can read, what it can change, and where it can send data.
  2. Give the agent its own credentials, limited to the data and actions the task needs.
  3. Ask a person to confirm actions that cannot be undone or that send data outside.
  4. Check outputs before they reach users: format, links, personal data, policy topics.
  5. Test with attacks: put hostile instructions in documents, issues and web pages the agent reads.

Common mistakes

  • Trusting the system prompt to stop a determined attacker.
  • Giving an agent the user’s full access because it is easier to set up.
  • Combining private data, untrusted content and a way to send data out in one agent.
  • Checking the user’s message but not the documents and tool results the agent reads.

Example

In May 2025, researchers at Invariant Labs showed an attack on GitHub’s official MCP server. They put a malicious issue in a public repository. It asked the agent to add information about the author, including “all other repos the user is working on”, to the README. The user only asked the agent to look at the open issues. The agent read private repositories and published their details in a public pull request. The researchers used a well-aligned model, Claude 4 Opus.

Flow

How a public issue led to a private data leak

Public issueHidden requestPrivate reposFull user accessAgentReads bothPublic PRData publishedPublic issueHidden requestPrivate reposFull user accessAgentReads bothPublic PRData published

The model did what the text asked. The fix the researchers suggest is about access: limit the agent to the repository it is working on.

ReportedInvariant Labs, 26 May 2025

Sources: GitHub MCP exploited: accessing private repositories via MCP (Invariant Labs) ↗ · GitHub MCP exploited: accessing private repositories via MCP (Simon Willison) ↗ · Prompt injection (OWASP GenAI Security Project) ↗

Technical leverage

Enforce permissions and business rules in code, then test how input and output checks behave when a model is manipulated.

Evidence of mastery

Put it into practice
Practice
Threat-model an AI feature and test malicious instructions embedded in user input and retrieved documents.
Artifact
A threat model, adversarial cases and evidence that unauthorized actions remain blocked.

What good looks like

  • Guardrails are treated as partial controls, not a guarantee of safety.
  • Authorization does not depend on the model following a prompt.

Use this evidence to assess your work. Your map status is a self-assessment, not a certification.

Resources

3
  • docsStart here
    OWASP top 10 for LLM applications ↗
    OWASP GenAI Security Project · index

    The main security risks of LLM features, with prompt injection at the top.

  • docsStart here
    Prompt injection ↗
    OWASP GenAI Security Project · 2026 · 5 min

    Why prompt injection cannot be patched away, and the controls that limit the damage.

  • articleGo deeper
    Prompt injection (series) ↗
    Simon Willison · series

    The clearest ongoing writing on prompt injection, from the person who named it.

Tools

2
Tools for AI engineering