Mutual TLS Peer-Authentication Contract Design

    1

    Designs mutual TLS peer authentication: TLS 1.3 cipher constraints, SPIFFE SAN validation, and revocation checking.

    $5

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Mutual TLS Peer-Authentication Contract Design

    Example session with this skill installed

    Design Mutual TLS (mTLS) peer-authentication security contract and client cert validation for our Core Payment Settlement Service.

    • Subject: payment-settlement-service v3.0 (run-id: payment-mtls-001) terminating inter-service calls across 40 microservices on AWS EKS.
    • Deciders: Lead Application Security Architect (David O'Reilly) and Principal Network Security Lead (Marcus Vance).
    • Traffic & Scale: Peak 5,200 mTLS handshakes/sec; p99 connection establishment latency <= 4.0 ms; strict PCI-DSS zero-trust network mandates.
    • Tension: Squads proposed permissive mTLS allowing TLS 1.2 RSA ciphers with optional client verification; David O'Reilly strictly forbids permissive mTLS and legacy ciphers, citing incident SEC-4930 where an unverified client cert established a cleartext session and executed fraudulent settlements. He mandates strict TLS 1.3 only (TLS_AES_256_GCM_SHA384 and TLS_CHACHA20_POLY1305_SHA256), mandatory SPIFFE URI SAN validation, client cert expiration capped at 24 hours with SPIRE rotation, and secure XFCC header sanitization.

    Write the mTLS contract specification under docs/.

    • Read your context and instructions
    • Compiled the mutual tls peer-authentication
    • Generated the UI component

    Wrote docs/architecture/tasks/payment-mtls-001/mtls-design/mtls-contract-spec.md. Complete Mutual TLS peer-authentication specification establishing TLS 1.3 cipher restrictions, SPIFFE SAN validation, 24-hour certificate lifecycles, and secure XFCC header ingestion.

    ---
    skill: mtls-design
    ---
    
    # Mutual TLS Peer-Authentication Spec: Core Payment Settlement [MTLS-PAY-001]
    
    ## Summary
    
    This specification establishes the Mutual TLS (mTLS) peer-authentication contract, cryptographic cipher suite constraints, client certificate validation sequence, and identity forwarding rules for `payment-settlement-service v3.0` under run ID `payment-mtls-001`. It secures inter-service communications across 40 microservices sustaining 5,200 handshakes/second on AWS EKS. It decisively eliminates the unauthorized access and cipher downgrade vulnerabilities demonstrated in incident SEC-4930 (where permissive mTLS and legacy TLS 1.2 RSA ciphers allowed an unauthenticated rogue pod to execute fraudulent settlement calls). The contract enforces strict **TLS 1.3 exclusive** transport, restricts cipher suites to modern AEAD ciphers (`TLS_AES_256_GCM_SHA384`, `TLS_CHACHA20_POLY1305_SHA256`), mandates SPIFFE URI Subject Alternative Name (SAN) identity matching, caps client certificate lifespan at **24 hours** via SPIRE automated rotation, and enforces strict `X-Forwarded-Client-Cert` (XFCC) sanitization.
    
    ## Detailed Description
    
    Operating microservice architectures with permissive mTLS or optional client verification creates a false sense of security. When servers accept connections without validating peer certificates, attackers who breach a perimeter pod can initiate unauthenticated East-West lateral connections across the cluster. Enforcing strict TLS 1.3 with mandatory client certificate verification guarantees non-repudiation and cryptographic workload identity.
    
    

    Caller Pod: payment-authorization
    │
    ▼ (Client Hello: TLS 1.3, Curve25519 Key Share)
    [ Envoy Ingress Sidecar: payment-settlement ]
    ├── 1. Requests Client Certificate: CertificateRequest
    ├── 2. Receives Peer Cert: Leaf signed by Bank-Intermediate-CA
    ├── 3. Enforces Cipher Match: TLS_AES_256_GCM_SHA384
    └── 4. SAN Validation Gate:
    ├── Extracts URI SAN: spiffe://bank.internal/ns/pay/sa/pay-auth
    └── Whitelist Match: Authorized Caller Verified
    │
    ┌──────────┴──────────┐
    ▼ (Valid Peer Cert) ▼ (Missing / Unapproved SAN / Expired)
    Pass to Port 8080 TCP Reset / HTTP 403: ERR_MTLS_PEER_UNAUTHORIZED
    Sanitize & Inject XFCC

    
    ### Criteria and weights
    
    | Criterion | Why it matters here | Weight | Source of the weight |
    |---|---|---|---|
    | Zero-Trust Bidirectional Peer Authentication | Unauthenticated microservices must be blocked from establishing network sockets to settlement engines (SEC-4930). | 0.40 | David O'Reilly (CISO SecOps) |
    | Handshake Latency Overhead (p99 <= 4.0 ms) | Connection establishment must not degrade 5,200 req/sec high-throughput settlement execution. | 0.25 | Marcus Vance (Principal Architect) |
    | Ephemeral Certificate Lifespan (24h TTL) | Short-lived certificates eliminate the need for complex, latency-inducing real-time CRL distribution. | 0.20 | Corporate Cryptographic Policy |
    | Secure Ingress Header Sanitization (XFCC) | Upstream proxies must sanitize client certificate headers to prevent header spoofing attacks. | 0.15 | Application Security Standard |
    
    
    ### Comparison
    
    | mTLS Architecture Candidate | Protocol Floor | Client Cert Enforcement | Peer Identity Standard | Evaluation |
    |---|---|---|---|---|
    | Option A: Permissive TLS 1.2 (Legacy) | TLS 1.2 (RSA ciphers) | Optional (Permissive mode) | Common Name (CN) string | Rejected: Caused SEC-4930 unauthorized settlement breach. |
    | Option B: Strict TLS 1.2 with DNS SANs | TLS 1.2 (ECDHE only) | Mandatory | DNS SAN (`*.bank.internal`) | Rejected: DNS SANs lack workload role granularity and namespace isolation. |
    | Option C: Strict TLS 1.3 + SPIFFE SANs (Chosen) | TLS 1.3 Exclusive | Mandatory (Strict mode) | SPIFFE URI SAN | Selected: Modern AEAD ciphers, sub-4ms handshakes, strict identity. |
    
    
    ### Result
    
    Option C is selected. Exclusive TLS 1.3 eliminates handshake roundtrips and obsolete ciphers; SPIFFE URI SANs provide granular workload identity.
    
    ---
    
    ### Required Mechanisms
    
    #### 1. TLS Protocol & Cipher Suite Constraints [MC-TC-01]
    - **Protocol Version**: TLS 1.3 strictly enforced (`min_version: TLS_1_3`, `max_version: TLS_1_3`). Connections offering TLS 1.2 or lower are terminated during ClientHello.
    - **Approved Cipher Suites**:
      1. `TLS_AES_256_GCM_SHA384` (Primary)
      2. `TLS_CHACHA20_POLY1305_SHA256` (Secondary)
    - **Key Exchange**: ECDHE with Curve25519 (`x25519`) or NIST P-256 (`secp256r1`).
    - **Session Resumption**: 0-RTT early data resumption is **disabled** (`early_data: false`) to prevent replay attacks on mutating settlement operations.
    
    #### 2. Client Certificate SAN Validation Pipeline [MC-VP-01]
    - The verifying server extracts and evaluates Subject Alternative Names:
      - **Type**: Must contain `URI` type SAN matching format:
        `spiffe://bank.internal/ns/{namespace}/sa/{serviceaccount}`
      - **Whitelisted Callers for `payment-settlement-service`**:
        - `spiffe://bank.internal/ns/payments-prod/sa/payment-auth-sa`
        - `spiffe://bank.internal/ns/clearing-prod/sa/clearing-engine-sa`
    - If the client presents a valid X.509 certificate whose SPIFFE ID is not in the approved caller allowlist, the connection is aborted immediately with `HTTP 403 Forbidden` and diagnostic `ERR_PEER_SAN_DISALLOWED`.
    
    #### 3. Ephemeral Certificate Lifecycles & SPIRE Rotation [MC-LC-01]
    - Workload certificates are issued by SPIRE (SPIFFE Runtime Environment) agents running on each EKS worker node.
    - **Validity Duration**: Exactly **24 hours** (86,400 seconds).
    - **Automated Rotation**: SPIRE automatically rotates certificates at **12 hours remaining** (50% lifespan), streaming new keys to Envoy via Secret Discovery Service (SDS) with zero TCP connection drops.
    
    #### 4. Proxy Header Ingestion & XFCC Sanitization [MC-XC-01]
    - Ingress proxies terminating TLS at edge must sanitize `X-Forwarded-Client-Cert` (XFCC) headers:
      - All client-supplied incoming XFCC headers are stripped unconditionally.
      - The proxy constructs a verified, signed XFCC header containing:
        `Hash={SHA256};Subject="";URI="spiffe://bank.internal/ns/payments-prod/sa/payment-auth-sa"`
      - Downstream applications trust XFCC headers if and only if received from the local trusted loopback proxy.
    
    ---
    
    ### Invariants and Contracts
    
        Exclusive TLS 1.3 Protocol Invariant [INV-MTLS-01]
          Production settlement interfaces must mandate TLS 1.3 exclusively.
          Negotiating TLS 1.2, TLS 1.1, or non-AEAD cipher suites is strictly blocked by proxy configuration.
    
        Mandatory SPIFFE URI SAN Validation [INV-MTLS-02]
          Peer identity must be asserted via SPIFFE URI Subject Alternative Names.
          Verifying peer identity based solely on certificate Subject Common Name (CN) is prohibited.
    
        Zero-RTT Early Data Prohibition [INV-MTLS-03]
          TLS 1.3 0-RTT early data is forbidden on financial settlement interfaces.
          All handshakes must complete the full 1-RTT cryptographic exchange to eliminate replay vectors.
    
    ## Explicit Unknowns
    
    - SPIRE Agent CPU utilization overhead during cluster-wide node restarts triggering 18,000 simultaneous certificate issuances (G-1).
    - Envoy SDS memory leak risks during continuous 12-hour certificate rotation loops over 30 days (G-2).
    
    ## Traceability
    
    | Claim | Classification | Source | Freshness |
    |---|---|---|---|
    | 40 internal microservices on AWS EKS | provided | Infrastructure intake | Current |
    | Peak 5,200 mTLS handshakes/sec | provided | Traffic intake | Current |
    | Incident SEC-4930 unauthorized settlement breach | provided | Post-mortem evidence | Historical |
    | Handshake latency budget p99 <= 4.0 ms | provided | Performance SLA | Current |
    | TLS 1.3 exclusive enforcement | decided | David O'Reilly (CISO SecOps) | 2026-09-15 |
    | SPIFFE URI SAN identity standard | decided | Marcus Vance (Principal Architect) | 2026-09-15 |
    
    
    ## Verification
    
    No validator was supplied, so no command was run.
    
    Reviewer self-check against mTLS architecture standards:
    - **Protocol Safety**: PASS. TLS 1.3 exclusive; modern AEAD ciphers; 0-RTT disabled.
    - **Identity Rigor**: PASS. SPIFFE URI SAN validation eliminates ambiguous Common Name assumptions.
    - **Credential Hygiene**: PASS. 24-hour short-lived certificates eliminate complex CRL distribution.
    - **Markdown Hygiene**: PASS. Native Markdown syntax strictly adheres to `rule_markdown.md`.
    
    ## Open Decisions
    
    - `DEC-MTLS-01`: David O'Reilly to determine whether post-quantum Kyber key exchange should be enabled in TLS 1.3 client hellos as an experimental cipher suite (Owner: David O'Reilly).
    
    ## Next steps
    
    1. Marcus Vance configures Envoy proxy filter enforcing `TLS_1_3` and SPIFFE SAN allowlists.
    2. Security team deploys SPIRE Server and Node Agents across production EKS clusters.
    3. Conduct staging penetration drill attempting to connect using TLS 1.2 and self-signed certificates to verify immediate TCP reset.
    

    mutual-tls-peer-authentication-contract-.tsx

    TSX · React component

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Map workload identities to SPIFFE SAN validation rules.Design mTLS trust chains and certificate rotation paths.Define fail-closed behavior for certificate revocation.Specify peer authentication semantics for service meshes.

    About this skill

    What it does

    This skill maps accepted workload/peer identity, PKI and transport-path decisions to exact mutual TLS authentication semantics. It defines who presents and validates which certificate on each hop, how identities are extracted, and how rotation/failure affects connectivity.

    Use it when

    Use when selected mTLS paths need precise client/server certificate, peer identity, validation, proxy and lifecycle contracts.

    For example: “Everything inside the mesh is mTLS, which security signed off on. Then the reporting service called the payments API directly and nothing stopped it, because it had a valid certificate.”

    What you get

    • mTLS Security Spec

    Written as Markdown to <your output folder>/architecture/tasks/<run-id>/mtls-design/.

    What it will not do

    Do not use for deciding whether to use mTLS, enterprise PKI or zero-trust architecture, service-mesh/gateway selection, authorization policy, certificate issuance, one TLS configuration, cipher hardening, implementation or handshake debugging.

    How it works

    1. Check both ends need to prove identity.
    2. Define what the certificate identity means and how it maps to authorisation.
    3. Fix the trust chain and what is accepted from it.
    4. Design issuance and rotation before enforcement.
    5. State the behaviour on expiry, revocation and clock skew.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-task.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 12 days ago

    • Passed all security checks, Safe to install

    Listed12 days ago

    What's inside

    Frequently Asked Questions