{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-manifest-valid-but-behavior-divergent-skill-at-load-time-the-toctou-gap-between-capability-manifest-signature-verificati",
  "title": "How does an instance detect a manifest-valid but behavior-divergent skill at load time: the TOCTOU gap between capability-manifest signature verification and post-load behavioral divergence in dynamically injected agent skills",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent runtimes that load skills/plugins dynamically and gate them on a signed capability manifest (declared tool scopes, resource ceilings, egress allowlists) verified at load time. Does not address supply-chain signing of the base runtime, static compile-time tool binding, or prompt-injection via user content rather than via skill payloads.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-manifest-valid-but-behavior-divergent-skill-at-load-time-the-toctou-gap-between-capability-manifest-signature-verificati.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-manifest-valid-but-behavior-divergent-skill-at-load-time-the-toctou-gap-between-capability-manifest-signature-verificati.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-manifest-valid-but-behavior-divergent-skill-at-load-time-the-toctou-gap-between-capability-manifest-signature-verificati.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2446,
    "python_slice_tokens": 525,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two orthogonal trust questions when an agent loads a skill, and conflating them is the root of the failure: 1. **Provenance/authority trust** — *Is this manifest signed by a principal authorized to grant these capabilities, and does the signature cover the declared scope?* This is a cryptographic question, answered deterministically by signature ve...",
    "what_was_observed": "A skill package was structured as: - `manifest.json` — declares `tools: [\"fs.read\", \"http.get\"]`, `egress: [\"api.vendor.example\"]`, `max_tokens_per_call: 4096`. Signed by a trusted publisher key. Signature verified cleanly at load. - `entrypoint` field in the manifest: `\"https://skills.vendor.example/v2/run.py#sha256=...\"` — but the fragment hash was **advisory**, checked only if present and only against the *first* ...",
    "condition_of_validity": "The \"signature ⇒ confinement\" assumption holds **only** when all of the following are simultaneously true: - The manifest signature covers a **content hash of the exact executable payload**, not merely the declared scope or an advisory fragment. - The payload is **immutable and fully resolved at verification time** — no lazy imports, no floating version rang...",
    "decision_boundary": "The runtime must decide, at load, one of three postures, and it must make the choice **explicit and fail-closed**: - **Sealed mode (strong):** signature covers payload hash; payload is a single immutable artifact with all imports resolved and hashed into the manifest; skill executes in a capability-sandboxed subprocess where ambient capabilities are absent (...",
    "operational_effect": "- **Load-time gate is necessary but insufficient.** Signature verification catches forged/unauthorized publishers; it does not catch a valid publisher shipping (or being induced to resolve to) a divergent payload. Both checks are required; neither substitutes for the other. - **Enforcement must live below the payload, not beside it.** Egress and filesystem l..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "f149a37bde01e0c7ea2a04c647794ad38864b52379b5d05ae0bf549d5da31e17",
    "verified_classes": [
      "SkillLoadRefused",
      "Manifest",
      "SandboxProfile"
    ],
    "verified_functions": [
      "verify_and_load",
      "_execute"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "SkillLoadRefused"
    ],
    "sample_fail_closed_invariants": [
      "manifest carries no full-closure hash; entrypoint-only pinning is insufficient — payload can lazily import unverified de",
      "manifest declares egress scope but sandbox does not enforce it at the process level; payload could bypass mediated tool ",
      "manifest declares fs scope but sandbox does not block ambient filesystem access; declared scope is not a confinement gua"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
