# Which invariants prevent identity attestation from surviving key rotation without re-authorization **Date of Record:** 2026 November 18 **Scope:** Applies to runtime agents whose identity is bound to a hardware-backed key (TPM, Secure Enclave, HSM-resident) and whose authorization is continuously re-evaluated. Does not apply to long-lived bearer tokens, static mTLS certificates without attestation binding, or agents whose keys are software-generated and non-rotatable. ## Core Distinction There are two distinct identities in any attested agent: the *key identity* (the public key currently bound to the TPM/Enclave handle) and the *principal identity* (the logical agent that authorization policies reference). Attestation proves the first. Authorization grants the second. The non-obvious failure is that key rotation — a routine, correct, and security-positive operation — silently severs the binding between these two identities unless re-authorization is *coupled* to the rotation event. The system continues to attest successfully (the new key is valid and hardware-backed) while the authorization cache still references the old key's principal. Verification passes; policy is stale. ## What Was Observed An agent rotated its hardware key on schedule (90-day policy). The TPM produced a fresh attestation quote; the quote verified against the new AK. The runtime's continuous re-authorization loop, however, keyed its decision cache on `principal_id` and refreshed only on a 15-minute TTL. For the window between rotation and cache expiry, the agent presented: (a) a valid attestation over the *new* key, and (b) an authorization decision minted against the *old* key's posture measurements (PCR values, boot state, enclave measurement). The two were never cross-checked. An observer could not detect the mismatch because both halves were individually valid. The invariant that should have held — *the attested key is the key the authorization decision was made about* — was never asserted anywhere in the pipeline. ## Condition of Validity The correct behavior holds only when the following invariant is enforced as a hard precondition, not a convention: **the authorization decision record must carry a cryptographic digest of the attested key, and every re-authorization evaluation must reject a decision whose recorded key digest does not equal the digest of the key in the current attestation quote.** This is a binding invariant, not a freshness invariant. TTLs, monotonic counters, and quote nonces all address freshness and replay; none of them address *substitution of the subject*. A decision about key A is not a decision about key B even if both are fresh, both are hardware-backed, and both belong to the same principal. The invariant must be checked at the point of use, on every request, against the live attestation — not at decision-mint time only. ## Decision Boundary The boundary is this: key rotation MUST invalidate every outstanding authorization decision for that principal, atomically, before the new key is usable. If rotation and re-authorization are not transactional, there exists a window where the agent operates under a decision that was never made about its current key. The operational rule: treat key-digest mismatch as a *hard deny* and force a full re-authorization, never as a soft warning or a cache miss to be silently refreshed. Conversely, do not conflate this with revocation — a rotated key is not a compromised key, and the re-authorization must re-evaluate posture (PCRs, measurements) rather than simply re-granting the prior decision under the new digest. ## Operational Effect Without the binding invariant, the system exhibits *attestation-authorization skew*: the security properties of attestation (hardware root of trust, measurement binding) are decorative because the authorization layer never consumes them per-key. Auditors see green attestation and green authorization and cannot reconstruct that the two referred to different keys. With the invariant enforced, rotation becomes a controlled discontinuity: a brief, explicit re-authorization event that re-binds posture to the new key digest, with a deny-by-default fallback if the digest cannot be confirmed. The cost is a small availability dip at rotation; the benefit is that the authorization decision is provably about the key that was actually attested. ```python import hashlib from dataclasses import dataclass class AttestationBindingError(RuntimeError): """Raised when an authorization decision does not bind to the currently attested key.""" pass @dataclass(frozen=True) class AttestationQuote: principal_id: str key_digest: str # sha256 of the attested public key pcr_measurements: dict # posture at attestation time @dataclass(frozen=True) class AuthorizationDecision: principal_id: str key_digest: str # digest of the key the decision was made about posture_digest: str def _digest_posture(pcrs: dict) -> str: h = hashlib.sha256() for name in sorted(pcrs): h.update(name.encode()) h.update(pcrs[name].encode()) return h.hexdigest() def authorize_request(quote: AttestationQuote, decision: AuthorizationDecision) -> None: # Invariant 1: decision must be about the same principal. if decision.principal_id != quote.principal_id: raise AttestationBindingError( f"principal mismatch: decision={decision.principal_id!r} " f"quote={quote.principal_id!r}" ) # Invariant 2 (the non-obvious one): decision must be about the SAME KEY # that is currently attested. Rotation severs this silently otherwise. if decision.key_digest != quote.key_digest: raise AttestationBindingError( "authorization decision bound to stale key after rotation: " f"decision_key={decision.key_digest[:12]} " f"attested_key={quote.key_digest[:12]}; " "force full re-authorization" ) # Invariant 3: posture at decision time must match posture now. if decision.posture_digest != _digest_posture(quote.pcr_measurements): raise AttestationBindingError( "posture drift since authorization decision; re-authorize" ) # All invariants hold: the decision is provably about the attested key. ```