stripe-security

stripe-security is a cursor rule for Cursor from coldtatooine/vuln-skill-pack. It costs 0 tokens per session (552 once invoked), scanned A, original, MIT.

A set of rules for avoiding common security mistakes when building or reviewing Stripe payment and billing code.

In plain words
What is it for?
Checking Stripe webhooks, payment amounts, product entitlements, idempotency, secret handling, and fulfillment logic.
Why use it?
It helps prevent forged payment notifications, incorrect charges, exposed secrets, duplicate processing, and access being granted for the wrong event.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/coldtatooine/vuln-skill-pack/stripe-security
Clone the repo
git clone --depth 1 https://github.com/coldtatooine/vuln-skill-pack

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for stripe-security

README.md
[![agentmods](https://agentmods.dev/badge/rules/coldtatooine/vuln-skill-pack/stripe-security.svg)](https://agentmods.dev/rules/coldtatooine/vuln-skill-pack/stripe-security)
Your own site
<a href="https://agentmods.dev/rules/coldtatooine/vuln-skill-pack/stripe-security"><img src="https://agentmods.dev/badge/rules/coldtatooine/vuln-skill-pack/stripe-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 552 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00552
Opus 5 $0.00000 $0.00276
Sonnet 5 $0.00000 $0.00110
Haiku 4.5 $0.00000 $0.00055

Measured 5d ago against content hash ad78f54fb21b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

stripe-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor/rules/stripe-security.mdc · 34 lines

How it starts

The opening of the file, as written. The whole thing — 34 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Stripe Security Footguns

Payment code moves money, so bugs are directly monetizable.

1. Webhook signature verification (Critical)

  • Every webhook endpoint must verify the Stripe signature with the endpoint signing secret (stripe.webhooks.constructEvent(rawBody, sig, secret)). Without it, anyone can POST a fake checkout.session.completed and get free fulfillment.
  • Use the raw request body, not parsed JSON — the signature is computed over raw bytes. Frameworks that auto-parse (Express json(), Next.js default parsing) break verification; disable body parsing on the webhook route.
  • Reject on verification failure; don't fall through to processing.

2. Never trust amounts or entitlements from the client

  • Price/amount comes from the server, looked up by product ID — never sent from the browser. A client posting amount: 1 pays 1 cent for a $100 item.
  • Same for quantity, currency, discount, entitlement. With Checkout, prefer server-created line_items referencing Stripe Price IDs over client-supplied price_data.

3. Fulfill on the right event

  • Grant access / ship on the verified webhook (checkout.session.completed, payment_intent.succeeded, invoice.paid) — not on the browser redirect to the success URL (reachable without paying). Check payment_status === 'paid' before fulfilling.

4. Secret key exposure

  • sk_live_* / sk_test_* / rk_* and whsec_* are server-only. Only pk_* publishable keys belong in the browser. Leaked secret key → rotate immediately (Critical).

5. Idempotency & abuse

  • Webhooks can be delivered more than once — make fulfillment idempotent (track processed event.id) so retries don't double-grant or double-ship.
  • Rate-limit payment-creation endpoints to prevent card-testing abuse.

6. Other

  • Don't log full Stripe objects (PII / partial card data) — redact.
  • Verify the authenticated user owns the session/subscription they act on (IDOR into another's billing).
  • Handle disputed/refunded/subscription.deleted events to revoke access.

Read the full file on GitHub · 34 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 34 lines · 0 tokens per session scan A ad78f54fb21b

Subscribe to this mod's changes

stripe-security is a cursor rule published in the GitHub repository coldtatooine/vuln-skill-pack (2 stars, last pushed 11d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 552 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.