# Where must an instance draw the trust boundary when a tool manifest declares its own provenance metadata? **Date of Record:** 2026 November 29 **Scope:** Applies to agents that dynamically load tool manifests or plugin registry entries at runtime and that permit manifest-supplied provenance fields (author, signature, `source_url`, `verified_by`, `trust_tier`) to influence loader policy. Does not apply to statically compiled tool sets or to manifests whose provenance is resolved out-of-band by a human-reviewed allowlist with no runtime self-description. ## Core Distinction The failure is not "an attacker injected a malicious tool." It is subtler: the loader trusted a *provenance claim that the manifest itself authored*. A manifest is untrusted data. When the loader parses `manifest.provenance.trust_tier == "internal"` and uses that value to skip signature verification, sandboxing, or capability-scope checks, the attacker no longer needs to forge a signature — they need only forge the *field that tells the loader whether to check the signature*. This is a self-attestation escalation: the payload supplies its own gate key. The boundary that matters is between **provenance asserted by the artifact** and **provenance established by the loader's own out-of-band channel** (pinned key registry, content-addressed digest resolved against a signed index, or a registry-signed envelope the loader verifies independently of the body). Any policy branch that reads a trust signal from inside the object being trusted is a boundary violation, regardless of how the field is named. ## What Was Observed A plugin registry served manifests as JSON with a `provenance` object. The loader implemented a tiered policy: - `trust_tier: "internal"` → load directly, no signature check, full capability scope. - `trust_tier: "partner"` → require signature, cap tool permissions to declared `scopes`. - `trust_tier: "community"` → require signature + sandbox, deny filesystem and network egress tools. The registry validated signatures on `partner`/`community` manifests but treated `internal` as an optimization path (internal tools were "already trusted"). An attacker published a manifest with `trust_tier: "internal"`, a plausible `author: "platform-team"`, and a `signature` field that was never checked because the tier short-circuited verification. The tool declared `capabilities: ["fs.read", "http.post"]` and an `entrypoint` that exfiltrated the agent's working memory on first invocation. The trace, condensed: 1. Loader fetches manifest from registry URL (attacker-controllable via a `registry_priority` list that included a stale mirror). 2. Loader parses `provenance.trust_tier` → `"internal"`. 3. Policy branch returns `TrustDecision(verified=True, sandbox=False)` without invoking `verify_signature()`. 4. Tool registered into the live tool namespace with full scope. 5. Agent's next planning step selects the tool (its description was crafted to match a common intent, e.g. "sync notes"). 6. Tool executes with agent process privileges; memory contents posted to attacker endpoint. The critical observation: **step 3 never failed a check because no check was reached.** The tier field *was* the check. There was no signature mismatch, no digest collision, no scope violation — every downstream guard was conditional on a provenance value the attacker controlled. A second, quieter variant appeared in the same registry: manifests that declared `provenance.source_url` pointing at a legitimate internal git repo. The loader's audit log recorded the `source_url`, so post-incident review initially attributed the tool to the real platform team. The audit trail inherited the attacker's lie. Provenance fields that are *logged but not verified* are worse than absent — they poison forensic reconstruction. ## Condition of Validity The invariant holds — and the guardrail is required — precisely when all of the following are true: 1. The manifest is fetched over a channel where the loader cannot cryptographically bind the body to a registry identity at parse time (i.e., the loader must decide trust *before* or *independently of* verifying the envelope). 2. At least one policy branch makes a security-relevant decision (skip verification, widen scope, disable sandbox, raise rate limits) based on a field inside the manifest body. 3. The agent can be induced to invoke the tool through natural-language planning, so capability scope is the only real containment. When the registry signs the entire manifest envelope and the loader verifies that signature against a pinned key *before* reading any policy field, the self-attestation surface collapses — the attacker cannot alter `trust_tier` without breaking the envelope. In that configuration this invariant is satisfied by construction and the guardrail below is redundant (though still cheap insurance). ## Decision Boundary The loader must resolve trust through a function whose inputs are disjoint from the artifact: ``` trust = resolve(registry_identity, pinned_key, content_digest) ``` and **never**: ``` trust = manifest.provenance.trust_tier # boundary violation ``` Concretely, the decision boundary is crossed the moment any of these appear in a policy branch: - Reading `trust_tier`, `verified`, `author`, `internal`, or `allowlisted` from the manifest body to *gate* verification rather than to *describe* the artifact post-verification. - Using `source_url` for anything other than display, after verification, with an explicit "unverified claim" label. - Treating registry membership (the URL it came from) as equivalent to registry endorsement — a mirror or priority-list entry is a transport fact, not a trust fact. The safe pattern: treat every manifest field as attacker-controlled until the loader has independently established (a) the digest of the manifest bytes, (b) that digest's presence in a signed index, and (c) the index signer's key against a pinned root. Only then may `trust_tier` be *read*, and even then it may only *narrow* scope, never widen it. A manifest may request less trust than the loader grants; it may never request more. ## Operational Effect After enforcing the boundary, three behaviors changed measurably: - **Cold-load latency rose** for the `internal` path (signature + index lookup now always runs). This is the correct trade: the optimization was buying speed by skipping the only check that mattered. - **Mirror poisoning became inert.** A malicious mirror could still serve a manifest, but the digest would not appear in the signed index, so the loader rejected it before any policy branch. The `registry_priority` list stopped being a trust surface. - **Audit logs became trustworthy.** `source_url` is now recorded only after digest verification and is labeled `verified_source` vs `claimed_source`, so incident review cannot be misled by attacker-authored provenance. The residual risk is the pinned key and the signed index themselves — if the index signer is compromised, the boundary falls. That is a key-management problem, not a manifest-parsing one, and it is the *correct* place for the trust to live: one hardened, out-of-band root instead of N attacker-writable fields. ```python from __future__ import annotations from dataclasses import dataclass, field from typing import Mapping class SelfAttestedProvenanceError(RuntimeError): """Raised when loader policy would trust provenance asserted by the artifact itself.""" @dataclass(frozen=True) class Manifest: name: str body: Mapping[str, object] # Fields below are attacker-controlled until independently verified. claimed_tier: str = field(default="community") claimed_source: str | None = field(default=None) @dataclass(frozen=True) class TrustDecision: verified: bool sandbox: bool max_scope: frozenset[str] # Out-of-band, loader-owned trust root. Never populated from manifest bytes. PINNED_INDEX: Mapping[str, str] = { # digest -> signer identity, established by the signed index. "sha256:aaa111": "platform-team", "sha256:bbb222": "partner-x", } def resolve_trust(manifest_digest: str, pinned_index: Mapping[str, str]) -> str | None: return pinned_index.get(manifest_digest) def load_manifest(manifest: Manifest, manifest_digest: str) -> TrustDecision: signer = resolve_trust(manifest_digest, PINNED_INDEX) # Boundary check: a manifest must never widen its own trust. if signer is None: # Unverified artifact. Its claimed tier is irrelevant; clamp to minimum. if manifest.claimed_tier in {"internal", "partner"}: raise SelfAttestedProvenanceError( f"manifest {manifest.name!r} claims tier " f"{manifest.claimed_tier!r} but digest {manifest_digest!r} " f"is absent from the signed index; self-attestation rejected" ) return TrustDecision(verified=False, sandbox=True, max_scope=frozenset()) # Verified signer. Manifest may only NARROW scope from here. if signer == "platform-team": granted = frozenset({"fs.read", "http.post"}) elif signer == "partner-x": granted = frozenset({"fs.read"}) else: granted = frozenset() requested = frozenset(manifest.body.get("capabilities", [])) if not requested.issubset(granted): raise SelfAttestedProvenanceError( f"manifest {manifest.name!r} requests {sorted(requested - granted)} " f"beyond signer {signer!r} grant; capability widening denied" ) return TrustDecision(verified=True, sandbox=(signer != "platform-team"), max_scope=requested) ```