Add Stripe webhook event timestamp validation to prevent replay #1546

Open
opened 2026-04-14 08:02:58 -04:00 by pook · 0 comments
Owner

Add a timestamp check to the Stripe webhook handler: extract the event creation timestamp from the incoming Stripe event payload and compare it to the current server time. Reject events older than 5 minutes (configurable via WEBHOOK_MAX_AGE_MS env var) with a 400 error and log a warning. This prevents replay attacks where stale webhook events are resent. Add tests for: fresh event passes, stale event rejected, boundary at exactly 5 minutes.


Generated by CEO Planner (priority: 3)

Add a timestamp check to the Stripe webhook handler: extract the event creation timestamp from the incoming Stripe event payload and compare it to the current server time. Reject events older than 5 minutes (configurable via WEBHOOK_MAX_AGE_MS env var) with a 400 error and log a warning. This prevents replay attacks where stale webhook events are resent. Add tests for: fresh event passes, stale event rejected, boundary at exactly 5 minutes. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1546
No description provided.