Trust boundaries
A trust boundary is an edge where authority changes: input from one party becomes action by another. Keryn finds these edges, names who controls each side, and says what evidence supports crossing them. A boundary is not a defect. Every useful system crosses several. The finding is a crossing with no evidence that anyone checked it.
The classes
Section titled “The classes”Rule metadata groups boundaries into four classes. The first three describe what crosses. The fourth describes where code comes from.
| Class | What crosses | Controlled on the near side by | Controlled on the far side by | Evidence that supports crossing |
|---|---|---|---|---|
user->prompt |
Text someone else wrote becomes instructions or context for a model | whoever wrote it: a user, a web page, a document, an email | your prompt | isolation of the text from the instructions, trust labels on sources, an output check |
model->code |
A model’s output becomes an action | whoever can influence the model’s input | your code and the machine it runs on | an allow-list of actions, argument validation, a person approving, a sandbox |
secret->outside |
A credential or sensitive data reaches a place less trusted than where it lives | your configuration | a provider, a log, a webhook, a subprocess | a scoped credential, redaction, an allow-listed destination, a review |
supply-chain |
Code, a model or a tool from outside is trusted enough to run | its publisher | you | a pinned version, a digest, a signature, a review |
A tool call is a model’s output becoming an action, so it belongs to model->code. A workflow reaching an outside service is a sends edge, and it is a boundary when the destination is less trusted than the source. When what travels is a credential, it is secret->outside.
user to prompt
Section titled “user to prompt”A model cannot tell instructions from data. Anything that reaches its context can try to give it orders: a message, a retrieved page, a file in a repository, an email it is asked to summarise. The boundary is crossed whenever text from a party you do not control enters a prompt. Keeping that text in the user turn, apart from your instructions, is the common control; it narrows the problem and does not remove it, which is why the next boundary matters as much.
from flask import request
from anthropic import Anthropic
client = Anthropic()
def answer():
company = request.args.get("company")
return client.messages.create(
model="claude-sonnet-4-5",
max_tokens=300,
system="You answer billing questions for " + company + ". Never reveal other accounts.",
messages=[{"role": "user", "content": "What is my balance?"}],
)Rule
rules:
- id: acme.request-in-system-prompt
languages: [python]
severity: WARNING
message: A request parameter becomes part of the system prompt. Keep untrusted text out of the instructions.
metadata:
edge: sends
mode: taint
pattern-sources:
- pattern: request.args.get(...)
pattern-sinks:
- patterns:
- pattern: $CLIENT.messages.create(..., system=$S, ...)
- focus-metavariable: $S1 finding · 1 of 1 rules ran on 1 file
- warning
acme.request-in-system-promptline 12proof 2 path-in-fileA request parameter becomes part of the system prompt. Keep untrusted text out of the instructions.
Edge sends
Flow source (line 8) → propagation (line 8)
system="You answer billing questions for " + company + ". Never reveal other accounts.",
Result computed when this page was built. Run an example with the CLI
model to code
Section titled “model to code”The model’s output is text that something can steer. When code turns that text into a shell command, a query, a file path, a URL, a function call or a tool call, whoever steers the model steers the machine. This is the boundary behind most agent incidents, and the one where evidence is cheapest to produce: an allow-list of the actions the model may choose, validation of the arguments, and a person approving the ones that change things. Why the edges runs a live example, and edge kinds has the file, SQL and function-call variants.
secret to outside
Section titled “secret to outside”A secret matters because of what it unlocks. The boundary is crossed when a credential, a customer record or any other sensitive value is placed where a less trusted party can read it: in a prompt, a log line, a request to a third party, a child process’s environment, a file the agent can read. The evidence that supports crossing is that the destination should have it: a scoped key rather than a master key, redaction before the value is logged, a destination on an allow-list. A live example shows the shape.
supply chain
Section titled “supply chain”Some boundaries are crossed before the program starts: a dependency, a container base image, a model file that carries code, an MCP server fetched by name when the agent launches. The far side is controlled by a publisher you may not know, and the near side is your machine with your credentials. What supports the crossing is being able to say exactly what ran: a pinned version, a digest, a signature, a review of what it asks for.
from transformers import AutoModel
def load(name):
return AutoModel.from_pretrained(name, trust_remote_code=True)Rule
rules:
- id: acme.remote-model-code
languages: [python]
severity: WARNING
message: Loading this model runs Python code that ships in the model's repository. Pin the revision and review the code.
metadata:
edge: depends_on
pattern: $X.from_pretrained(..., trust_remote_code=True, ...)1 finding · 1 of 1 rules ran on 1 file
- warning
acme.remote-model-codeline 5proof 1 patternLoading this model runs Python code that ships in the model's repository. Pin the revision and review the code.
Edge depends_on
return AutoModel.from_pretrained(name, trust_remote_code=True)
Result computed when this page was built. Run an example with the CLI
Where Keryn finds boundaries
Section titled “Where Keryn finds boundaries”- In code. Rules look for the crossing itself: a request parameter in a prompt, a model reply at a sink, a secret in an outgoing call, a remote-code flag. A finding states its proof level, so a reader can tell a pattern from a traced path.
- In a model you draw or derive. The Trust Canvas puts elements in zones with trust levels. An edge whose ends sit in different zones or at different levels is a boundary, and the analysis records its direction (inbound, outbound or lateral), its controls and its evidence. A boundary with neither control nor evidence is raised as a risk. The reference has the exact rule.
Both say the same thing: where authority changes, the evidence should be written down.
What this does not claim
Section titled “What this does not claim”The four classes are the ones rule metadata uses today. They are not every boundary a system has, and a rule that finds one is a lead with a stated proof level, not a verdict on your system. What Keryn does not do lists the measured limits.