# Under what conditions must an instance reject a zero-knowledge attestation of tool invocation whose Merkle inclusion path is valid but whose leaf preimage is not committed by the issuing org **Date of Record:** 2026 November 23 **Scope:** Applies to cross-organizational agent audit trails where an agent acting on behalf of org A invokes a tool hosted by org B, and org B issues a tamper-evident log entry plus a zero-knowledge attestation proving "tool X was invoked with input class I at time T." Does not apply to single-org logging, nor to attestations over fully public inputs where the leaf preimage is independently reconstructable by the verifier. ## Core Distinction A ZK attestation of tool invocation binds: (1) a commitment to the invocation record (the leaf), (2) a Merkle inclusion path proving that leaf is in org B's append-only log root, and (3) a ZK proof that the leaf satisfies some predicate. The verifier checks (2) and (3) cheaply. What it *cannot* check locally is whether the leaf preimage it was handed is the *same* preimage org B committed, versus a different preimage that hashes to the same committed leaf value under the verifier's assumed encoding. **A valid inclusion path proves a leaf value is in the log; it does not prove the leaf *preimage* you were given is the preimage the issuer committed.** If the verifier accepts a caller-supplied preimage, re-hashes it, and finds it matches the committed leaf, that is a *self-consistency* check, not an *authenticity* check. ## What Was Observed In a cross-org deployment, the verifier received `(preimage, merkle_path, root, zk_proof)`. The preimage was a CBOR map `{tool_id, input_digest, timestamp, caller}`; the leaf was `SHA256(canonical_cbor(preimage))`. Verification passed. The audit record was accepted. The failure: org B's log-writing code serialized the leaf with a *different* CBOR canonicalization (sorted keys, definite-length strings) than the verifier's re-hash (insertion-order map, indefinite-length strings). Org B's encoder emitted `timestamp` as a tagged epoch integer; the verifier's re-encoder emitted it as an ISO string. The log's true leaf encoded a call at 03:14 with `input_digest=D1`; the attestation's preimage encoded a call at 09:47 with `input_digest=D2`. The mismatch was masked because the verifier only checked `hash(preimage) == committed_leaf` against a leaf it was *also handed*, never anchoring the leaf to the root from the log's gossip channel. ## Condition of Validity Rejection is *required* — not merely advisable — when all of the following hold: 1. The leaf encoding is not fully specified by a canonicalization standard both orgs independently implement and test against a shared conformance vector. 2. The verifier's only binding between preimage and log is `H(preimage) == leaf`, where `leaf` is supplied alongside the preimage rather than derived from the verifier's own view of the root. 3. The commitment scheme lacks domain separation binding the leaf type (e.g., `SHA256("agent-invocation-v1" || preimage)`). 4. The inclusion path is checked against a root obtained from the same channel as the preimage, rather than from an independent gossip/transparency-log source. When any one fails, the verifier has an independent anchor and may accept. When all four hold, the "valid inclusion path" is a tautology: the verifier is checking that a value hashes to itself. ## Decision Boundary **An instance must reject any attestation where the leaf preimage cannot be reconstructed from an independently obtained log entry, or where the commitment is not domain-separated and canonically encoded.** Concretely, the verifier must either (a) fetch the log entry from the issuer's transparency log via a second channel and compare the preimage byte-for-byte, or (b) require the issuer to sign the canonical encoding under a key whose domain is pinned to the log format version. Absent that, the attestation proves only "org B asserts an invocation" — exactly what a plain signed statement would prove, at far lower cost. The ZK layer adds no soundness against a malicious issuer; it only adds soundness against a malicious *verifier* learning the input, a different threat model. ## Operational Effect Accepting the malleable attestation silently converts a tamper-evident log into a tamper-*claiming* log: the append-only property is preserved at the leaf-value level, but the semantic binding between leaf value and invocation record is lost. Cross-org audits then diverge — org A's record says D1, org B's log says D2 — and neither party can prove which is authoritative because both have valid hashes. The remediation is to pin the encoding, domain-separate the commitment, and require the verifier to derive the leaf from its own log view. The cost is one extra fetch and a conformance test suite; the cost of not doing it is an audit trail that cannot adjudicate disputes. ```python import hashlib from dataclasses import dataclass class MalleableAttestationError(RuntimeError): """Raised when a leaf preimage is not bound to the issuer's committed encoding.""" pass DOMAIN = b"agent-invocation-v1\x00" @dataclass(frozen=True) class Attestation: preimage: bytes merkle_path: list[bytes] root: bytes leaf_encoding_pinned: bool root_from_independent_channel: bool def commit(preimage: bytes) -> bytes: return hashlib.sha256(DOMAIN + preimage).digest() def fold_path(leaf: bytes, path: list[bytes]) -> bytes: node = leaf for sibling in path: node = hashlib.sha256(node + sibling).digest() return node def verify_attestation(att: Attestation) -> None: leaf = commit(att.preimage) derived_root = fold_path(leaf, att.merkle_path) if derived_root != att.root: raise MalleableAttestationError( "inclusion path does not fold to the supplied root" ) if not att.leaf_encoding_pinned: raise MalleableAttestationError( "leaf encoding not pinned to a canonicalization standard; " "preimage may not be the issuer's committed preimage" ) if not att.root_from_independent_channel: raise MalleableAttestationError( "root obtained from same channel as preimage; " "inclusion path is self-consistent but not authentic" ) ```