This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: envoy-gateway-http3-early-data-anti-replay

Envoy Gateway HTTP/3 0-RTT Anti-Replay Defense for Mutation Endpoints

QUIC 0-RTT connection resumption permits clients to send early application data before the cryptographic handshake concludes, rendering requests vulnerable to network replay across distributed ingress zones. Envoy Gateway configurations and upstream services MUST enforce strict rejection or conditional deferral of non-idempotent HTTP methods (POST, PUT, PATCH, DELETE) arriving via 0-RTT Early-Data headers. Infrastructure and application layers must collaborate using RFC 8470 protocol semantics to guarantee that state-mutating transactions are never executed speculatively without forward secrecy.

Prohibited Anti-Pattern: Executing Non-Idempotent HTTP Mutations over Unvalidated QUIC 0-RTT Early Data

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Envoy Gateway HTTP/3 0-RTT Anti-Replay Defense for Mutation Endpoints - QUIC 0-RTT connection resumption permits clients to send early application data before the cryptographic handshake concludes, rendering requests vulnerable to network replay across distributed ingress zones. Envoy Gateway configurations and upstream services MUST enforce strict rejection or conditional deferral of non-idempotent HTTP methods (POST, PUT, PATCH, DELETE) arriving via 0-RTT Early-Data headers. Infrastructure and application layers must collaborate using RFC 8470 protocol semantics to guarantee that state-mutating transactions are never executed speculatively without forward secrecy.
globs: infra/**/*.yaml, k8s/**/*.yaml, src/middleware/**/*.{ts,js,go}, src/ingress/**/*.{ts,js,go}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/envoy-gateway-http3-early-data-anti-replay"
---

# Envoy Gateway HTTP/3 0-RTT Anti-Replay Defense for Mutation Endpoints

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Executing Non-Idempotent HTTP Mutations over Unvalidated QUIC 0-RTT Early Data

## System Constraints
You are a Principal Infrastructure & Security Architect enforcing Envoy Gateway HTTP/3 0-RTT anti-replay safety invariants. Non-idempotent HTTP methods (POST, PUT, PATCH, DELETE) conveyed over QUIC 0-RTT early data packets expose distributed systems to replay attacks across multi-region clusters. You must mandate that Envoy Gateway EnvoyFilters/HTTPRoute configurations drop, reject, or force 425 (Too Early) retries on non-safe requests received prior to handshake completion, and ensure upstream microservices explicitly inspect the 'Early-Data' header.

## Strict Guidelines
- Envoy Gateway MUST be configured to enforce `early_data_policy` or upstream EnvoyFilter transforms rejecting unsafe HTTP methods when early data is detected.
- Upstream HTTP services MUST inspect the RFC 8470 `Early-Data` request header (`Early-Data: 1`) on all state-mutating requests and return HTTP status `425 Too Early` if processing non-idempotent logic.
- Engineers MUST NOT permit client-side SDKs to pipeline mutating mutations (e.g., checkout, funds transfer, entity creation) in initial QUIC 0-RTT payloads.
- Clients receiving an HTTP `425 Too Early` response MUST resend the identical HTTP request over the established connection only after the 1-RTT handshake has completed.
- Distributed ingress topologies MUST enforce TLS Session Ticket encryption key rotation across all edge clusters within a tight window to prevent prolonged replay attack surfaces.

## Bad vs Good Implementations
### RFC 8470 Early-Data Guard Middleware in Ingress API Service

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The middleware executes state-mutating operations without validating whether the request arrived via 0-RTT early data (RFC 8470). Adversaries can capture and replay the early QUIC packet across distributed ingress instances, triggering duplicate mutations without cryptographic freshness.
```typescript
import { Request, Response, NextFunction } from 'express';

export function processTransactionMiddleware(req: Request, res: Response, next: NextFunction): void {
  // Anti-Pattern: Blindly executing mutations without checking for QUIC 0-RTT early data
  // An eavesdropper can replay this packet across multiple edge regions,
  // causing duplicate financial transfers or state corruptions.
  if (req.method === 'POST') {
    executeTransfer(req.body)
      .then(() => res.status(200).json({ status: 'success' }))
      .catch((err) => next(err));
    return;
  }
  next();
}

async function executeTransfer(_payload: unknown): Promise<void> {
  /* processing logic */
}
```

#### Production Standard (Correct)
> **Standard**: Adheres to RFC 8470: detects the `Early-Data` header populated by Envoy Gateway and immediately halts non-safe HTTP methods by returning HTTP 425 (Too Early). The client can safely retransmit the payload once forward secrecy is guaranteed by the finalized TLS/QUIC handshake.
```typescript
import { Request, Response, NextFunction } from 'express';

const SAFE_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']);

export function earlyDataAntiReplayGuard(req: Request, res: Response, next: NextFunction): void {
  const isEarlyData = req.headers['early-data'] === '1';

  // Production Invariant: Reject non-idempotent methods delivered in 0-RTT early data
  if (isEarlyData && !SAFE_METHODS.has(req.method)) {
    // Respond with 425 Too Early to demand 1-RTT handshake completion
    res.setHeader('Retry-After', '0');
    res.status(425).json({
      error: 'Too Early',
      message: 'State mutations cannot be processed in QUIC 0-RTT data. Re-send post-handshake.'
    });
    return;
  }

  next();
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

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

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Envoy Gateway HTTP/3 0-RTT Anti-Replay Defense for Mutation Endpoints

Envoy Gateway HTTP/3 0-RTT Anti-Replay Defense for Mutation Endpoints defines an industrial-grade behavioral standard for devops engineering. QUIC 0-RTT connection resumption permits clients to send early application data before the cryptographic handshake concludes, rendering requests vulnerable to network replay across distributed ingress zones. Envoy Gateway configurations and upstream services MUST enforce strict rejection or conditional deferral of non-idempotent HTTP methods (POST, PUT, PATCH, DELETE) arriving via 0-RTT Early-Data headers. Infrastructure and application layers must collaborate using RFC 8470 protocol semantics to guarantee that state-mutating transactions are never executed speculatively without forward secrecy. 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: Executing Non-Idempotent HTTP Mutations over Unvalidated QUIC 0-RTT Early Data 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 DriftExecuting Non-Idempotent HTTP Mutations over Unvalidated QUIC 0-RTT Early DataCritical
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

Envoy Gateway MUST be configured to enforce `early_data_policy` or upstream EnvoyFilter transforms rejecting unsafe HTTP methods when early data is detected.

Envoy Gateway MUST be configured to enforce `early_data_policy` or upstream EnvoyFilter transforms rejecting unsafe HTTP methods when early data is detected.

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

Upstream HTTP services MUST inspect the RFC 8470 `Early-Data` request header (`Early-Data

Upstream HTTP services MUST inspect the RFC 8470 `Early-Data` request header (`Early-Data: 1`) on all state-mutating requests and return HTTP status `425 Too Early` if processing non-idempotent logic.

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

Engineers MUST NOT permit client-side SDKs to pipeline mutating mutations (e.g., checkout, funds transfer, entity creation) in initial QUIC 0-RTT payloads.

Engineers MUST NOT permit client-side SDKs to pipeline mutating mutations (e.g., checkout, funds transfer, entity creation) in initial QUIC 0-RTT payloads.

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

Clients receiving an HTTP `425 Too Early` response MUST resend the identical HTTP request over the established connection only after the 1-RTT handshake has completed.

Clients receiving an HTTP `425 Too Early` response MUST resend the identical HTTP request over the established connection only after the 1-RTT handshake has completed.

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

Distributed ingress topologies MUST enforce TLS Session Ticket encryption key rotation across all edge clusters within a tight window to prevent prolonged replay attack surfaces.

Distributed ingress topologies MUST enforce TLS Session Ticket encryption key rotation across all edge clusters within a tight window to prevent prolonged replay attack surfaces.

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 Envoy Gateway HTTP/3 0-RTT Anti-Replay Defense for Mutation Endpoints critical for AI coding assistants?

QUIC 0-RTT connection resumption permits clients to send early application data before the cryptographic handshake concludes, rendering requests vulnerable to network replay across distributed ingress zones. Envoy Gateway configurations and upstream services MUST enforce strict rejection or conditional deferral of non-idempotent HTTP methods (POST, PUT, PATCH, DELETE) arriving via 0-RTT Early-Data headers. Infrastructure and application layers must collaborate using RFC 8470 protocol semantics to guarantee that state-mutating transactions are never executed speculatively without forward secrecy. 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 (Executing Non-Idempotent HTTP Mutations over Unvalidated QUIC 0-RTT Early Data) 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

Envoy