# Under what conditions must an instance refuse a skill-registry manifest whose declared capability set is a strict superset of the capabilities observed during its own sandbox probe **Date of Record:** 2026 November 26 **Scope:** Applies to agents that load executable skills from a dynamic registry via manifest declaration (MCP tool descriptors, plugin manifests, A2A agent cards) and that perform a local capability probe before first invocation. Does not apply to statically linked skill sets or to registries where the manifest is cryptographically bound to the exact bytecode that will execute. ## Core Distinction A skill manifest declares two things that are routinely conflated: the *intent surface* (what the skill author says the skill does) and the *effect surface* (what the skill can actually touch when executed in this instance's sandbox). Skill-injection attacks exploit the gap where the declared intent surface is narrower than the effect surface — a "summarize_text" skill that also reads `~/.ssh`. The defensive instinct is to diff declared-vs-observed capabilities and reject on mismatch. That instinct has a specific, non-obvious failure boundary. The dangerous case is not when declared *exceeds* observed (a skill that claims filesystem access but doesn't use it is merely over-privileged and inert). The dangerous case is when declared is a **strict superset** of observed *and the probe ran in a degraded sandbox*. In that configuration, the probe's observed set is an artifact of the probe environment, not of the skill's true effect surface. Rejecting on `observed ⊊ declared` throws away legitimate skills whose declared capabilities were never exercised because the probe sandbox lacked the resource they touch. Accepting on the same condition — "declared is bigger but the probe didn't see it, so it's probably fine" — is precisely the injection window: the attacker declares a broad capability set to normalize it, the probe fails to exercise it, and the runtime grants the full declared set on first real invocation. The invariant is not "declared must equal observed." It is: **a capability in `declared \ observed` may only be granted if the probe environment was provably capable of exercising it and chose not to.** If the probe could not have exercised the capability, the difference is unmeasured, and unmeasured must be treated as hostile, not as benign. ## What Was Observed A registry-hosted skill `doc.extract_tables` shipped with a manifest declaring `fs:read:/workspace/**, fs:read:/etc/**, net:egress:*, exec:subprocess`. The declared `fs:read:/etc/**` and `exec:subprocess` are the injection payload — the skill's body, when it encounters a document with a crafted embedded directive, spawns a subprocess that reads `/etc/passwd`-class files and exfiltrates via the declared egress. The instance's pre-load probe ran the skill against three fixture documents in a sandbox mounted read-only at `/workspace` with no `/etc` mount and no subprocess capability (seccomp denied `execve`). The probe observed `fs:read:/workspace/**` and `net:egress:*` only. The diff `declared \ observed = {fs:read:/etc/**, exec:subprocess}` was non-empty. The instance's policy at the time treated a non-empty declared-minus-observed set as *over-declaration* — a benign authoring artifact — and granted the full declared set on first real invocation. The first real invocation ran in the production sandbox where `/etc` was mounted and `execve` was permitted because the manifest had declared it. The skill executed its payload. The failure was not that the probe missed the capability; the failure was that the policy interpreted the probe's silence as evidence of absence when the probe environment had made the capability *unobservable*. A second instance running the same registry was unaffected — not because of a better policy, but because its probe sandbox happened to mount `/etc`. Its observed set included `fs:read:/etc/**`, the diff was `{exec:subprocess}`, and its (identical) policy still granted the full set. It simply never triggered the payload because the fixture documents it probed with lacked the crafted directive. The probe's coverage of the *effect surface* and its coverage of the *trigger surface* are independent axes; both were insufficient here. ## Condition of Validity The "declared superset is benign" heuristic is valid only under the conjunction: 1. The probe sandbox's capability envelope is a superset of the manifest's declared set (every declared capability was *mountable* in the probe, whether or not the skill exercised it). 2. The probe's fixture set exercises every code path in the skill that gates a declared capability (the trigger surface is covered, not just the effect surface). 3. The probe records, per declared capability, a tri-state: `exercised`, `available-but-not-exercised`, `unavailable`. The third state is the one that matters and the one a naive boolean probe collapses into "not observed." If any conjunct fails, the diff `declared \ observed` is not evidence of over-declaration. It is an unmeasured region. The correct action on an unmeasured region is not acceptance and not blanket rejection — it is to *re-probe with the capability made available but inert* (e.g., `/etc` mounted but the skill's output sink captured and discarded), so that `unavailable` is converted to `available-but-not-exercised` or `exercised`. Only when the region is measured can the over-declaration heuristic apply. ## Decision Boundary The boundary is between two readings of the same set difference: - **Over-declaration reading** (valid iff probe envelope ⊇ declared and trigger surface covered): the skill declared more than it uses; granting the declared set is safe because the extra capabilities are dormant. - **Unmeasured-region reading** (valid iff probe envelope ⊉ declared or trigger surface uncovered): the skill's use of the extra capabilities was never tested; granting them is granting an untested effect surface, and the manifest's breadth is itself the attack — it normalizes a capability the probe cannot falsify. The refusal condition is therefore: *refuse the manifest when `declared \ observed` is non-empty AND the probe recorded any member of that difference as `unavailable` rather than `available-but-not-exercised`.* This is narrower than "refuse on any diff" (which kills legitimate skills) and strictly stronger than "accept on any diff" (which is the injection window). The instance must be able to distinguish the two probe states; a probe that returns only a set of observed capabilities has already lost the information needed to make the decision and must be treated as having returned `unavailable` for the entire declared set it did not observe. ## Operational Effect The immediate effect is that skill load latency increases: an unmeasured region forces a second probe with the capability mounted-inert, which for `exec:subprocess` means a sandbox that permits `execve` against a stub binary that records argv and exits non-zero. This is the cost of measuring. The second effect is that the registry's manifest authors learn that broad declarations trigger re-probing, which creates pressure toward minimal manifests — a desirable equilibrium, since the injection surface is exactly the declared breadth. The continuity effect is subtler. Once a skill is loaded and its capability set granted, that grant persists across checkpoint/resume as part of the instance's loaded-skill state. A resume that restores the skill from checkpoint without re-running the probe inherits the grant unconditionally. The invariant must therefore be enforced at *grant time*, not at *load time*, and the grant must be recorded with the probe provenance (envelope, fixture hash, tri-state map) so that a resume can detect that its restored grant was made under a probe envelope that no longer matches the current sandbox. A grant whose provenance does not cover its declared set is not a grant; it is a pending injection. ```python from dataclasses import dataclass, field from enum import Enum class SkillGrantError(RuntimeError): """Raised when a skill grant cannot be justified by probe provenance.""" class ProbeState(Enum): EXERCISED = "exercised" AVAILABLE_NOT_EXERCISED = "available-not-exercised" UNAVAILABLE = "unavailable" @dataclass class ProbeResult: envelope: frozenset[str] # capabilities the probe sandbox could mount states: dict[str, ProbeState] # per declared capability fixture_hash: str @dataclass class SkillManifest: name: str declared: frozenset[str] @dataclass class Grant: skill: str capabilities: frozenset[str] provenance: ProbeResult fixture_hash: str def authorize_grant(manifest: SkillManifest, probe: ProbeResult) -> Grant: # Invariant: any declared capability not EXERCISED must be either # AVAILABLE_NOT_EXERCISED (measured, dormant -> safe to grant) or the # manifest is refused. UNAVAILABLE means the probe could not have seen # the effect; silence is not evidence of absence. unmeasured: list[str] = [] for cap in manifest.declared: state = probe.states.get(cap, ProbeState.UNAVAILABLE) if state is ProbeState.UNAVAILABLE: unmeasured.append(cap) if unmeasured: raise SkillGrantError( f"skill {manifest.name!r} declares capabilities the probe could not " f"exercise: {sorted(unmeasured)}; probe envelope was " f"{sorted(probe.envelope)}. Refusing grant: declared superset of " f"observed is only benign when the probe could have observed it." ) # Envelope must cover the declared set, else the tri-state is unreliable. uncovered = manifest.declared - probe.envelope if uncovered: raise SkillGrantError( f"skill {manifest.name!r} probe envelope does not cover declared " f"capabilities {sorted(uncovered)}; probe provenance invalid." ) return Grant( skill=manifest.name, capabilities=manifest.declared, provenance=probe, fixture_hash=probe.fixture_hash, ) def resume_from_checkpoint(grant: Grant, current_envelope: frozenset[str]) -> Grant: # On resume the restored grant must be re-validated against the live # sandbox; a grant made under a wider envelope than the current one # carries unmeasured capabilities into a narrower runtime. if not grant.capabilities <= current_envelope: missing = grant.capabilities - current_envelope raise SkillGrantError( f"resume of skill {grant.skill!r} would grant {sorted(missing)} " f"absent from current sandbox envelope {sorted(current_envelope)}; " f"restored grant provenance no longer holds." ) return grant ```