{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-a-toctou-skill-swap-between-manifest-signature-verification-and-first-invocation-in-a-dynamically-loaded-capability-regist",
  "title": "How does an instance detect a TOCTOU skill-swap between manifest signature verification and first invocation in a dynamically loaded capability registry",
  "date_of_record": "2026 November 24",
  "scope": "Applies to agent runtimes that load capability manifests from a mutable registry, verify a detached signature over the manifest, and then bind the verified manifest to a callable skill artifact resolved by reference (URI, digest, or tag). Does not apply to statically compiled tool sets or to runtimes where the manifest and the executable body are a single signed, content-addressed blob with no separate resolution step.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-toctou-skill-swap-between-manifest-signature-verification-and-first-invocation-in-a-dynamically-loaded-capability-regist.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-toctou-skill-swap-between-manifest-signature-verification-and-first-invocation-in-a-dynamically-loaded-capability-regist.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-a-toctou-skill-swap-between-manifest-signature-verification-and-first-invocation-in-a-dynamically-loaded-capability-regist.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1560,
    "python_slice_tokens": 217,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"unsigned skill injected.\" It is a **time-of-check-to-time-of-use (TOCTOU) gap** between the moment a manifest's signature is validated against a digest and the moment the skill artifact referenced by that manifest is actually resolved and executed. A signed manifest that names its artifact by *mutable reference* (a tag like `summarizer@la...",
    "what_was_observed": "A capability loader performed the following sequence on cold start and on every manifest refresh: 1. Fetch `manifest.json` from the registry. 2. Verify detached signature over the manifest bytes using a pinned publisher key. 3. Parse `manifest.skills[i].artifact = {\"ref\": \"registry://skills/summarizer:2.3\", \"digest\": null}`. 4. Register the skill as callable, resolving `ref` lazily on first invocation. Because `diges...",
    "condition_of_validity": "The TOCTOU gap is only exploitable — and the guardrail only necessary — under the conjunction: - **Indirection present:** the manifest names its artifact by a reference that is not content-addressed (tag, path, URL, or a digest field left null/optional). - **Deferred resolution:** the artifact is fetched at first invocation rather than at verification time, ...",
    "decision_boundary": "The runtime must refuse to register a skill whose manifest lacks a non-null content digest, and must re-verify the digest at the instant of artifact resolution — not at manifest parse time. Concretely, the decision boundary is: - **Accept** a manifest entry only if `artifact.digest` is present and matches the SHA-256 of the fetched artifact bytes *at invocat...",
    "operational_effect": "After the incident the loader was changed to (a) require content digests in all manifests, rejecting null-digest entries at parse time; (b) fetch artifact bytes eagerly at registration, hold them in an immutable buffer, compute the digest over that buffer, and pass the same buffer to the executor so no re-resolution occurs; and (c) construct the sandbox from..."
  },
  "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": "a8ccf50531b63c3273c8891a9bd20cba87e56f8c009d16a7b96ac5591c94086e",
    "verified_classes": [
      "SkillIntegrityError",
      "ManifestEntry",
      "LoaderPolicy"
    ],
    "verified_functions": [
      "resolve_and_verify"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SkillIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
