- Home
- Skills
- APIs & Backend
- Webhook Receiver Hardening: Signatures, Replay, Idempotency
Works with the AI Agents you already use
Webhook Receiver Hardening: Signatures, Replay, Idempotency
Make Stripe, GitHub, Shopify and other webhooks safe: raw-body signature checks, replay protection, process-once, fast acks, tested. SECURE / FRAGILE / SPOOFABLE.
$5
Webhook Receiver Hardening: Signatures, Replay, Idempotency
Example session with this skill installed
Audit our webhook handlers. Next.js App Router on Vercel. /api/stripe/webhook handles checkout.session.completed and invoice.paid, /api/github/webhook handles push. Some customers got their credits twice last week.
- Read your context and instructions
- Compiled the webhook receiver hardening
Webhook receivers: app — VERDICT: SPOOFABLE
Endpoints
| Route | Provider | Verification | Idempotency | Ack time |
|---|---|---|---|---|
| /api/stripe/webhook | Stripe | constructEvent on JSON.stringify(await req.json()) | none | 2.8 s |
| /api/github/webhook | GitHub | none | none | 0.3 s |
Findings
| # | Severity | Endpoint | Issue | Evidence | Fix |
|---|---|---|---|---|---|
| 1 | Critical | github | No signature check: anyone can POST a fake push and trigger a deploy | app/api/github/webhook/route.ts:8 | verify X-Hub-Signature-256 with timingSafeEqual on await req.text() |
| 2 | High | stripe | Verifies re-serialized JSON; fails intermittently, which is why someone added a SKIP_VERIFY env flag | route.ts:14, route.ts:9 | verify on await req.text(); delete SKIP_VERIFY |
| 3 | High | stripe | invoice.paid adds credits with +=; Stripe delivers at least once, so a redelivered event added credits twice | lib/billing.ts:41 | webhook_events table keyed on event.id + set credits from the invoice, not increment |
| 4 | Medium | stripe | Email and PDF generated inline | route.ts:30-58 | store event, return 200, process in a job |
| 5 | Low | both | Unknown event types return 500 | route.ts:61 | return 200 and ignore |
Tests (7/7 pass after fixes)
Valid Stripe event → 200, processed once · same event twice → processed once · one byte changed → 400 · timestamp 10 min old → 400 · GitHub without signature → 401 · handler throws → 500, retryable · unknown type → 200. Ack time 2.8 s → 90 ms.
Runbook
Rotate secrets in Stripe and GitHub settings, update Vercel env vars, redeploy. Find the double-credited customers with the query in scripts/find-double-credits.sql (read-only) before correcting balances.
Connects securely to your tools. The creator never sees your data.
About this skill
A webhook endpoint is a public URL that marks orders paid, grants access or deletes data. If it skips signature checks anyone can call it. If it verifies against re-serialized JSON, verification breaks or can be bypassed. If it is not idempotent, provider retries charge, email or provision twice. If it does slow work inline, the provider times out and retries again.
This skill gives your coding agent a hardening procedure and a reference file of provider signature schemes checked against official docs. It:
- Inventories every webhook route: provider, events, what each changes, body parser, secret location
- Checks 12 items per endpoint: signature on every request, raw body (with the exact fix for Express, Next.js, Fastify, NestJS, Django, Flask, FastAPI, Rails, Laravel, Go and serverless), constant-time compare, timestamp tolerance, event-ID dedupe, fast ack, ordering, status codes, secret rotation, unknown events, exposure and replay runbook
- Covers Stripe, GitHub, Shopify, Slack, Paddle, Twilio, HubSpot and the Standard Webhooks spec (Svix and many SaaS APIs)
- Fixes spoofing first, then double or missed processing, then speed and observability
- Tests it: valid, duplicate, tampered, stale, unsigned, failing and unknown events
- Returns a verdict: SECURE, FRAGILE or SPOOFABLE
Who it is for: SaaS and e-commerce developers taking payments, GitHub App and integration builders, and anyone whose webhook handler "mostly works".
Safety: uses the provider's official verification helper where one exists, never disables verification, never logs secrets, and only sends test events to local or staging.
Honesty note: it only reports tests it actually ran, and tells you to confirm provider details against current docs.
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.
Cannot perform live redelivery from provider dashboards. Requires access to framework-level middleware config to verify raw body handling. Does not store or rotate secrets directly.
How to use
- 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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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 29 days ago
- Software
- Your web framework
- Optional
- Provider SDKorCLI
The provider SDK or CLI is only for sending test events.