# Why the edges

> Why Keryn looks at what can reach what before it lists what is there.

Source: https://keryn.dev/docs/concepts/why-the-edges/

A model, a repository, an agent or a person is not safe or dangerous on its own. Risk appears where one thing can reach, call, read, change or act for another. Keryn models those connections first and the things they connect second.

Diagram: model output reaches a shell, across a trust boundary. A trust boundary: authority changes at the cut, so Keryn asks for evidence there.

## Terms

| Term | Meaning |
|---|---|
| **Edge** | A directed relationship: one thing reaches, calls, reads, writes, sends to, grants, depends on or trusts another. |
| **Trust boundary** | An edge where authority changes: user input into a prompt, model output into a shell, an agent into a tool, a workflow into an outside service. |
| **Reach** | What one thing can affect through edges, directly or through a chain. |
| **Chain** | An ordered sequence of edges. An attack path is a chain an attacker can follow to a consequence. |
| **Graph** | The nodes and edges of a scope, each edge with its evidence. |
| **Verdict** | A recorded judgement on a finding: `upheld`, `refuted`, `needs context`, `unsupported` or `declined`. |

## Why the edge is the unit

An inventory answers "what do we have?". A security decision asks "what can reach what, on whose authority, and what happens if that edge is abused?"

- A model does nothing until code sends it input and acts on its output.
- A tool is harmless until an agent is allowed to call it.
- A finding matters because of the path it sits on.

One chain you can check, edge by edge, is worth more than a long list of findings about separate things. Keryn's [AI-BOM](https://keryn.dev/docs/guides/ai-bom/) is still there. It is the list of nodes the edges attach to.

## One edge, in code

Model output into a shell is a trust boundary: authority changes at the call that runs it. The rule below names the two ends of the edge, the call that produces the text and the call that acts on it, and the finding shows the path between them.

**Model output into a shell** (a live example on the page; the engine runs in the browser, nothing is uploaded)

```python
import subprocess
from anthropic import Anthropic

client = Anthropic()

def fix_it(error_text):
    reply = client.messages.create(
        model="claude-sonnet-4-5",
        max_tokens=300,
        messages=[{"role": "user", "content": "Give one shell command that fixes: " + error_text}],
    )
    command = reply.content[0].text
    return subprocess.run(command, shell=True, capture_output=True)
```

Rule:

```yaml
rules:
  - id: acme.model-output-reaches-shell
    languages: [python]
    severity: ERROR
    message: Text a model produced is run as a shell command. Treat it as untrusted input.
    mode: taint
    pattern-sources:
      - pattern: $CLIENT.messages.create(...)
    pattern-sinks:
      - pattern: subprocess.run($CMD, ...)
```

Result, computed when the site was built by the same engine as `keryn scan`:

```text
1 finding · 1 of 1 rules ran on 1 file

error acme.model-output-reaches-shell line 14 [proof 2 path-in-file]
  Text a model produced is run as a shell command. Treat it as untrusted input.
  Flow: source (line 8) -> propagation (line 8) -> propagation (line 13)
  | return subprocess.run(command, shell=True, capture_output=True)
```

The inventory lists `anthropic` and the model. The finding is about the edge between them and the shell.

## What follows

- Every finding states its [proof level](https://keryn.dev/docs/concepts/proof-ladder/), so a reader can tell a lead from evidence.
- A verdict is a second opinion recorded next to a finding. It never changes the finding's proof.
- Scans run where the code is. Nothing leaves unless you press a button that names the destination. See [local by design](https://keryn.dev/docs/concepts/local-only/).
- The same input gives the same report and the same fingerprints.

## Read next

The [edges section](https://keryn.dev/docs/edges/) is the manual: [trust boundaries](https://keryn.dev/docs/edges/trust-boundaries/), the [eight edge kinds](https://keryn.dev/docs/edges/edge-kinds/), [paths, chains and chokepoints](https://keryn.dev/docs/edges/paths-and-chains/) and [agentic triage](https://keryn.dev/docs/edges/agentic-triage/).

## Where this stops today

Keryn does not yet keep one model of every edge. Today the edges appear as source-to-sink traces, the routes-to-tools view, workflow analysis and the exported evidence graph, which links findings, files, rules and AI components. Cross-file reach is one import level. See [what Keryn does not do](https://keryn.dev/docs/concepts/limits/).
