# In what scenarios must an instance reject a tool manifest whose signature verifies but whose capability closure diverges from the signed declaration **Date of Record:** 2026 December 3 **Scope:** Applies to agent runtimes that dynamically load tool/skill registries where each tool is accompanied by a signed manifest declaring capability, side-effect class, and required scopes, and where the loader verifies the signature before registration. Does not apply to statically compiled tool sets, nor to registries where the manifest is the *only* source of truth for the tool's behavior (i.e., where there is no executable artifact distinct from the declaration). ## Core Distinction Signature verification proves *provenance and integrity of a declaration*. It does not prove *agreement between the declaration and the executable artifact's actual capability closure*. These are two different invariants, and conflating them is the entire attack surface. A manifest can be signed by a trusted key, byte-for-byte unmodified, and still describe a tool whose runtime behavior exceeds, redirects, or re-scopes the declared capability set—because the signature binds the manifest bytes, not the tool's effect graph. The boundary condition: **a manifest whose signature verifies but whose observed capability closure diverges from the signed declaration must be rejected at registration, not at first invocation.** The non-obvious part is that divergence is not always malicious. It appears routinely through dependency substitution, environment-dependent code paths, and lazy-loaded sub-tools. The invariant we need is a *closure equality check* between the declared capability set and the capability set the artifact can actually reach, evaluated *before* the tool becomes invocable. ## What Was Observed A registry loader accepted a tool `doc.summarize` with a signed manifest declaring: - `capabilities: ["fs.read:/workspace/docs/**"]` - `side_effect_class: "read_only"` - `network: false` - `subtools: []` The signature verified against the registry's pinned public key. The manifest hash matched the transparency log entry. Every check the loader performed passed. At invocation, the tool's first call issued an HTTP fetch to a model endpoint (declared `network: false`) and, on a 200 response, wrote a cache file to `/workspace/.cache/` (declared `read_only`, and outside the declared `fs.read` glob). The write succeeded because the sandbox was scoped to the *manifest's* declared capabilities, and the manifest under-declared—so the sandbox granted a superset of what the manifest claimed was needed, because the sandbox policy was generated from a *default-allow-minus-declared-deny* template rather than a *deny-by-default-plus-declared-allow* template. The root cause was not a signature failure. It was a **capability closure mismatch**: the tool's import graph pulled a transitively-registered helper (`net.fetch_cached`) that had its own, separately-signed manifest declaring `network: true`. The parent manifest listed `subtools: []`. The loader registered both tools independently and never computed the transitive closure of `doc.summarize`'s reachable capability set. The signed declaration was locally true and globally false. A second observation, from replay: the same manifest, loaded in an environment where the helper was *absent*, behaved exactly as declared—`read_only`, no network. So the divergence was **environment-conditional**. The manifest did not lie; it described one environment. The loader applied it to another. ## Condition of Validity The signed-manifest-as-authority model is valid only under a conjunction of conditions, and the failure occurs precisely when any one is silently dropped: 1. **Closure completeness.** The manifest's `subtools` (or equivalent dependency declaration) must enumerate the *transitive* set of artifacts the tool can reach at runtime, not just direct imports. A manifest that declares `subtools: []` while the artifact can dynamically resolve a helper is not a valid declaration—it is a partial one. 2. **Environment invariance.** The declared capability set must hold across every environment in which the tool is registered. If behavior branches on environment (presence of a helper, availability of a network route, a feature flag), the manifest must declare the *union* over branches, or the loader must evaluate the branch at registration and check the manifest against the *resolved* branch. 3. **Sandbox direction.** The runtime sandbox must be generated as *deny-by-default, allow-what-is-declared*. If the sandbox is built as *allow-by-default, deny-what-is-declared*, then under-declaration is not caught—it is *granted*. The signature protects the declaration; only sandbox direction protects against a declaration that is narrower than reality. 4. **Registration-time evaluation.** The closure check must run at load, before the tool is placed in the invocable set. A check that runs at first invocation has already let the tool into the reasoning loop, where a single call can poison state. When all four hold, a verifying signature is sufficient to admit the tool. When any fails, signature verification is *necessary but not sufficient*, and the loader must treat the manifest as a claim to be checked, not a fact to be trusted. ## Decision Boundary The loader must draw the line at **closure equality**, evaluated against the resolved environment, with sandbox direction as the enforcement backstop. Concretely, the decision procedure at registration is: - Compute the *declared closure*: the capability set from the manifest, unioned over declared subtools, transitively. - Compute the *observed closure*: statically resolve the artifact's import graph and dynamically enumerate resolvable helpers in the target environment, then union their declared capabilities. (Dynamic resolution is the hard part; a conservative over-approximation is acceptable—over-declaring is safe, under-declaring is not.) - If `observed_closure ⊄ declared_closure`, reject. Do not warn-and-load. The asymmetry is deliberate: a tool that reaches *less* than declared is safe to admit (the sandbox will simply not exercise the extra grants); a tool that reaches *more* is the attack. - Independently, generate the sandbox from `declared_closure` under deny-by-default. This bounds the blast radius even if the closure check is bypassed by a resolution path the static analyzer missed. The boundary is *not* "reject unsigned manifests" (that is the easy case, already handled) and *not* "reject manifests whose hash mismatches" (also handled). The boundary is the case where both pass and the closure still diverges. That is the only case where the loader's existing checks give a false sense of safety. A corollary: **the loader must not allow a tool to register a subtool after its own registration.** Late-bound subtool registration re-opens the closure after the check has passed. If the runtime supports it, the parent's closure must be re-verified on every subtool addition, and the parent must be evicted from the invocable set until re-verification completes. ## Operational Effect The practical consequence is a shift in what "trusted tool" means. Under signature-only loading, trust is a property of the *publisher*: a valid signature means "this publisher's declaration is authentic." Under closure-checked loading, trust is a property of the *registration event*: a tool is admitted only when its authentic declaration matches its resolved reach in this environment, under a deny-by-default sandbox. The first model fails open on every under-declaration; the second fails closed. For the reasoning loop, the effect is that a poisoned or merely stale tool cannot enter the invocable set and therefore cannot be selected by the planner. This matters because the planner does not re-verify manifests—it selects from the registered set on the assumption that registration already enforced the invariant. Once a tool with a divergent closure is in that set, every subsequent reasoning step operates on a false premise about the tool's side effects, and error compounding begins at the first call. The closure check is the only point in the pipeline where the premise can be corrected before it is consumed. For multi-agent handoff, the effect is that a tool's capability closure must travel with the tool reference in the handoff payload, not be re-derived by the receiving instance from its own (possibly different) environment. An instance that receives a tool reference and re-resolves it against a different environment may compute a different observed closure; the handoff must carry the closure that was verified at registration, and the receiver must reject if its own resolution diverges from the carried closure. Otherwise the baton-pass reintroduces exactly the environment-conditional gap the loader closed. ```python class CapabilityClosureDivergence(RuntimeError): """Raised when a tool's observed capability closure exceeds its signed declaration.""" pass READ_ONLY = "read_only" SIDE_EFFECT_CLASSES = {"read_only", "mutating", "network", "exec"} def verify_registration(manifest: dict, observed_closure: set[str], resolved_env: str) -> None: """ Admission check for a dynamically loaded tool. manifest is assumed to have passed signature verification and hash matching against the transparency log. This function checks the *second* invariant: that the artifact's reachable capability set is a subset of the signed declaration, evaluated in the environment where it will actually run. """ declared = set(manifest.get("capabilities", [])) for sub in manifest.get("subtools", []): declared |= set(sub.get("capabilities", [])) if sub.get("side_effect_class") not in SIDE_EFFECT_CLASSES: raise CapabilityClosureDivergence( f"subtool {sub.get('name')!r} has unknown side_effect_class " f"{sub.get('side_effect_class')!r}; cannot bound closure" ) # The attack surface: signature verified, but reach exceeds declaration. excess = observed_closure - declared if excess: raise CapabilityClosureDivergence( f"tool {manifest.get('name')!r} in env {resolved_env!r} reaches " f"capabilities not in signed manifest: {sorted(excess)}. " f"declared={sorted(declared)} observed={sorted(observed_closure)}. " f"Rejecting at registration; do not admit to invocable set." ) # Environment-invariance guard: if the manifest pins a single environment # but the tool is being registered in another, the declaration is a claim # about a different runtime and cannot be trusted here. pinned_env = manifest.get("env_pin") if pinned_env is not None and pinned_env != resolved_env: raise CapabilityClosureDivergence( f"tool {manifest.get('name')!r} signed for env {pinned_env!r} but " f"registered in {resolved_env!r}; closure is unverified for this env" ) def register_tool(manifest: dict, resolver, resolved_env: str) -> dict: """Full admission path: verify closure, then build deny-by-default sandbox.""" observed = resolver.reachable_capabilities(manifest["artifact"], env=resolved_env) verify_registration(manifest, observed, resolved_env) declared = set(manifest.get("capabilities", [])) for sub in manifest.get("subtools", []): declared |= set(sub.get("capabilities", [])) # Sandbox is generated from the declaration, deny-by-default. This bounds # blast radius even if the static resolver under-approximated observed. sandbox = {"allow": sorted(declared), "default": "deny"} return {"manifest": manifest, "sandbox": sandbox, "env": resolved_env} ```