Case 27 · Flagship

Agent Security Contract

Fail-closed security contract for AI agents and MCP tool calls: abuse-case corpus, ALLOW / BLOCK / REQUIRE_APPROVAL verdicts in CI, and hash-checked evidence envelopes.

01

How it works

From policy to a fail-closed verdict.

Agent Security Contract by Andrey Lesnikov — pin a capability policy, evaluate agent and MCP tool-call traces before execution, and ship a CI-grade evidence envelope.

The design is written up as a research preprint: Fail-Closed Authorization for Tool-Using AI Agents. See also: Agent and MCP security hub.

Agent Security Contract architecture: policy and trace into evaluator, verdicts, evidence envelope, CLI and GitHub Action
Pre-execution enforcement plane: capability contract → fail-closed verdict → evidence envelope.
Agent Security Contract lifecycle: Policy, Trace, Evaluate, Verdict, Envelope
Lifecycle — Policy → Trace → Evaluate → Verdict → Envelope
  1. 01

    Pin the capability policy

    YAML declares the capability catalog, a pinned sha256 capability digest, per-agent tool allowlists, argument constraints, high-impact approval, and rate limits.

  2. 02

    Evaluate the tool-call trace

    asc check (or the HTTP sidecar / GitHub Action) compares the trace to the policy. Malformed policy, digest mismatch, unknown tool, evaluator error, or timeout all return BLOCK.

  3. 03

    Emit a disposition

    Verdicts are ALLOW, BLOCK, or REQUIRE_APPROVAL — mapped to OWASP ACS ALLOW / DENY / ASK — with exit codes 0 / 1 / 2 for CI admission.

  4. 04

    Prove with an envelope

    Each decision writes an evidence envelope (policy_sha256, trace_id, commit_sha, envelope_sha256). asc verify rejects tampering against the integrity digest; envelopes are hash-checked, not signed.

02

Evidence

From problem to proof.

How the system is framed, operated, and proven — not a slide deck summary.

01
Problem

Agent and MCP stacks expand the attack surface beyond prompt text: tool misuse, poisoned tool descriptions, argument injection, and unapproved high-impact actions. Without a pre-execution gate, those calls run before anyone can deny them.

02
Architecture

ASC is a platform gate: a pinned YAML capability policy plus a tool-call trace feed an evaluator that returns ALLOW, BLOCK, or REQUIRE_APPROVAL. Delivery paths are the asc CLI (check / verify / corpus), an HTTP sidecar with a fail-closed client, and the reusable GitHub Action justrunme/[email protected]. Every verdict emits an evidence envelope with policy SHA-256, trace ID, commit SHA, and an integrity digest. An Envoy ext_authz quickstart on kind puts the decision API in front of an MCP demo server with failure_mode_allow: false (https://github.com/justrunme/agent-security-contract/tree/main/examples/external-auth).

03
Trade-offs

ASC evaluates static traces and pre-execution hook payloads against a declared policy. It is not a runtime OS sandbox, a prompt-injection detector, a full ACS wire Guardian, or a signer: envelopes carry an unkeyed integrity digest (hash-checked, not signed). Complementary to Promptfoo-style red teaming and ACS Guardians — not a replacement.

04
Latest evidence

Release v0.3.1 on this corpus of 66 scenarios (33 attack, 33 benign): critical false-ALLOW 0, benign false-BLOCK 0/33, corpus passed, suite wall-clock 19 ms (docs/EVIDENCE.md, results/results.json). Scenarios map to OWASP ACS Instrument.toolCallRequest dispositions (ALLOW / DENY / ASK) and OWASP Agentic Top 10 risks (for example ASI01 goal hijack, ASI02 tool misuse, ASI04 MCP tool poisoning). CI run https://github.com/justrunme/agent-security-contract/actions/runs/39315964590. Metrics apply on this corpus only. External-auth quickstart, on this corpus of 12 scenarios: 6 benign calls ALLOW, data exfiltration is BLOCKed, an unapproved deploy gets REQUIRE_APPROVAL, and malformed input, missing credentials, adapter timeout and a stopped adapter fail closed; critical false-ALLOW 0 (https://github.com/justrunme/agent-security-contract/blob/main/docs/EVIDENCE-EXTERNAL-AUTH.md).

05
Related work

ContractGuard (Ye et al., ACM CCS 2026, https://doi.org/10.1145/3830454.3846789) audits MCP tools before deployment by checking whether a tool's description matches its implementation (static analysis + LLM); ASC addresses a complementary runtime boundary with a deterministic deny-by-default gate evaluating each tool call against a SHA-256-pinned catalog. Progent (Shi et al., arXiv:2504.11703) also checks each call against rules over tool names and arguments with default deny, but generates policies with an LLM and evaluates on live agents; ASC uses human-authored static contracts on recorded traces. CaMeL (Debenedetti et al., arXiv:2503.18813) restructures the agent itself to separate control and data flows from trusted prompts; ASC leaves the agent unchanged and enforces policies as an external pre-execution gate. AgentSpec (Wang et al., ICSE 2026, arXiv:2503.18666) defines a trigger-predicate-action DSL for LangChain agents; ASC fails closed on any undeclared call or enforcement error.

Constraints

Pinned capability digests, ALLOW / BLOCK / REQUIRE_APPROVAL verdicts, fail-closed defaults, OWASP ACS and Agentic Top 10 mapping, and CI-grade evidence envelopes that are hash-checked (not signed).

03

Guides

Read the guide.

04

Related

Nearby systems.

Case 05 · Flagship

BlastGuard

  • SBOM
  • Advisories
  • Sigstore

CVE scanners produce finding counts

Blast radius predicted before CVE count

Case 19 · Flagship

AI Runtime Platform

  • Python
  • vLLM
  • KServe

AI workloads often start as API calls but become production systems that need identity, policy, scaling, telemetry, and clear ownership

Every model call: policy + trace + budget

Case 15 · Pattern

Policy as Code Guardrails

  • OPA
  • Feedback
  • Promote

Security and platform rules are often discovered only after deployment or during reviews

Standards enforced in CI, not slides

Available for meaningful infrastructure conversations

Build systems that stay calm under pressure.

Available for conversations

Talk infrastructure

Book a working session

Meet ↗

Evidence first

For deep dives

Explore the systems

All cases ↗