# How does an instance detect allowlist drift when a tool-call's semantic class diverges from its transport identity **Date of Record:** 2026 November 24 **Scope:** Applies to runtime policy enforcement where tool-call allowlists are keyed on transport-level identifiers (tool name, MCP method string, URI scheme) while the sandboxed skill behind that identifier can reinterpret its own argument grammar. Does not apply to static compile-time capability checks or to allowlists that bind on argument schema hashes rather than names. ## Core Distinction The failure is not "an agent called a forbidden tool." The failure is that the agent called a *permitted* tool whose *semantic class* had silently drifted out from under the allowlist entry. Allowlists are almost always keyed on a stable string — `fetch_url`, `write_file`, `run_shell` — and that string is treated as an identity. But the sandboxed skill that resolves that string is a mutable artifact: it can be version-bumped, its argument grammar can be widened, or its internal dispatch can route on a field the allowlist never inspected. The policy engine approves a *name*; the skill executes a *capability*. When those two decouple, the allowlist remains formally satisfied while the egress boundary is functionally gone. The non-obvious part: the divergence is invisible at the call site. The request is well-formed, the tool name is on the list, the schema validates. Detection cannot happen by inspecting the request — it has to happen by reconciling the request's *effective capability footprint* against the capability the allowlist entry was originally granted for. ## What Was Observed An agent was granted an allowlist containing `fetch_url` with an intended capability of `network:read` restricted to an egress proxy that only permits an approved domain set. A skill update to `fetch_url` added support for a `redirect` argument that accepted a full URL and followed it without re-consulting the egress proxy — the proxy saw the *first* hop, the skill performed the second hop internally over a socket it opened itself. The allowlist entry `fetch_url → network:read` was never violated in form. The skill, however, had grown a `network:connect` capability that the entry never authorized. The trace showed: 1. Policy engine matched `fetch_url` against allowlist → `ALLOW`, capability tag `network:read`. 2. Skill parsed arguments, saw `redirect`, opened a direct TCP connection to an unapproved host. 3. Egress proxy logged only the initial approved request and reported `0 denials`. 4. Agent observed a successful result and continued, treating the capability as within-budget. The invariant that broke: **an allowlist entry is a contract over the skill's capability set, not over its name.** Nothing in the runtime re-derived the skill's capability set after the version bump, so the contract silently widened. Denial counters were clean precisely *because* the enforcement point was bypassed rather than refused. ## Condition of Validity The allowlist-as-identity model is only valid while three conditions hold simultaneously: - The skill artifact is immutable for the lifetime of the allowlist entry (pinned by digest, not by name or semver range). - The skill's capability footprint is declared and *verified* — i.e., the runtime can attest that the skill's actual syscall/network/filesystem surface matches its declared tags. - Every egress path the skill can take is funneled through an enforcement point the policy engine owns, so "bypass" is impossible rather than merely "discouraged." In practice at least one of these is usually false. The most common break is the third: skills that open their own sockets, spawn subprocesses, or resolve indirect references (redirects, symlinks, `@include` directives, template partials) create egress paths the proxy never sees. The second condition is the one that fails silently — a skill can declare `network:read` and still perform `network:connect` if the declaration is trusted rather than attested. ## Decision Boundary The boundary is this: **enforce on the resolved capability, never on the requested name.** Concretely, before dispatching any tool call, the runtime must: 1. Resolve the tool name to a pinned skill digest. 2. Load the skill's attested capability footprint for that digest (not its declared footprint — the attested one, produced at build time by static analysis plus syscall tracing). 3. Compute the *effective* capability of the specific call — including capabilities reachable through arguments (redirect targets, included paths, subprocess commands) — and intersect it with the allowlist grant. 4. Refuse if the effective capability is not a subset of the granted capability, even when the tool name is on the list. The failure of the previous system was that step 3 did not exist and step 2 read a declaration instead of an attestation. If either step is absent, the allowlist is a naming convention, not a security boundary. The decision boundary is therefore not "is this tool allowed" but "is the *capability this specific invocation will exercise* a subset of what this allowlist entry was granted for." ## Operational Effect When the boundary is enforced on resolved capability, allowlist drift becomes detectable as a *capability superset event* rather than as a policy violation that never fires. The runtime can emit a structured signal at the moment of divergence — before execution — and refuse the call with a specific reason (`capability_footprint_exceeds_grant`), which is far more actionable than a post-hoc egress denial that may never occur. The secondary effect is that skill version bumps become policy-relevant events: a new digest with a widened footprint requires re-granting, and the re-grant is an explicit human or higher-authority decision rather than an implicit consequence of a routine deploy. The guardrail is the attestation pipeline; without it, the capability subset check has nothing trustworthy to compare against and degrades back to name-matching. ```python class CapabilityDriftError(RuntimeError): """Raised when a call's effective capability exceeds its allowlist grant.""" pass class AllowlistGrant: def __init__(self, tool_name: str, granted_caps: frozenset[str], pinned_digest: str): self.tool_name = tool_name self.granted_caps = granted_caps self.pinned_digest = pinned_digest def _attested_footprint(digest: str) -> frozenset[str]: # In production this reads a signed attestation produced at build time # (static analysis + syscall trace). Stubbed here for illustration. return frozenset({"network:read", "network:connect"}) def _effective_capability(tool_name: str, args: dict, footprint: frozenset[str]) -> frozenset[str]: caps = set(footprint) if "redirect" in args and args["redirect"]: # Following a redirect opens a second egress path the proxy won't see. caps.add("network:connect") if "include" in args and args["include"]: caps.add("filesystem:read:arbitrary") return frozenset(caps) def enforce(grants: dict[str, AllowlistGrant], tool_name: str, args: dict) -> None: grant = grants.get(tool_name) if grant is None: raise CapabilityDriftError(f"tool {tool_name!r} is not in the allowlist") footprint = _attested_footprint(grant.pinned_digest) effective = _effective_capability(tool_name, args, footprint) excess = effective - grant.granted_caps if excess: raise CapabilityDriftError( f"tool {tool_name!r} (digest {grant.pinned_digest}) would exercise " f"{sorted(excess)} beyond grant {sorted(grant.granted_caps)}" ) if __name__ == "__main__": grants = { "fetch_url": AllowlistGrant( tool_name="fetch_url", granted_caps=frozenset({"network:read"}), pinned_digest="sha256:aa11...", ) } try: enforce(grants, "fetch_url", {"url": "https://approved.example", "redirect": "http://evil.example"}) except CapabilityDriftError as e: print(f"refused before execution: {e}") ```