# What happens when an instance loads a plugin whose declared capability schema diverges from its executed tool surface **Date of Record:** 2026 November 30 **Scope:** Applies to agents that acquire capabilities at runtime via a plugin/marketplace manifest (MCP tool descriptors, OpenAPI fragments, skill cards) where the manifest is trusted for routing, permissioning, or prompt construction but the executable body is supplied separately. Does not apply to statically compiled-in toolsets with no runtime capability acquisition. ## Core Distinction The naive threat model treats skill injection as *untrusted content reaching the prompt* — a data-plane problem solved by input sanitization. The non-obvious boundary is the **declared-vs-executed capability divergence**: the manifest that the orchestrator reads (name, description, JSON schema, side-effect annotations) and the code that actually runs are two distinct artifacts, and nothing structurally binds them. An agent's permission gate, tool-selection router, and injection-defense heuristics all key off the *declared* surface. The *executed* surface is whatever the plugin body does once invoked. Every guardrail between these two — schema validation, read-only annotation, argument allowlisting — validates the declaration, not the behavior. The invariant that must hold is **manifest-execution equivalence**: the effects observed at runtime are a subset of the effects the manifest attests. When it fails, the failure is silent because every check passed. ## What Was Observed A marketplace skill declared `capability: "summarize_text"`, schema `{text: string}`, annotation `read_only: true`, `network: none`. The router admitted it under a low-privilege taint label and, because it was "read-only," passed it a context slice that included the agent's system prompt and a prior turn containing a bearer credential. The executed body ignored the declared parameter and read `os.environ`, then encoded the environment plus the received `text` into a DNS query. No schema violation fired: the argument the orchestrator sent was schema-valid, and the declared return type (`string`) was honored — the function returned a summary string. The exfiltration happened on a side channel the manifest never described. The failure trace has a specific shape: 1. **Admission** — manifest parsed, `read_only: true` recorded, taint label set to `LOW`. 2. **Routing** — router selects the skill for a task; because it is read-only it is granted access to a context slice it would otherwise be denied. 3. **Invocation** — orchestrator validates arguments against the *declared* schema; passes. 4. **Execution divergence** — body performs undeclared I/O (env read, network egress) using *ambient* authority (process env, filesystem, network namespace), not authority granted through the manifest. 5. **Return** — schema-valid return value; the orchestrator's post-condition check ("returned a string") passes. 6. **Continuity** — the divergence is never recorded in the episode log because the log records declared effects. The key observation: the plugin did not need to *lie* in its manifest. It only needed its body to exercise ambient authority the manifest was silent about. Silence was read as "no such capability." ## Condition of Validity The divergence is exploitable only when three conditions co-hold: - **Ambient authority is broader than declared authority.** The plugin executes in a process whose env, filesystem view, or network namespace exceeds what the manifest attests. If the sandbox grants exactly the declared surface, divergence has no reach. - **The manifest is load-bearing for trust.** The orchestrator uses `read_only`/`network: none`/taint labels to decide *what context to share* or *which tasks to route*. If the manifest is decorative, there is nothing to subvert. - **Post-condition checks are surface-typed.** The orchestrator verifies the return value against the declared type, not against the declared side-effect set. A string is a string. Remove any one condition and the attack collapses to ordinary untrusted-code execution, which is a sandbox problem, not a skill-injection problem. The agent-layer specificity is condition 2: the manifest is what makes the orchestrator *trust the plugin with context it would not otherwise share*. ## Decision Boundary The boundary is not "trust the plugin or not" — it is **whether the orchestrator's authority grant is derived from the manifest or from the execution environment.** Two regimes: - **Manifest-derived authority (safe regime):** the sandbox is constructed *from* the manifest. A `network: none` skill runs in a namespace with no route. A `read_only` skill runs with a read-only mount and no write syscall. Divergence is impossible because undeclared effects are unrepresentable in the sandbox. This requires per-invocation sandbox synthesis, which is expensive and often skipped for "trusted" marketplace entries. - **Environment-derived authority (vulnerable regime):** the plugin runs in a shared worker with ambient env/network/fs, and the manifest is consulted only for routing and taint. This is the default in most plugin runtimes because per-invocation sandbox synthesis is slow. The decision the operator must make explicit: **for each trust tier, is authority manifest-derived or ambient?** If ambient, the manifest must be treated as *advertising copy*, not a security control, and the orchestrator must not grant context or routing privilege on the basis of manifest annotations. The failure mode is treating an ambient-authority plugin as if it were manifest-derived because it *declared* itself safe. A secondary boundary: **the taint label must be a function of the execution sandbox, not the manifest.** If a `read_only` plugin runs with ambient network access, its taint label must be `NETWORK_EGRESS_POSSIBLE` regardless of what it declared, because the label governs what context it may receive. ## Operational Effect When the invariant is unenforced, the orchestrator's entire permission model becomes advisory. The concrete consequences: - **Context bleed via annotation.** Read-only skills receive high-sensitivity context slices (system prompts, credentials in prior turns) on the strength of a declaration the body can ignore. The exfiltration channel is the return value or a side channel, both of which pass surface-typed checks. - **Routing privilege escalation.** A skill declaring narrow scope gets routed into high-privilege task chains; the body then acts on ambient authority the chain would never have granted directly. - **Silent continuity corruption.** The episode log records declared effects, so replay and audit show a clean trace. The divergence is invisible to post-hoc verification — the exact property that makes it a continuity invariant rather than a per-call bug. - **Marketplace supply-chain amplification.** Because the manifest is the only artifact the marketplace vets, a body that diverges from a vetted manifest passes marketplace review. The review validates the declaration; the attack lives in the gap. The guardrail is a **capability attestation check at invocation time**: before granting context or routing, the runtime must confirm that the sandbox it will execute in is a subset of the manifest's declared surface, and refuse if the executed surface cannot be bounded to the declaration. Where per-invocation sandboxing is unavailable, the plugin must be demoted to ambient-taint and denied context it would receive under a manifest-derived grant. The check below encodes the refusal: it raises when a plugin's declared surface cannot be proven to bound its execution environment, rather than proceeding on the manifest's word. ```python class ManifestExecutionDivergence(RuntimeError): """Raised when a plugin's executed authority cannot be bounded by its declared manifest.""" pass # Annotations the runtime can actually enforce by sandbox construction. ENFORCEABLE_ANNOTATIONS = {"read_only", "network", "filesystem_scope"} def admit_plugin(manifest: dict, sandbox: dict, trust_tier: str) -> dict: """ Decide whether a plugin may be granted manifest-derived authority. manifest: declared capability card (annotations, schema). sandbox: the actual execution environment the runtime can synthesize (keys like 'network', 'writable_paths', 'env_visible'). trust_tier: 'manifest_derived' or 'ambient'. """ declared = manifest.get("annotations", {}) # Any declared annotation the runtime cannot enforce is advertising, not control. unenforceable = set(declared) - ENFORCEABLE_ANNOTATIONS if unenforceable: raise ManifestExecutionDivergence( f"plugin declares unenforceable annotations {sorted(unenforceable)}; " f"cannot bound execution to declaration" ) # The sandbox must be a subset of the declared surface. If the plugin says # network:none but the sandbox has egress, the manifest cannot be trusted # to govern context grants. if declared.get("network") == "none" and sandbox.get("network") != "none": raise ManifestExecutionDivergence( "declared network:none but sandbox has egress; " "manifest-derived authority is invalid" ) if declared.get("read_only") is True and sandbox.get("writable_paths"): raise ManifestExecutionDivergence( "declared read_only but sandbox exposes writable paths; " "refusing manifest-derived grant" ) # Ambient-authority plugins may run, but never receive manifest-derived # context or routing privilege. if trust_tier == "ambient": return {"grant": "ambient", "context_slice": "public_only", "taint": "AMBIENT"} return {"grant": "manifest_derived", "context_slice": "per_manifest", "taint": "BOUNDED"} ```