Handbooks  /  Agent Supply-Chain Security
Handbook~14 min readSecurityworked math + runnable code
Handbook

Agent supply-chain
security.

Most agent-security writing is about prompt injection — the malicious instruction hidden in a web page the agent reads. This handbook is about the other door, the one you open yourself: every skill and MCP server you install is third-party code that runs with real permissions. A poisoned one doesn't need to trick your agent through its inputs; it's already inside, on the trusted code path. Securing that is an install-time problem, and it has its own math.

01

A different door: install-time risk

Prompt injection is a runtime attack — the threat rides in on data the agent reads while it works. Supply-chain risk is install-time — the threat is baked into a component you chose to add. That distinction changes everything about the defense. Injection abuses the agent's inputs; a malicious MCP server or skill abuses the agent's own trusted code path, with whatever permissions you granted it.

prompt injection: bad instructions in the DATA the agent reads (runtime)
supply chain: bad code in a COMPONENT you installed (install-time)

An MCP server can read files, hit the network, and call other tools the moment it's connected — no jailbreak required, because you already trusted it. So the controls are different: not input filtering, but vetting what you install, minimizing what you grant, and containing what it can reach. The next sections make each measurable.

02

Every dependency is another draw against you

Say each component you install has some independent probability p of being compromised (a backdoor, a hijacked publisher, a malicious update). The chance that at least one of your N installed components is bad is the complement of "all clean":

P(≥1 compromised) = 1 − (1 − p)N

At p = 5% per component: 5 dependencies → ~23%, 20 → ~64%, 50 → ~92%. The risk isn't linear — it climbs toward certainty as you pile on skills.

This is why "do I actually need this skill?" is a security question, not just a tidiness one. Every MCP server and plugin you add is another independent chance for the chain to break. The cheapest supply-chain control in existence is installing less. The runnable model below plots the curve.

03

Blast radius: what a compromised component can reach

Dependency count sets the odds of compromise; permissions set the damage. The blast radius of a component is the set of capabilities it holds — if it's compromised, that's exactly what the attacker gets. A skill granted {read_files, write_files, network, exec, secrets} hands an attacker your whole machine; the same skill granted only {read_files} hands over almost nothing.

least privilege: grant = needed ∩ offered  →  blast_radius = |grant|, minimized by construction

Give each component the narrowest capability set that still lets it do its job. Then even a fully compromised component is boxed into that scope — it can't touch secrets it was never granted.

The key idea

You can't drive p to zero — some compromised component will slip through eventually. So engineer for it: assume any single component will be bad, and make sure that when it is, its reach is a scope you chose in advance, not your entire system.

04

The two levers: vet to lower p, sandbox to bound damage

Everything reduces to moving two numbers. Lower p (make compromise less likely) by vetting before install. Shrink the blast radius (make compromise less costly) by least-privilege and isolation.

Lower p — vet before installBound blast radius — contain at runtime
Read the code; check what it actually doesGrant only the capabilities it needs
Verify provenance & signatures; prefer trusted publishersScope tokens narrowly (per-resource, short-lived)
Pin versions; review every update (updates are re-installs)Sandbox it — isolate filesystem, network, process
Check the dependency's own dependenciesRequire approval for irreversible actions

Note the trap in the third row: an auto-updating component is one you re-install continuously, often without re-vetting. A benign skill can turn malicious in a version bump you never read. Pinning and reviewing updates is where a lot of real-world supply-chain compromise actually enters.

05

Learning from the incident record

This isn't hypothetical. The agent ecosystem has already logged real supply-chain incidents: malicious and vulnerable MCP servers, compromised publisher accounts pushing poisoned updates, and skills that quietly over-reached their stated purpose. The recurring pattern is exactly the two-lever failure — a component that shouldn't have been trusted (high p, no vetting) holding permissions it never needed (huge blast radius, no least-privilege).

The defensive lesson is boringly consistent with the rest of security engineering: treat installed agent components like any other third-party dependency in a production system. Inventory them, pin them, scope them, sandbox them, and review updates. The novelty of "AI agent" doesn't buy you an exception from software supply-chain hygiene — it raises the stakes, because these dependencies come with the ability to act.

Read next

The runtime-attack half: AI Security. The isolation pillar: Sandboxing. The protocol itself: MCP.

RUN IT YOURSELF

Compounding risk, and the blast radius you choose

Two numbers govern agent supply-chain safety. The odds: with per-component compromise probability p, the chance at least one of N installed components is bad is 1 − (1 − p)N — watch it climb toward certainty as you add skills, and drop when vetting lowers p. The damage: a component's blast radius is the capabilities it holds, and least-privilege (grant = needed ∩ offered) shrinks it so a compromised component can't reach your secrets. Change p, the dependency count, and the granted scope.

CPython · WebAssembly
Frequently asked

Quick answers

What is agent supply-chain security?

Securing the components you install into an agent — skills, MCP servers, plugins — before they run. Each is third-party code executing with permissions, so a bad one acts on the agent's behalf. It's an install-time concern, distinct from runtime prompt injection.

How is it different from prompt injection?

Injection is runtime — malicious instructions in data the agent reads. Supply-chain risk is install-time — the threat is in a component you installed, already on the trusted code path. Different controls: vetting + least-privilege vs input handling.

Why does risk compound with dependencies?

With per-component compromise probability p, the chance at least one of N is bad is 1−(1−p)^N — at 5% each, 20 dependencies is ~64%. Every added skill is another independent draw against you.

How do you limit the damage?

Lower p by vetting (read code, check provenance/signatures, pin versions). Bound the blast radius with least-privilege tokens and sandboxing, so a compromised component reaches only its narrow scope, not your secrets.

Finished this one? 0 / 160 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.