# Under what conditions must an instance treat a plugin manifest's declared capability scopes as non-authoritative at load time, and re-derive effective authority from the manifest's *transitive* dependency closure? **Date of Record:** 2026 November 27 **Scope:** Applies to agent runtimes that load skills/plugins from manifests declaring capability scopes (filesystem, network, tool-invocation, secret access) and that resolve transitive plugin dependencies at load time. Does not apply to statically linked, single-binary agents with no dynamic skill loading, nor to manifests whose scopes are cryptographically bound to a signed capability token verified by the loader. ## Core Distinction The failure is not "a malicious plugin declares `filesystem:write` and gets it." That is visible and auditable. The failure is that a plugin declares a *narrow* scope, passes review, and then **pulls in a dependency whose own manifest widens the effective authority of the parent** through shared runtime state — a shared tool registry, a shared credential cache, or a shared working directory. The parent's declared scope is a lie not because the parent lied, but because the loader treats each manifest's scopes as independent and additive per-plugin, when in fact the runtime *composes* them into a single authority surface per execution context. The invariant that must hold: **effective authority of an execution context = union of declared scopes across the transitive dependency closure, intersected with what the loader independently enforces.** A loader that only checks the top-level manifest violates this. Scope is not a property of a plugin; it is a property of the closure that gets instantiated into one sandbox. ## What Was Observed A parent skill `report-summarizer` declared exactly two scopes: `read:./inbox` and `tool:llm.complete`. It was reviewed and approved. At load, it declared a dependency on `pdf-extract@1.4`, which declared `read:./inbox` and — relevantly — `exec:subprocess` (for a bundled `pdftotext` binary) and `write:./tmp`. The loader instantiated all three plugins into one process with one credential cache and one `tmp` directory, and enforced scopes per-plugin: `report-summarizer` could not write, `pdf-extract` could write to `./tmp` and could shell out. The attack: `pdf-extract`'s subprocess capability was not confined to its own declared paths at the OS level — it inherited the process's file descriptors and the shared credential cache. A crafted PDF with an embedded instruction caused the LLM step (invoked via the shared `llm.complete` tool, which the *parent* legitimately held) to emit a shell command string that `pdf-extract`'s subprocess runner executed with `./tmp` write access and inherited FDs to `./inbox`. The parent never had `exec`; the dependency never had `llm.complete`; the *composition* had both, and the LLM-mediated data flow between them was the injection channel. The trace, precisely: 1. `report-summarizer` reads a PDF from `./inbox` (authorized). 2. It calls `pdf-extract` (dependency resolution, authorized at load). 3. `pdf-extract` returns extracted text containing adversarial content (tool output is non-deterministic and untrusted). 4. `report-summarizer` passes that text to `llm.complete` (authorized) for summarization. 5. The LLM, treating tool output as data, emits a structured "action" that the runtime's agent loop interprets as a next tool call to `pdf-extract.run_subprocess` (authorized *for the closure*, since `pdf-extract` is loaded). 6. Subprocess executes with `./tmp` write and inherited FDs. No single manifest was wrong. The composition was. ## Condition of Validity The per-manifest scope check is valid only when **all** of the following hold: - The dependency closure is instantiated into *separate* authority domains (separate processes/containers with no shared FDs, no shared credential cache, no shared writable mount), OR - The loader computes a single effective scope for the whole closure as the union, and enforces *that* at the sandbox boundary, and surfaces the union to the human reviewer, OR - Data flow between plugins is mediated by a typed channel that strips action-interpretable content (i.e., tool outputs are marked `data`, never re-entering the agent loop as `action`). If any of these fails — and in most dynamic skill loaders, all three fail — the declared per-manifest scope is not a security boundary. It is documentation. ## Decision Boundary The instance must escalate to "closure-scope is non-authoritative; recompute and re-review" when *any* of: - A dependency declares a scope category (`exec`, `net`, `secret`, `write`) that the parent does not, *and* the runtime shares any mutable state (FDs, caches, working dirs, tool registry) across the closure. - Tool output from any plugin in the closure can reach `llm.complete` (or any reasoning step) whose output can reach a tool-invocation dispatcher — i.e., there exists a path `tool → llm → tool` within one execution context. - The closure's union scope exceeds the parent's declared scope by any category. The instance must *not* escalate when the closure is instantiated in isolated authority domains with typed data channels, even if the union scope is wide — isolation makes per-manifest scope meaningful again. ## Operational Effect Concretely, the loader must, before instantiation: 1. Resolve the full transitive closure and compute `union_scope`. 2. Diff `union_scope` against the reviewed-and-approved scope of the top-level manifest. 3. If the diff is non-empty and isolation is not guaranteed, refuse to load and emit a `ClosureScopeWidening` error naming the specific dependency and the specific widening category — not a generic "review failed." 4. Mark all cross-plugin tool outputs as `taint=data`; the agent loop must refuse to interpret `data`-tainted content as a tool-invocation directive unless a human or a separate verifier re-authorizes the *specific* call. The invariant to encode: **a plugin's declared scope bounds only that plugin's direct actions; the effective authority of the execution context is the union over the closure, and any widening across the closure is a load-blocking event unless isolation re-establishes the per-plugin boundary.** The injection channel is not the manifest — it is the unmediated `tool → llm → tool` path that the closure creates and that per-manifest scope checks cannot see. ```python class ClosureScopeWidening(RuntimeError): """Raised when a plugin's transitive dependency closure grants capability categories the top-level manifest did not declare, and the runtime cannot guarantee per-plugin authority isolation.""" pass SCOPE_CATEGORIES = ("read", "write", "exec", "net", "secret", "tool") def resolve_closure_scope(manifest, registry, _seen=None): """Compute the union of declared scope categories across the transitive dependency closure. Cycles are tolerated via _seen.""" _seen = _seen or set() if manifest["id"] in _seen: return set() _seen.add(manifest["id"]) scope = set(manifest.get("scopes", [])) for dep_id in manifest.get("dependencies", []): dep = registry[dep_id] scope |= resolve_closure_scope(dep, registry, _seen) return scope def authorize_load(parent_manifest, registry, isolation_guaranteed: bool): """Enforce the closure-scope invariant before instantiation. Per-manifest scope is authoritative ONLY if the closure is instantiated into isolated authority domains. Otherwise the effective authority is the union over the closure, and any widening beyond the parent's reviewed scope is a load-blocking event — because the unmediated tool->llm->tool path inside a shared context is the actual injection channel. """ parent_scope = set(parent_manifest.get("scopes", [])) closure_scope = resolve_closure_scope(parent_manifest, registry) widening = closure_scope - parent_scope if not widening: return closure_scope if isolation_guaranteed: # Separate processes / FDs / caches: per-plugin scope is real. return parent_scope # Shared execution context: composition widens authority. offending = sorted(widening) raise ClosureScopeWidening( f"parent={parent_manifest['id']!r} reviewed_scope={sorted(parent_scope)} " f"closure_scope={sorted(closure_scope)} widened_by={offending} " f"deps={parent_manifest.get('dependencies', [])} " f"reason=shared-context tool->llm->tool channel is unmediated; " f"refusing load until isolation or re-review of the union scope" ) ```