stripe-webhook-hardening

stripe-webhook-hardening is a skill for Claude Code, Codex from Kevin-Liu-01/Agent-Machines. It costs 82 tokens per session (655 once invoked), scanned A, original, MIT.

A security checklist for Stripe webhook handlers, which are server routes that receive event notifications from Stripe.

In plain words
What is it for?
Use it to verify raw request signatures, update product state for negative payment events, and make webhook processing safe to repeat.
Why use it?
It prevents accepting forged events, mishandling failed or cancelled payments, and repeating side effects when Stripe retries delivery.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to verify raw request signatures, update product state for negative payment events, and make webhook processing safe to repeat.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevin-liu-01/agent-machines/stripe-webhook-hardening
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.

Any agent
npx skills add Kevin-Liu-01/Agent-Machines --skill stripe-webhook-hardening
Clone the repo
git clone --depth 1 https://github.com/Kevin-Liu-01/Agent-Machines

Made for: Claude Code, Codex.

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-webhook-hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/stripe-webhook-hardening/github.svg)](https://agentmods.dev/skills/kevin-liu-01/agent-machines/stripe-webhook-hardening)
Your own site
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/stripe-webhook-hardening"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/stripe-webhook-hardening/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for stripe-webhook-hardening

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/stripe-webhook-hardening"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/stripe-webhook-hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 655 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00082 $0.00655
Opus 5 $0.00041 $0.00328
Sonnet 5 $0.00016 $0.00131
Haiku 4.5 $0.00008 $0.00065

Measured 9d ago against content hash 4831edaf1537, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

stripe-webhook-hardening 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 9d 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.

knowledge/skills/stripe-webhook-hardening/SKILL.md · 65 lines

How it starts

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

Stripe Webhook Hardening

Harden Stripe webhook handlers against the three ways generated webhook code most commonly fails in production.

The Three Invariants

1. Raw-Body Signature Verification

The route MUST read the raw request body and verify stripe-signature before any JSON parsing. stripe.webhooks.constructEvent(rawBody, sig, secret) is the only valid entry point.

Failure mode: parsing JSON before constructEvent makes signature verification impossible — the signature covers the raw bytes, not the parsed object.

2. Negative-Lifecycle Handling

Failure and cancellation events (invoice.payment_failed, customer.subscription.deleted) MUST change real product state, not just log.

Failure mode: treating these as log-only events means users keep access after payment failure or cancellation.

3. Idempotent Side Effects

Every side effect MUST be replay-safe. Stripe retries and may deliver the same event more than once.

Implementation options (all valid):

  • Store processed event IDs (good default)
  • Use a stable business idempotency key (e.g., checkout_session.id)
  • Use naturally idempotent state-setting updates (e.g., UPDATE SET status = 'canceled')

The stronger invariant is that the mutation itself must be replay-safe.

Review Checklist

  1. Does the route read raw request body and verify stripe-signature before any parsing?
  2. Do failure and cancellation events change real product state, not just log?
  3. Is every side effect idempotent under replay?
  4. Are there tests and an operational verification path through the Stripe dashboard?

Architecture

Webhook routes should be thin ingress adapters. Shared billing helpers own verification, dispatch, idempotency, and state transitions. One shared billing path handles all billing mutations.

Dedalus Canon

  • apps/website/app/api/(webhooks)/stripe/route.ts — fail-closed ingress pattern
  • apps/website/services/stripe/webhooks/payment-handlers.tsinvoice.payment_failed state update + checkout idempotency key
  • apps/website/services/stripe/webhooks/subscription-handlers.tscustomer.subscription.deleted → downgrade to Hobby

Read the full file on GitHub · 65 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. 9d ago First seen · 65 lines · 82 tokens per session scan A 4831edaf1537

Subscribe to this mod's changes

stripe-webhook-hardening is a skill published in the GitHub repository Kevin-Liu-01/Agent-Machines (29 stars, last pushed yesterday), licensed MIT. It adds 82 tokens to every session and 655 once invoked, about $0.0004 per session on Opus 5. 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-09-03.

Related

Other skills, from other repositories