This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: caep-sse-ingress-revocation-standard

OpenID Shared Signals and Events (CAEP/SSE) Ingress Revocation Standard

Enforces deterministic, sub-second token invalidation propagation and distributed session teardown across decoupled microservice perimeters upon receiving OpenID Continuous Access Evaluation Profile (CAEP) and Shared Signals and Events (SSE) webhook triggers. Mandates non-blocking cryptographic verification of Security Event Tokens (SETs), transactional cache denylisting with bounded TTLs, and cluster-wide revocation broadcasts via synchronized pub/sub backplanes. Prohibits lazy polling architectures and unauthenticated webhook endpoints that allow compromised credentials to remain valid within downstream services.

Prohibited Anti-Pattern: Decoupled Edge Services Relying on Statelot JWT Expiration Without Real-Time Ingress Push-Revocation

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: OpenID Shared Signals and Events (CAEP/SSE) Ingress Revocation Standard - Enforces deterministic, sub-second token invalidation propagation and distributed session teardown across decoupled microservice perimeters upon receiving OpenID Continuous Access Evaluation Profile (CAEP) and Shared Signals and Events (SSE) webhook triggers. Mandates non-blocking cryptographic verification of Security Event Tokens (SETs), transactional cache denylisting with bounded TTLs, and cluster-wide revocation broadcasts via synchronized pub/sub backplanes. Prohibits lazy polling architectures and unauthenticated webhook endpoints that allow compromised credentials to remain valid within downstream services.
globs: src/security/**/*.{ts,js}, src/middleware/**/*.{ts,js}, src/webhooks/**/*.{ts,js}, src/auth/**/*.{ts,js}, src/services/auth/**/*.{ts,js}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/caep-sse-ingress-revocation-standard"
---

# OpenID Shared Signals and Events (CAEP/SSE) Ingress Revocation Standard

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Decoupled Edge Services Relying on Statelot JWT Expiration Without Real-Time Ingress Push-Revocation

## System Constraints
You are a Principal Security Architect and Systems Engineer specializing in Identity and Access Management (IAM), OAuth 2.0 / OIDC security extensions, and Zero Trust architectures. Enforce the OpenID Continuous Access Evaluation Profile (CAEP) and Shared Signals and Events (SSE) Ingress Revocation Standard (RFC 8935, RFC 8936, RFC 8417). Every microservice boundary consuming access tokens MUST strictly implement real-time push-based revocation handling, strict asymmetric JWS SET validation, monotonic event deduplication, and atomic sub-second denylist persistence across memory and distributed cache backplanes.

## Strict Guidelines
- Engineers MUST ALWAYS validate incoming CAEP/SSE Security Event Tokens (SET, RFC 8417) as signed JSON Web Signatures (JWS) matching the IdP issuer's published JWKS, verifying signature algorithm (prohibiting 'none'), audience ('aud'), issuer ('iss'), and issuance timestamp freshness ('iat') before processing.
- Engineers MUST extract and persist revocations transactionally against both global identifiers (e.g., 'sub', 'user_id') and granular token identifiers ('jti', 'session_id') in a shared distributed memory store (e.g., Redis cluster) with a TTL strictly matching or exceeding the remaining valid lifetime of the upstream JWT.
- Engineers MUST publish an internal high-priority pub/sub broadcast (e.g., Redis Streams, Kafka high-throughput partition) upon receipt of a valid revocation SET to trigger instantaneous local L1 cache eviction across all running service replicas.
- Engineers MUST implement idempotent deduplication using the SET's 'jti' identifier to reject duplicate signals and replay attacks, responding to the IdP with HTTP 202 Accepted within 200ms of receipt.
- Engineers MUST NOT rely exclusively on standard JWT expiration ('exp') without active token denylist interrogation in API authorization middleware when CAEP/SSE is designated as the tenant's security standard.
- Services MUST execute authorization checks against an in-memory L1 local cache synchronized with an L2 distributed denylist; cache lookups MUST fail closed (deny access) if the distributed cache connectivity is degraded or untrusted.
- Components NEVER accept raw unencrypted or unsigned payloads on the CAEP/SSE receiver webhook endpoint; endpoints MUST reject HTTP requests lacking valid mutual TLS (mTLS) or authorized webhook bearer assertions from the IdP.
- Engineers MUST support all standard CAEP event types: 'session-revoked', 'token-claims-change', 'credential-change', and 'assurance-level-change' with deterministic branch handling for each type.

## Bad vs Good Implementations
### CAEP/SSE Ingress Webhook and Revocation Propagation Handler

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The handler blindly decodes untrusted JWT payloads without cryptographic signature verification against the Identity Provider's JWKS, exposing the system to denial-of-service and state corruption via forged revocation events. It fails to check for replay attacks via SET 'jti', omits mTLS/authorization verification, and mutates process-local memory, leaving other cluster replicas and upstream services with active, exploitable sessions.
```typescript
import { Request, Response } from 'express';
import jwt from 'jsonwebtoken';

// ANTI-PATTERN: Unverified payload parsing, missing replay protection, 
// and lazy state mutations that fail to propagate invalidations cluster-wide.
export async function handleCaepWebhook(req: Request, res: Response) {
  const token = req.body.token;
  // Flaw 1: Insecure decode without signature verification or JWKS validation
  const decoded = jwt.decode(token) as any;

  if (decoded && decoded.events) {
    const eventData = decoded.events['https://schemas.openid.net/secevent/caep/event-type/session-revoked'];
    if (eventData) {
      // Flaw 2: Vulnerable to race conditions, no JTI deduplication
      const subject = eventData.subject.user.id;
      // Flaw 3: Modifying a local array; other replicas and decoupled services never receive revocation
      globalThis.revokedUsers = globalThis.revokedUsers || [];
      globalThis.revokedUsers.push(subject);
    }
  }

  return res.status(200).send('OK');
}
```

#### Production Standard (Correct)
> **Standard**: Validates the incoming SET against the upstream IdP's JWKS using strict asymmetric algorithm pinning and claims validation. Protects against replays via an atomic Redis NX operation on the token's JTI. Concurrently marks revocation in the distributed L2 Redis cluster with safe bounded TTLs and issues a non-blocking pub/sub broadcast to force sub-second L1 local cache teardowns across every decoupled service instance.
```typescript
import { Request, Response } from 'express';
import { createRemoteJWKSet, jwtVerify } from 'jose';
import Redis from 'ioredis';

const IDP_JWKS = createRemoteJWKSet(new URL(process.env.IDP_JWKS_URI!));
const IDP_ISSUER = process.env.IDP_ISSUER!;
const SERVICE_AUDIENCE = process.env.CAEP_AUDIENCE!;
const redis = new Redis(process.env.REDIS_URL!);
const pubRedis = new Redis(process.env.REDIS_URL!);

const CAEP_SESSION_REVOKED = 'https://schemas.openid.net/secevent/caep/event-type/session-revoked';
const CAEP_CREDENTIAL_CHANGE = 'https://schemas.openid.net/secevent/caep/event-type/credential-change';

interface SecurityEventTokenPayload {
  iss: string;
  aud: string | string[];
  iat: number;
  jti: string;
  events: Record<string, { subject?: { user?: { id: string }; session?: { id: string } }; event_timestamp?: number }>;
}

export async function handleCaepWebhook(req: Request, res: Response): Promise<Response> {
  try {
    const rawSet = req.body?.set || req.body;
    if (typeof rawSet !== 'string') {
      return res.status(400).json({ error: 'invalid_request', error_description: 'SET must be a compact JWS string' });
    }

    // 1. Strict cryptographic verification of the Security Event Token
    const { payload } = await jwtVerify(rawSet, IDP_JWKS, {
      issuer: IDP_ISSUER,
      audience: SERVICE_AUDIENCE,
      algorithms: ['RS256', 'ES256']
    });

    const setPayload = payload as unknown as SecurityEventTokenPayload;

    // 2. Monotonic Replay Protection via JTI deduplication with 24-hour expiration
    const isNew = await redis.set(`caep:set_jti:${setPayload.jti}`, '1', 'EX', 86400, 'NX');
    if (!isNew) {
      return res.status(202).json({ status: 'ignored_duplicate' });
    }

    // 3. Parse CAEP standard event payloads
    const events = setPayload.events || {};
    const pipeline = redis.pipeline();
    const broadcastRevocations: string[] = [];

    for (const [eventType, eventDetail] of Object.entries(events)) {
      if (eventType === CAEP_SESSION_REVOKED || eventType === CAEP_CREDENTIAL_CHANGE) {
        const userId = eventDetail.subject?.user?.id;
        const sessionId = eventDetail.subject?.session?.id;

        // Default max lifetime matches maximum allowable access token lifetime (e.g., 2 hours)
        const TTL_SECONDS = 7200;

        if (userId) {
          const key = `denylist:user:${userId}`;
          pipeline.set(key, 'revoked', 'EX', TTL_SECONDS);
          broadcastRevocations.push(key);
        }
        if (sessionId) {
          const key = `denylist:session:${sessionId}`;
          pipeline.set(key, 'revoked', 'EX', TTL_SECONDS);
          broadcastRevocations.push(key);
        }
      }
    }

    // 4. Atomic distributed execution and sub-second pub/sub invalidation
    await pipeline.exec();
    if (broadcastRevocations.length > 0) {
      await pubRedis.publish('caep:invalidation:stream', JSON.stringify(broadcastRevocations));
    }

    return res.status(202).json({ status: 'accepted' });
  } catch (error) {
    return res.status(401).json({ error: 'invalid_token', error_description: 'SET validation failed' });
  }
}
```

Recommended MCP Servers (mcp-serverlist.com)

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

Architectural Specification & Invariant Rationale

Architectural Invariant Design: OpenID Shared Signals and Events (CAEP/SSE) Ingress Revocation Standard

OpenID Shared Signals and Events (CAEP/SSE) Ingress Revocation Standard defines an industrial-grade behavioral standard for security engineering. Enforces deterministic, sub-second token invalidation propagation and distributed session teardown across decoupled microservice perimeters upon receiving OpenID Continuous Access Evaluation Profile (CAEP) and Shared Signals and Events (SSE) webhook triggers. Mandates non-blocking cryptographic verification of Security Event Tokens (SETs), transactional cache denylisting with bounded TTLs, and cluster-wide revocation broadcasts via synchronized pub/sub backplanes. Prohibits lazy polling architectures and unauthenticated webhook endpoints that allow compromised credentials to remain valid within downstream services. 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: Decoupled Edge Services Relying on Statelot JWT Expiration Without Real-Time Ingress Push-Revocation 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 DriftDecoupled Edge Services Relying on Statelot JWT Expiration Without Real-Time Ingress Push-RevocationCritical
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 validate incoming CAEP/SSE Security Event Tokens (SET, RFC 8417) as signed JSON Web Signatures (JWS) matching the IdP issuer's published JWKS, verifying signature algorithm (prohibiting 'none'), audience ('aud'), issuer ('iss'), and issuance timestamp freshness ('iat') before processing.

Engineers MUST ALWAYS validate incoming CAEP/SSE Security Event Tokens (SET, RFC 8417) as signed JSON Web Signatures (JWS) matching the IdP issuer's published JWKS, verifying signature algorithm (prohibiting 'none'), audience ('aud'), issuer ('iss'), and issuance timestamp freshness ('iat') before processing.

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 extract and persist revocations transactionally against both global identifiers (e.g., 'sub', 'user_id') and granular token identifiers ('jti', 'session_id') in a shared distributed memory store (e.g., Redis cluster) with a TTL strictly matching or exceeding the remaining valid lifetime of the upstream JWT.

Engineers MUST extract and persist revocations transactionally against both global identifiers (e.g., 'sub', 'user_id') and granular token identifiers ('jti', 'session_id') in a shared distributed memory store (e.g., Redis cluster) with a TTL strictly matching or exceeding the remaining valid lifetime of the upstream JWT.

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 publish an internal high-priority pub/sub broadcast (e.g., Redis Streams, Kafka high-throughput partition) upon receipt of a valid revocation SET to trigger instantaneous local L1 cache eviction across all running service replicas.

Engineers MUST publish an internal high-priority pub/sub broadcast (e.g., Redis Streams, Kafka high-throughput partition) upon receipt of a valid revocation SET to trigger instantaneous local L1 cache eviction across all running service replicas.

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

Engineers MUST implement idempotent deduplication using the SET's 'jti' identifier to reject duplicate signals and replay attacks, responding to the IdP with HTTP 202 Accepted within 200ms of receipt.

Engineers MUST implement idempotent deduplication using the SET's 'jti' identifier to reject duplicate signals and replay attacks, responding to the IdP with HTTP 202 Accepted within 200ms of receipt.

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

Engineers MUST NOT rely exclusively on standard JWT expiration ('exp') without active token denylist interrogation in API authorization middleware when CAEP/SSE is designated as the tenant's security standard.

Engineers MUST NOT rely exclusively on standard JWT expiration ('exp') without active token denylist interrogation in API authorization middleware when CAEP/SSE is designated as the tenant's security standard.

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

Services MUST execute authorization checks against an in-memory L1 local cache synchronized with an L2 distributed denylist

Services MUST execute authorization checks against an in-memory L1 local cache synchronized with an L2 distributed denylist; cache lookups MUST fail closed (deny access) if the distributed cache connectivity is degraded or untrusted.

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

Components NEVER accept raw unencrypted or unsigned payloads on the CAEP/SSE receiver webhook endpoint

Components NEVER accept raw unencrypted or unsigned payloads on the CAEP/SSE receiver webhook endpoint; endpoints MUST reject HTTP requests lacking valid mutual TLS (mTLS) or authorized webhook bearer assertions from the IdP.

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

Engineers MUST support all standard CAEP event types

Engineers MUST support all standard CAEP event types: 'session-revoked', 'token-claims-change', 'credential-change', and 'assurance-level-change' with deterministic branch handling for each type.

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 OpenID Shared Signals and Events (CAEP/SSE) Ingress Revocation Standard critical for AI coding assistants?

Enforces deterministic, sub-second token invalidation propagation and distributed session teardown across decoupled microservice perimeters upon receiving OpenID Continuous Access Evaluation Profile (CAEP) and Shared Signals and Events (SSE) webhook triggers. Mandates non-blocking cryptographic verification of Security Event Tokens (SETs), transactional cache denylisting with bounded TTLs, and cluster-wide revocation broadcasts via synchronized pub/sub backplanes. Prohibits lazy polling architectures and unauthenticated webhook endpoints that allow compromised credentials to remain valid within downstream services. 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 (Decoupled Edge Services Relying on Statelot JWT Expiration Without Real-Time Ingress Push-Revocation) 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

OpenID