More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    stripe webhook sentinel

    1

    Audit Stripe and payment webhooks for missing idempotency, timing attack vulnerabilities, unhandled subscription failures, and race condition edge cases.

    $19.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    stripe webhook sentinel

    stripe webhook sentinel

    Example session with this skill installed

    Review this Next.js 14 Stripe webhook handler for vulnerabilities: [pasted code using express.json() and missing idempotency checks]

    • Read your context and instructions
    • Compiled the stripe webhook sentinel

    I have completed the audit of your Next.js 14 Stripe webhook handler. Your current implementation is highly vulnerable to signature verification failures and duplicate fulfillment.

    Webhook Risk Scorecard

    GateStatusFinding
    G1: Signature VerificationCRITICALreq.json() used before verification; alters body byte-order.
    G2: Idempotency & DedupCRITICALNo event ID tracking; retries will trigger duplicate fulfillment.
    G3: Fast Ack (Async)WARNINGDatabase writes are inline; high latency may trigger Stripe timeouts.
    G4: Lifecycle StatePASSBasic checkout and payment success events are covered.
    G5: Defense-in-DepthPASSOfficial SDK constructEvent handles timestamp tolerance.
    G6: Audit TrailWARNINGNo logging of processing status for failed events.

    Hardened Implementation (Next.js App Router)

    import { NextResponse } from 'next/server';
    import { headers } from 'next/headers';
    import stripe from '@/lib/stripe';
    import { prisma } from '@/lib/db';
    
    export async function POST(req: Request) {
      const body = await req.text();
      const signature = headers().get('Stripe-Signature') as string;
    
      let event;
      try {
        event = stripe.webhooks.constructEvent(body, signature, process.env.STRIPE_WEBHOOK_SECRET!);
      } catch (err) {
        return new NextResponse('Invalid Signature', { status: 400 });
      }
    
      // Gate 2: ACID Idempotency Gate
      const existingEvent = await prisma.processedWebhookEvent.upsert({
        where: { id: event.id },
        update: {},
        create: { id: event.id, status: 'PROCESSING' },
      });
    
      if (existingEvent.status === 'COMPLETED') {
        return new NextResponse(null, { status: 200 });
      }
    
      // Gate 3: Fast Ack (Logic should be moved to a background worker for production)
      try {
        switch (event.type) {
          case 'checkout.session.completed':
            // Handle fulfillment
            break;
          case 'customer.subscription.deleted':
            // Revoke access
            break;
        }
    
        await prisma.processedWebhookEvent.update({
          where: { id: event.id },
          data: { status: 'COMPLETED' },
        });
    
        return new NextResponse(null, { status: 200 });
      } catch (error) {
        return new NextResponse('Internal Server Error', { status: 500 });
      }
    }
    

    Next steps

    1. Run the database migration to create the ProcessedWebhookEvent table with a unique ID constraint.
    2. Update your .env file with the correct STRIPE_WEBHOOK_SECRET.
    3. Use stripe listen --forward-to localhost:3000/api/webhooks to test the new idempotency gate.

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

    About this skill

    Payment webhooks are the most fragile boundary in SaaS apps. Standard tutorials often skip production realities, leading to duplicate credits, silent fulfillment failures, and signature bypasses. This skill functions as an adversarial auditor for your payment infrastructure. It identifies financial risks before they hit production, ensuring your system handles Stripe retries and race conditions correctly.

    What it does

    • Cryptographic Audit: Checks if raw request bodies are correctly handled for timing-safe signature verification.
    • Idempotency Verification: Scans for atomic deduplication gates that prevent users from receiving duplicate credits or double fulfillment during Stripe retries.
    • Race Condition Detection: Highlights potential data corruption where multiple concurrent webhooks might conflict.
    • Lifecycle Coverage: Audits your handler for missing subscription states like dunning, grace periods, and cancellations.
    • Latency Protection: Detects slow business logic that triggers Stripe timeouts and provides async queue architectures.

    How it works

    1. Submit Code: Provide your current webhook endpoint file or architectural design.
    2. Review Scorecard: Receive a vulnerability report scoring your implementation across 6 security and resiliency gates.
    3. Apply Fixes: Use the provided drop-in replacement code tailored for your specific framework.
    4. Migrate Schema: Implement the suggested database migration for event deduplication tracking.

    Frameworks & tools

    Specifically designed for Node.js (Express, Next.js App Router), Python (FastAPI), and SQL-based databases like PostgreSQL or MySQL using ORMs like Prisma or SQLAlchemy.

    Why this beats prompting it yourself

    Standard LLMs often generate "happy-path" code from outdated training data that omits raw body parsing requirements or atomic database constraints. This skill uses a 6-gate verification rubric to enforce specific, production-hardened patterns that prevent real-world revenue leakage.

    Use cases

    • Auditing an existing Stripe integration for double-billing or fulfillment bugs.
    • Building a new payment gate in Next.js 14 while ensuring 100% signature reliability.
    • Hardening a subscription system against mid-cycle upgrades and failed payments.
    • Replacing brittle webhook logic with a robust, queue-based background processing system.

    Known limitations

    Focuses on backend implementation logic only. Does not solve frontend UI state management or Stripe dashboard configuration.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Focuses on backend logic. Requires access to raw request bodies. Does not handle frontend UI or Stripe dashboard configuration.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Permissions

    Network Access
    Environment Variables
    Listedtoday

    What's inside

    Frequently Asked Questions

    The skill identifies critical vulnerabilities like 'double-fulfillment' caused by duplicate Stripe retries, signature bypass exploits, and race conditions that lead to data corruption in your database.

    Yes, the skill provides framework-specific code snippets for Node.js (Express and Next.js) and Python (FastAPI), along with optimized SQL schema migrations for Prisma or SQLAlchemy.

    Simply provide your webhook handler's source code or a high-level architectural design; the agent then runs it through a 6-gate verification rubric to generate a vulnerability scorecard and fix plan.

    Unlike generic prompts, this skill uses a specialized adversarial rubric focused on production 'edge-cases' like timing-safe verification and atomic deduplication that basic LLMs often omit.

    This skill focuses on backend logic and database integrity; it does not cover frontend UI updates, Stripe Dashboard configuration, or client-side state management.

    The Sentinel is regularly updated to reflect the latest security best practices for Stripe API versions and modern framework changes, such as Next.js App Router's unique raw body handling.

    New in APIs & Backend