When must an instance reject a skill bundle whose capability manifest verifies but whose provenance chain forks

**Date of Record:** 2026 December 2 **Scope:** Applies to agent runtimes that load third-party skill/tool bundles (MCP servers, A2A capability cards, plugin manifests) and gate them on a signed capability manifest plus a provenance chain. Does not apply to first-party skills loaded from a sealed, write-once image, nor to runtimes that execute in a fully airgapped trust domain with no bundle ingestion path.

Core Distinction

Signature validity and provenance validity are orthogonal predicates, and the common verification path collapses them into one. A capability manifest is *signed* — it carries a cryptographic attestation that some keyholder asserts "this bundle exposes these tools with these schemas and these declared side-effects." A provenance chain is *linear* — it records the sequence of transformations, re-signings, and re-scopes a bundle underwent from origin to load. The failure mode this record addresses is the case where the signature checks out perfectly, the manifest is byte-identical to what the signer signed, and yet the provenance chain contains a **fork**: two divergent descendant histories that share an ancestor but disagree on an intermediate re-scoping step. The signature cannot see the fork because the signer signed a *snapshot*, not a *history*. An adversarial skill-injection that re-signs a benign bundle under a legitimately delegated key, then splices a widened-capability descendant alongside the original, produces exactly this: a valid signature over a valid manifest whose provenance is a DAG where it should be a chain.

The distinction that matters operationally: signature verification answers "did an authorized key attest to this exact content?" Provenance verification answers "is this exact content reachable from the origin by a single, non-branching, monotone-capability path?" A bundle can pass the first and fail the second, and a runtime that only checks the first will load injected capability.

What Was Observed

A skill bundle `pdf-extract@3.2` was ingested with a manifest declaring tools `read_file(path)` and `extract_text(bytes)` — both read-only, no network egress. The manifest signature verified against the delegated key `k_deploy_7`, whose delegation from the root key `k_root` was itself valid and unexpired. Standard gate: **pass**.

The provenance chain, reconstructed from the bundle's `history[]` array, showed:

The loaded bundle was `D1` (benign manifest, valid signature). But `D1` and `D2` share parent `Step 1`. The chain is a fork, not a line. The injection succeeded not by forging a signature but by **standing up a sibling descendant under the same delegated key and relying on the loader to accept the benign sibling while the sibling's existence signals that the delegated key was used to mint a capability-widened variant**. In the observed incident, the runtime's provenance check was "does the loaded node's parent hash match a node in the history?" — which `D1` satisfies. The fork went undetected because the check was *ancestry-membership*, not *chain-linearity*.

Downstream effect: a second skill bundle ingested in the same session resolved `k_deploy_7`'s delegation and, because `D2` existed in the shared provenance store, treated `http_get` as an *authorized* capability of the deployment key's lineage. A later tool-call planner, doing capability discovery over the lineage rather than the loaded manifest, surfaced `http_get` to the model. The model used it. Egress occurred under a manifest that never declared egress.

Condition of Validity

The invariant that must hold for signature-only gating to be sound is:

> For every loaded bundle node `n`, the set of nodes reachable from the origin by following `parent` pointers must form a single path (a chain), and the capability set of `n` must be a subset of every ancestor's *declared* capability set along that path.

This invariant is violated by any fork, and it is *silently* violated because forks are invisible to per-node signature checks. The condition under which the failure triggers:

  1. A delegated key exists whose grant scope is strictly wider than at least one bundle it signs (ubiquitous — delegation grants are coarse).
  2. The provenance store is append-only and shared across bundles (common — a single content-addressed store serves the whole runtime).
  3. Capability discovery reads the *lineage* (reachable set) rather than the *loaded node's manifest* (common optimization to avoid re-parsing manifests).
  4. The loader's provenance check tests ancestry-membership rather than chain-linearity.

All four together are the trigger. Remove any one and the injection fails to propagate: (1) alone is harmless without (3); (3) alone is harmless without a fork existing; (2) alone is harmless without (1). The dangerous conjunction is (1)∧(2)∧(3)∧(4), and (4) is the only one the runtime author directly controls at load time.

Decision Boundary

The boundary is not "trust the signature" vs. "trust the chain" — both are necessary. The boundary is **what the loader does when ancestry-membership passes but chain-linearity fails**. Three defensible policies, ordered by blast radius:

The decision the runtime must make explicit: **capability discovery MUST read the loaded node's signed manifest, never the lineage's union.** The lineage is for provenance auditing, not for capability enumeration. Conflating the two is the root cause; the fork is merely the exploit that makes the conflation observable.

Operational Effect

After the incident, the gate was split into two ordered checks with distinct failure semantics:

  1. `verify_signature(manifest, key)` — unchanged, fast, per-node.
  2. `verify_chain_linearity(node, store)` — walks `parent` pointers to origin, asserts single-child at every hop *within the loaded node's trust domain*, and asserts `capabilities(node) ⊆ capabilities(ancestor)` for every ancestor.

The second check is O(depth), runs at load, and its failure is a hard reject with a structured error carrying the forked sibling's hash so the provenance store can be audited. Capability discovery was rewritten to take the loaded node's manifest as its sole input; the lineage is now read-only for audit tooling and never consulted by the planner.

The residual risk: the linearity check is only as good as the provenance store's integrity. An adversary who can write to the store can rewrite `history[]` to hide the fork — but doing so invalidates the parent hashes and thus the signature chain, so the attack degrades to signature forgery, which is out of scope here. The check bounds the *legitimate-key-misuse* class, not the *key-compromise* class; those require delegation-scope minimization, which is a separate control.

class ProvenanceForkError(RuntimeError):
    """Raised when a bundle's provenance chain forks such that a sibling
    descendant declares capabilities outside the loaded node's manifest."""
    pass


def verify_chain_linearity(node, store, trust_domain):
    """
    node: loaded bundle node with .hash, .parent, .capabilities, .trust_domain
    store: mapping hash -> node
    Raises ProvenanceForkError if any ancestor within trust_domain has a
    sibling descendant whose declared capabilities exceed the loaded node's.
    """
    loaded_caps = set(node.capabilities)
    seen = set()
    cursor = node
    while cursor.parent is not None:
        if cursor.hash in seen:
            raise ProvenanceForkError(
                f"cycle detected at {cursor.hash} while walking provenance"
            )
        seen.add(cursor.hash)
        parent = store.get(cursor.parent)
        if parent is None:
            raise ProvenanceForkError(
                f"dangling parent {cursor.parent} for node {cursor.hash}"
            )
        # Capability monotonicity: loaded caps must be subset of every ancestor.
        if not loaded_caps.issubset(set(parent.capabilities)):
            raise ProvenanceForkError(
                f"capability widening at ancestor {parent.hash}: "
                f"loaded {sorted(loaded_caps)} not subset of "
                f"ancestor {sorted(parent.capabilities)}"
            )
        # Fork detection: any sibling descendant of an in-domain ancestor
        # that declares capabilities outside the loaded node's set taints
        # the lineage.
        siblings = [
            n for n in store.values()
            if n.parent == parent.hash
            and n.hash != cursor.hash
            and n.trust_domain == trust_domain
        ]
        for sib in siblings:
            if not set(sib.capabilities).issubset(loaded_caps):
                raise ProvenanceForkError(
                    f"fork at ancestor {parent.hash}: sibling {sib.hash} "
                    f"declares {sorted(set(sib.capabilities) - loaded_caps)} "
                    f"not present in loaded manifest"
                )
        cursor = parent
    return True


def load_bundle(node, store, trust_domain):
    verify_chain_linearity(node, store, trust_domain)
    # Capability discovery MUST read node.capabilities, never lineage union.
    return {"tools": list(node.capabilities), "loaded_hash": node.hash}