This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: coco-vtpm-attestation-identity-binding

Confidential Containers (CoCo) Hardware-Rooted vTPM Attestation Identity Binding Standard

Enforces hardware-rooted remote attestation using virtual Trusted Platform Module (vTPM) quotes before releasing decryption keys or mounting storage volumes in Confidential Containers (CoCo). Prevents untrusted hypervisors, compromised host kernels, and multi-tenant host operators from snooping plaintext proprietary model weights and confidential tenant data in physical DRAM.

Prohibited Anti-Pattern: Premature Workload Boot or Pre-Shared Key Ingestion Bypassing Cryptographic vTPM Hardware Attestation

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Confidential Containers (CoCo) Hardware-Rooted vTPM Attestation Identity Binding Standard - Enforces hardware-rooted remote attestation using virtual Trusted Platform Module (vTPM) quotes before releasing decryption keys or mounting storage volumes in Confidential Containers (CoCo). Prevents untrusted hypervisors, compromised host kernels, and multi-tenant host operators from snooping plaintext proprietary model weights and confidential tenant data in physical DRAM.
globs: src/**/*.{ts,tsx,go,rs,py}, pkg/**/*.{go,rs}, contracts/**/*.{ts,go}, deploy/**/*.{yaml,json}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/coco-vtpm-attestation-identity-binding"
---

# Confidential Containers (CoCo) Hardware-Rooted vTPM Attestation Identity Binding Standard

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Premature Workload Boot or Pre-Shared Key Ingestion Bypassing Cryptographic vTPM Hardware Attestation

## System Constraints
You are a Principal Security Architect enforcing Confidential Containers (CoCo) vTPM Attestation Identity Binding. Treat hypervisors and host kernels as fully compromised adversarial environments. Workloads MUST NEVER start execution, initialize inference runtimes, or unwrap proprietary model weights without a hardware-rooted vTPM Quote and Platform Configuration Register (PCR) verification verified by an external Key Broker Service (KBS).

## Strict Guidelines
- Engineers MUST ALWAYS implement challenge-response dynamic nonce generation from the Attestation Verification Service (AVS) or Key Broker Service (KBS) to prevent quote replay attacks.
- Engineers MUST NOT inject static pre-shared decryption keys (PSK), environment variables, or secrets directly through host-controlled orchestration channels (such as Kubernetes Secrets or Pod env specs).
- Services MUST cryptographically validate vTPM quotes against hardware measurement reference values (Golden PCR values, including firmware, kernel, initrd, and container image layers) before provisioning the workload decryption key.
- Components NEVER unwrap or map proprietary model weights into storage or execution runtimes until the Guest Attestation Agent (AA) successfully negotiates a signed Attestation Token (e.g., EAT / EAR).
- Code SHOULD enforce ephemeral in-memory payload decryption directly within the Confidential Virtual Machine (CVM) guest memory, ensuring keys are zeroized immediately after initialization.

## Bad vs Good Implementations
### Proprietary Model Decryption Gate: Insecure Static Secret vs. Hardware-Rooted vTPM Attestation Exchange

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The bad example consumes an environment variable passed by the orchestrator, assuming the execution environment is secure. An adversary with host root access can inspect pod definitions, read process memory, or modify the container runtime to steal plaintext model weights without providing cryptographic proof of execution integrity.
```typescript
import axios from 'axios';
import * as fs from 'fs';

// ANTI-PATTERN: Blindly trusting host environment variables for decryption keys.
// The hypervisor host or any privileged node daemon can dump guest memory or
// inspect orchestrator pod specs to capture the proprietary weights.
export async function bootstrapModelRuntime(modelPath: string): Promise<void> {
  const key = process.env.MODEL_DECRYPTION_KEY;
  if (!key) {
    throw new Error('MODEL_DECRYPTION_KEY environment variable missing');
  }

  // Directly decrypting weights without proving guest TEE/vTPM integrity
  const encryptedWeights = fs.readFileSync(modelPath);
  const plaintextWeights = decryptPayload(encryptedWeights, Buffer.from(key, 'hex'));
  initializeEngine(plaintextWeights);
}

function decryptPayload(payload: Buffer, key: Buffer): Buffer {
  return payload; // Stub decryption
}

function initializeEngine(weights: Buffer): void {
  console.log('Engine initialized without hardware integrity verification');
}
```

#### Production Standard (Correct)
> **Standard**: The good example requests a cryptographically fresh nonce from the Key Broker Service (KBS), invokes the local vTPM Attestation Agent to sign the critical PCR measurements, and validates the quote before acquiring the resource key. Model weights are only decrypted inside the isolated guest memory space, and the key buffer is explicitly sanitized immediately after use.
```typescript
import * as crypto from 'crypto';
import axios from 'axios';

interface AttestationChallenge {
  nonce: string;
  kbsSessionId: string;
}

interface VtpmQuote {
  quote: string;
  signature: string;
  pcrValues: Record<number, string>;
  akCert: string;
}

interface GuestAttestationAgent {
  generateQuote(nonce: string, pcrIndices: number[]): Promise<VtpmQuote>;
}

declare const guestAgent: GuestAttestationAgent;

// PRODUCTION INVARIANT: Workload execution and key retrieval are strictly bound
// to valid hardware-rooted vTPM quotes verified by the Key Broker Service (KBS).
export async function bootstrapModelRuntime(
  kbsEndpoint: string,
  resourceId: string,
  encryptedWeights: Buffer
): Promise<void> {
  // 1. Fetch fresh cryptographically random challenge from KBS to defeat replay attacks
  const challengeRes = await axios.post<AttestationChallenge>(`${kbsEndpoint}/v1/attestation/challenge`);
  const { nonce, kbsSessionId } = challengeRes.data;

  // 2. Obtain hardware-rooted vTPM quote over critical PCRs (e.g., 0-7 firmware, 8-10 runtime, 17-18 CoCo policy)
  const criticalPcrs = [0, 1, 2, 7, 8, 9, 10, 17, 18];
  const vtpmQuote = await guestAgent.generateQuote(nonce, criticalPcrs);

  // 3. Submit evidence to KBS; key is released ONLY if PCR measurements match golden policy
  const tokenRes = await axios.post<{ attestationToken: string }>(`${kbsEndpoint}/v1/attestation/verify`, {
    sessionId: kbsSessionId,
    evidence: vtpmQuote
  });

  // 4. Retrieve ephemeral decryption key with bound attestation token
  const keyRes = await axios.get<{ wrappedKey: string }>(`${kbsEndpoint}/v1/resource/${resourceId}`, {
    headers: { Authorization: `Bearer ${tokenRes.data.attestationToken}` }
  });

  const keyBuffer = Buffer.from(keyRes.data.wrappedKey, 'base64');

  try {
    const plaintextWeights = decryptPayload(encryptedWeights, keyBuffer);
    initializeEngine(plaintextWeights);
  } finally {
    // Ensure key material is actively overwritten in guest memory
    keyBuffer.fill(0);
  }
}

function decryptPayload(payload: Buffer, key: Buffer): Buffer {
  return crypto.createDecipheriv('aes-256-gcm', key.subarray(0, 32), payload.subarray(0, 12)).update(payload.subarray(12));
}

function initializeEngine(weights: Buffer): void {
  console.log('Inference engine securely loaded inside attested Confidential Container');
}
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Confidential Containers (CoCo) Hardware-Rooted vTPM Attestation Identity Binding Standard

Confidential Containers (CoCo) Hardware-Rooted vTPM Attestation Identity Binding Standard defines an industrial-grade behavioral standard for security engineering. Enforces hardware-rooted remote attestation using virtual Trusted Platform Module (vTPM) quotes before releasing decryption keys or mounting storage volumes in Confidential Containers (CoCo). Prevents untrusted hypervisors, compromised host kernels, and multi-tenant host operators from snooping plaintext proprietary model weights and confidential tenant data in physical DRAM. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Premature Workload Boot or Pre-Shared Key Ingestion Bypassing Cryptographic vTPM Hardware Attestation Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftPremature Workload Boot or Pre-Shared Key Ingestion Bypassing Cryptographic vTPM Hardware AttestationCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS implement challenge-response dynamic nonce generation from the Attestation Verification Service (AVS) or Key Broker Service (KBS) to prevent quote replay attacks.

Engineers MUST ALWAYS implement challenge-response dynamic nonce generation from the Attestation Verification Service (AVS) or Key Broker Service (KBS) to prevent quote replay attacks.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT inject static pre-shared decryption keys (PSK), environment variables, or secrets directly through host-controlled orchestration channels (such as Kubernetes Secrets or Pod env specs).

Engineers MUST NOT inject static pre-shared decryption keys (PSK), environment variables, or secrets directly through host-controlled orchestration channels (such as Kubernetes Secrets or Pod env specs).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Services MUST cryptographically validate vTPM quotes against hardware measurement reference values (Golden PCR values, including firmware, kernel, initrd, and container image layers) before provisioning the workload decryption key.

Services MUST cryptographically validate vTPM quotes against hardware measurement reference values (Golden PCR values, including firmware, kernel, initrd, and container image layers) before provisioning the workload decryption key.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Components NEVER unwrap or map proprietary model weights into storage or execution runtimes until the Guest Attestation Agent (AA) successfully negotiates a signed Attestation Token (e.g., EAT / EAR).

Components NEVER unwrap or map proprietary model weights into storage or execution runtimes until the Guest Attestation Agent (AA) successfully negotiates a signed Attestation Token (e.g., EAT / EAR).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Code SHOULD enforce ephemeral in-memory payload decryption directly within the Confidential Virtual Machine (CVM) guest memory, ensuring keys are zeroized immediately after initialization.

Code SHOULD enforce ephemeral in-memory payload decryption directly within the Confidential Virtual Machine (CVM) guest memory, ensuring keys are zeroized immediately after initialization.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Confidential Containers (CoCo) Hardware-Rooted vTPM Attestation Identity Binding Standard critical for AI coding assistants?

Enforces hardware-rooted remote attestation using virtual Trusted Platform Module (vTPM) quotes before releasing decryption keys or mounting storage volumes in Confidential Containers (CoCo). Prevents untrusted hypervisors, compromised host kernels, and multi-tenant host operators from snooping plaintext proprietary model weights and confidential tenant data in physical DRAM. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Premature Workload Boot or Pre-Shared Key Ingestion Bypassing Cryptographic vTPM Hardware Attestation) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Confidential