Skip to content
Back to skills

Webhook

ASecurity

Implement a webhook receiver with signature verification and idempotency

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
ai-agentsrustgogitapi

Works with

  • api

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill webhook --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Webhook?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Webhook
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-webhook/badge)](https://www.skillsdirectory.com/skills/black141312-webhook)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: webhook
description: Implement a webhook receiver with signature verification and idempotency
category: api
---

# Webhook

Use when accepting inbound webhooks from a third party (Stripe, GitHub, etc.) — you must verify authenticity and process safely.

1. Capture the raw request body before any JSON parsing — signature verification needs the exact bytes, not a re-serialized object.
2. Read the signature header and shared secret, recompute the HMAC, and compare with a constant-time check; reject with 401 on mismatch.
3. Reject stale events using the provider's timestamp (tolerance window) to block replay attacks.
4. Deduplicate by the provider's event id so retries don't double-process — store seen ids or use a unique constraint.
5. Acknowledge fast: return 2xx immediately and hand slow work to a queue/background job so the provider doesn't time out and retry.
6. Test signature pass/fail, a replayed event, and a duplicate-id delivery.

## Rules
- Never trust the payload until the signature verifies; verify against the raw body, framework body-parsers often mutate it.
- Use a constant-time comparison for signatures to avoid timing leaks; `==` on the digest is a vulnerability.
- Make handling idempotent — providers deliver at-least-once and will retry on any non-2xx or timeout.
- Return 2xx for accepted-but-unprocessed events; do real work async so a slow handler doesn't trigger redelivery storms.
- Keep the secret in env/secret storage, never in code, and scope it per-provider.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.