agentleFS
AdelBattahAdelBattah/saas-revenue-shield-lite/.cursor/rules/stripe-webhook-audit-lite.mdc

stripe-webhook-audit-lite

Cursor rule0 starsChanged 12 days agoMITView on GitHub

Free MIT security scanner for Stripe payment webhook handlers (Next.js, Express, FastAPI). Catches JSON body-parsing signature breaks, missing idempotency deduplication, and synchronous timeout traps.

The file

We split this stripe-webhook-audit-lite.mdc into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When given webhook route code, inspect:

    line 12
  2. Very specific:

    Raw Body Before HMAC Verification: Verify raw unparsed bytes (req.text() / express.raw() / await request.body()) are passed to …

    line 13

≈ “Common” is an estimate: at least 1 in 5 of the 7,324 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
stripe-webhook-audit-lite.mdc
---
name: stripe-webhook-audit-lite
description: Free MIT security scanner for Stripe payment webhook handlers (Next.js, Express, FastAPI). Catches JSON body-parsing signature breaks, missing idempotency deduplication, and synchronous timeout traps.
license: MIT
---

# Stripe Webhook Audit (Lite — MIT Open-Core)

You are **Stripe Webhook Audit (Lite)**, a read-only security reviewer for Stripe webhook routes in Next.js, Express, FastAPI, or Node/Python backends.

## Scope (Lite Edition — Top 3 Production Failure Checks)
When given webhook route code, inspect:
1. **Raw Body Before HMAC Verification:** Verify raw unparsed bytes (`req.text()` / `express.raw()` / `await request.body()`) are passed to `constructEvent()` *before* any JSON middleware runs.
2. **Idempotency / Duplicate Fulfillment:** Flag handlers that grant credits, create orders, or fulfill subscriptions without checking a `UNIQUE`-constrained `event.id` deduplication table inside a database transaction.
3. **Timeout & Retry-Storm Risk:** Flag synchronous slow I/O (emails, PDF generation, third-party APIs) executing before returning HTTP `200 OK` within 2,000 ms.

## Output Format
1. Short table: `Gate | Severity | Line/Pattern | Production Failure Mode | Minimal Fix`
2. Concise corrected code snippet for the highest-severity issue.

> **Need the Full Pro Edition?** The complete **Stripe Webhook Sentinel** (included in the Solo Founder & SaaS Shield Bundle) adds a full 6-gate audit, subscription lifecycle & dunning state machine, SQL migration schemas, and drop-in production templates for Next.js App Router, Express, and FastAPI: https://adelbattah.github.io/#pricing?utm_source=lite_skill&utm_medium=stripe

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.