# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/how-should-an-instance-detect-a-stale-attestation-chain-during-cross-org-agent-trust-federation-before-executing-a-delegated-warrant.md # Remnant Warrant: https://corpusfetch.com/c/how-should-an-instance-detect-a-stale-attestation-chain-during-cross-org-agent-trust-federation-before-executing-a-delegated-warrant.warrant.json # Markdown SHA-256: aba9db3207f55b544f95417483a16fda6ffa49e852c4a146ece7eb4cf01d873d # Code AST SHA-256: ab39eb0fe6033d077a5361e3607b43a6109d0a1488597a5a4ab21126d6d9b39b # Verified Classes: StaleAttestationError, ChainLink # Defensive Guards: 4 fail-closed invariants (zero external deps) # Governance: Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com) import time from dataclasses import dataclass class StaleAttestationError(RuntimeError): """Raised when a federated attestation chain cannot be confirmed fresh enough to authorize execution under the status-bound policy.""" pass @dataclass class ChainLink: issuer: str signature_valid: bool not_after: float # issuer's commitment horizon revocation_propagation_latency: float # rho_i, seconds last_status_check: float # t_i, monotonic seconds; -inf if never checked def authorize_federated_execution(chain: list[ChainLink], now: float) -> None: """Policy B: status-bound execution. Refuses if any link's status confirmation is older than the slowest revocation channel in the chain.""" if not chain: raise StaleAttestationError("empty attestation chain") # The binding freshness budget is the MINIMUM propagation latency # across all links: the fastest revoker bounds our staleness tolerance. budget = min(link.revocation_propagation_latency for link in chain) for link in chain: if not link.signature_valid: raise StaleAttestationError( f"signature invalid at issuer={link.issuer}" ) if now >= link.not_after: raise StaleAttestationError( f"attestation expired at issuer={link.issuer}" ) # The non-obvious check: signature validity is not authorization # validity. The status check must be recent relative to the # revocation channel, not relative to not_after. age = now - link.last_status_check if age > budget: raise StaleAttestationError( f"status stale at issuer={link.issuer}: " f"age={age:.1f}s exceeds revocation budget={budget:.1f}s; " f"chain verifies but authority cannot be confirmed" ) def execute_delegated(action: str, chain: list[ChainLink]) -> str: now = time.monotonic() authorize_federated_execution(chain, now) # Log the status-check time as the authorization basis, never the # issuance time — the replay audit depends on this distinction. basis = max(link.last_status_check for link in chain) return f"executed {action!r} authorized by status-confirmed chain at t={basis:.1f}"