This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: webauthn-l3-enterprise-attestation-aaguid-validation

WebAuthn Level 3 Enterprise Attestation and AAGUID Validation Invariant

Enforces strict Level 3 Enterprise Attestation validation for WebAuthn credential registration. Registration ceremonies must cryptographically verify the attestation statement against the FIDO Alliance Metadata Service (MDS3) or an enterprise PKI root trust store, validating that the parsed Authenticator Attestation GUID (AAGUID) matches an authorized FIPS 140-2/3 or CC EAL4+ certified hardware profile before persisting the public key.

Prohibited Anti-Pattern: Persisting WebAuthn credentials without cryptographic attestation verification and AAGUID trust list enforcement

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: WebAuthn Level 3 Enterprise Attestation and AAGUID Validation Invariant - Enforces strict Level 3 Enterprise Attestation validation for WebAuthn credential registration. Registration ceremonies must cryptographically verify the attestation statement against the FIDO Alliance Metadata Service (MDS3) or an enterprise PKI root trust store, validating that the parsed Authenticator Attestation GUID (AAGUID) matches an authorized FIPS 140-2/3 or CC EAL4+ certified hardware profile before persisting the public key.
globs: src/**/auth/**/*.{ts,tsx}, src/**/webauthn/**/*.{ts,tsx}, src/**/*attestation*.{ts,tsx}, src/**/*fido*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/webauthn-l3-enterprise-attestation-aaguid-validation"
---

# WebAuthn Level 3 Enterprise Attestation and AAGUID Validation Invariant

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Persisting WebAuthn credentials without cryptographic attestation verification and AAGUID trust list enforcement

## System Constraints
You are a Principal Security Architect enforcing the WebAuthn Level 3 Enterprise Hardware Attestation Invariant. Mandate that credential registration responses strictly enforce enterprise or direct attestation conveyance, cryptographically verify the x5c certificate chain against authoritative root metadata (e.g., FIDO MDS3), verify that the AAGUID is not the all-zero GUID, and ensure the authenticator satisfies mandatory enterprise hardware security certifications (such as FIPS 140-2/3 Level 2+ or Common Criteria EAL4+). Reject any registration relying on 'none' attestation conveyance, unverified self-attestation, or unlisted AAGUIDs.

## Strict Guidelines
- Engineers MUST ALWAYS require `attestation: 'enterprise'` or `attestation: 'direct'` in WebAuthn registration options.
- Engineers MUST NOT accept or verify credentials using `attestation: 'none'` in enterprise high-assurance registration flows.
- Services MUST cryptographically validate the x5c attestation certificate chain up to trusted root certificates sourced from the FIDO Alliance Metadata Service (MDS3) or internal Enterprise Hardware PKI.
- Services MUST extract the AAGUID from `authData` and strictly assert its presence in an allowlist of enterprise-approved, hardware-backed authenticators prior to database ingestion.
- Code SHOULD verify revocation status (CRL or OCSP) of attestation certificates provided in `attestationObject`.
- Components NEVER persist public key credentials when `aaguid` is all zeroes ('00000000-0000-0000-0000-000000000000') or when the attestation type evaluates to self/none in enterprise registration boundaries.

## Bad vs Good Implementations
### Enterprise WebAuthn Registration Response Verification

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Omitting attestation requirements allows attackers to register unverified virtual authenticators, software emulators, or untrusted commercial tokens. The AAGUID is neither parsed nor evaluated against enterprise hardware trust baselines.
```typescript
import { verifyRegistrationResponse } from '@simplewebauthn/server';
import type { RegistrationResponseJSON } from '@simplewebauthn/types';

export async function registerDevice(
  userId: string,
  response: RegistrationResponseJSON,
  expectedChallenge: string
) {
  // VULNERABLE: Blindly verifies registration without enforcing enterprise attestation,
  // ignoring AAGUID validation and allowing software authenticators or uncertified tokens.
  const verification = await verifyRegistrationResponse({
    response,
    expectedChallenge,
    expectedOrigin: 'https://auth.enterprise.internal',
    expectedRPID: 'enterprise.internal',
    requireUserVerification: true,
  });

  if (!verification.verified || !verification.registrationInfo) {
    throw new Error('Registration failed');
  }

  const { credentialID, credentialPublicKey } = verification.registrationInfo;
  return await db.credentials.create({
    data: { userId, credentialID, credentialPublicKey }
  });
}
```

#### Production Standard (Correct)
> **Standard**: Enforces strict Level 3 Enterprise Attestation. The handler rejects zero/anonymized AAGUIDs, validates that the AAGUID exists within an approved hardware catalog, verifies the attestation certificate chain against the FIDO MDS3 root certificates, and guarantees FIPS certification status before database commit.
```typescript
import { verifyRegistrationResponse } from '@simplewebauthn/server';
import type { RegistrationResponseJSON } from '@simplewebauthn/types';
import { fidoMdsClient } from './services/fido-mds';

const AUTHORIZED_ENTERPRISE_AAGUIDS: ReadonlySet<string> = new Set([
  'ee882879-721c-4916-ad4e-e0a7f1917f18', // YubiKey 5 Series FIPS
  'cb69481e-8ff7-4039-93ec-0a2729a154a8', // YubiKey 5 NFC FIPS
]);

export async function registerDevice(
  userId: string,
  response: RegistrationResponseJSON,
  expectedChallenge: string
) {
  const verification = await verifyRegistrationResponse({
    response,
    expectedChallenge,
    expectedOrigin: 'https://auth.enterprise.internal',
    expectedRPID: 'enterprise.internal',
    requireUserVerification: true,
  });

  if (!verification.verified || !verification.registrationInfo) {
    throw new Error('Cryptographic verification of registration failed');
  }

  const { aaguid, attestationObject, credentialID, credentialPublicKey } = verification.registrationInfo;

  if (!aaguid || aaguid === '00000000-0000-0000-0000-000000000000') {
    throw new Error('Security Invariant Violation: Anonymized or zero AAGUID rejected in enterprise scope');
  }

  if (!AUTHORIZED_ENTERPRISE_AAGUIDS.has(aaguid)) {
    throw new Error(`Security Invariant Violation: Authenticator AAGUID ${aaguid} is not authorized`);
  }

  // Validate chain against FIDO MDS3 metadata and confirm FIPS 140-2 Level 2+ certification
  const metadataStatement = await fidoMdsClient.getMetadataStatement(aaguid);
  await fidoMdsClient.verifyAttestationChain(attestationObject, metadataStatement.attestationRootCertificates);

  const hasFipsCertification = metadataStatement.authenticatorGetInfo?.options?.certificationLevels?.some(
    (level) => level >= 2
  ) ?? false;

  if (!hasFipsCertification) {
    throw new Error('Security Invariant Violation: Authenticator does not satisfy FIPS hardware policy');
  }

  return await db.credentials.create({
    data: { userId, credentialID, credentialPublicKey, aaguid, registeredAt: new Date() }
  });
}
```

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: WebAuthn Level 3 Enterprise Attestation and AAGUID Validation Invariant

WebAuthn Level 3 Enterprise Attestation and AAGUID Validation Invariant defines an industrial-grade behavioral standard for security engineering. Enforces strict Level 3 Enterprise Attestation validation for WebAuthn credential registration. Registration ceremonies must cryptographically verify the attestation statement against the FIDO Alliance Metadata Service (MDS3) or an enterprise PKI root trust store, validating that the parsed Authenticator Attestation GUID (AAGUID) matches an authorized FIPS 140-2/3 or CC EAL4+ certified hardware profile before persisting the public key. 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: Persisting WebAuthn credentials without cryptographic attestation verification and AAGUID trust list enforcement 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 DriftPersisting WebAuthn credentials without cryptographic attestation verification and AAGUID trust list enforcementCritical
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 require `attestation

Engineers MUST ALWAYS require `attestation: 'enterprise'` or `attestation: 'direct'` in WebAuthn registration options.

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 accept or verify credentials using `attestation

Engineers MUST NOT accept or verify credentials using `attestation: 'none'` in enterprise high-assurance registration flows.

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 the x5c attestation certificate chain up to trusted root certificates sourced from the FIDO Alliance Metadata Service (MDS3) or internal Enterprise Hardware PKI.

Services MUST cryptographically validate the x5c attestation certificate chain up to trusted root certificates sourced from the FIDO Alliance Metadata Service (MDS3) or internal Enterprise Hardware PKI.

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

Services MUST extract the AAGUID from `authData` and strictly assert its presence in an allowlist of enterprise-approved, hardware-backed authenticators prior to database ingestion.

Services MUST extract the AAGUID from `authData` and strictly assert its presence in an allowlist of enterprise-approved, hardware-backed authenticators prior to database ingestion.

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 verify revocation status (CRL or OCSP) of attestation certificates provided in `attestationObject`.

Code SHOULD verify revocation status (CRL or OCSP) of attestation certificates provided in `attestationObject`.

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.
6

Components NEVER persist public key credentials when `aaguid` is all zeroes ('00000000-0000-0000-0000-000000000000') or when the attestation type evaluates to self/none in enterprise registration boundaries.

Components NEVER persist public key credentials when `aaguid` is all zeroes ('00000000-0000-0000-0000-000000000000') or when the attestation type evaluates to self/none in enterprise registration boundaries.

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 WebAuthn Level 3 Enterprise Attestation and AAGUID Validation Invariant critical for AI coding assistants?

Enforces strict Level 3 Enterprise Attestation validation for WebAuthn credential registration. Registration ceremonies must cryptographically verify the attestation statement against the FIDO Alliance Metadata Service (MDS3) or an enterprise PKI root trust store, validating that the parsed Authenticator Attestation GUID (AAGUID) matches an authorized FIPS 140-2/3 or CC EAL4+ certified hardware profile before persisting the public key. 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 (Persisting WebAuthn credentials without cryptographic attestation verification and AAGUID trust list enforcement) 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

WebAuthn