Skip to main content

implement-webhook-signature-verification

Verify webhook authenticity, freshness, and replay safety using raw request bytes and provider-specific signature rules. Use when accepting externally initiated events that can change application state.

来源信息

仓库
protosphinx/sphinxstack
最近来源活动
2026年7月29日 13:55
检测到的 SKILL.md 语言
英语
星标
3
Forks
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
implement-webhook-signature-verification
category
web
description
Verify webhook authenticity, freshness, and replay safety using raw request bytes and provider-specific signature rules. Use when accepting externally initiated events that can change application state.
# implement-webhook-signature-verification Authenticate the exact message before parsing or acting on it. ## When to use - Use for payment, identity, deployment, messaging, commerce, and partner webhooks. - Follow the sender's current signed-payload specification instead of inventing a generic scheme. ## Procedure 1. Record the provider, endpoint, algorithms, signed fields, timestamp rules, secret versions, retry policy, and event identifiers. 2. Read the body as bounded raw bytes before any JSON parsing, normalization, decompression, or middleware mutation. 3. Parse the signature header defensively and reject missing, malformed, unsupported, or excessive values. 4. Reconstruct the exact provider-defined signed payload and compute the MAC or signature with the correct secret or public key. 5. Compare authenticators with a timing-safe function. Accept multiple secrets only during a recorded rotation window. 6. Enforce timestamp freshness with measured clock tolerance and record clock-health assumptions. 7. Deduplicate by durable provider event identifier and handler outcome; do not rely on timestamp checks alone to stop replay. 8. Acknowledge only according to the provider retry contract. Make downstream mutation idempotent and separate verification from slow work. 9. Redact signatures, secrets, bodies, and personal data in logs while retaining correlation and decision evidence. 10. Test valid, altered, truncated, oversized, stale, replayed, duplicate, reordered, wrong-secret, rotated-secret, and middleware-modified requests. ## Failure plan - Reject unverifiable requests without invoking business logic. - If clock health or key state is unknown, quarantine the event and alert instead of bypassing verification. - If an event is valid but processing fails, preserve idempotent retry state. ## Done - A verification specification identifies exact signed bytes, algorithms, freshness, key versions, and replay controls - Tests prove invalid, stale, replayed, malformed, and oversized requests cannot trigger side effects - An operations record verifies secret rotation, durable deduplication, safe retries, redacted telemetry, and failure alerts
在 GitHub 查看