fix: add webhook timestamp validation for replay attack protection (issue #23)#2590
Conversation
|
Someone is attempting to deploy a commit to the Nisshchaya's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎉 Thanks for your contribution, @tmdeveloper007!Your PR has passed our automated GSSoC quality checks. Here's a quick summary:
A maintainer will review your PR soon. Please be patient and available for feedback. 💪 GSSoC'26 automation · Maintainer: @nisshchayarathi |
|
CodeRabbit review is passing. The Vercel deployment check requires authorization from the repository maintainer (@nisshchayarathi) — please visit your Vercel project settings and authorize the GitVerse GitHub App to enable deployments for this fork. Happy to help if needed. |
Summary
Adds timestamp validation to the GitHub webhook handler to prevent replay attacks. Webhook events older than 5 minutes (GitHub-recommended threshold) are now rejected with HTTP 400.
The validation extracts the event timestamp from the payload (
pull_request.updated_at,issue.updated_at, orhead_commit.timestamp) and compares it against the current time.Issue
Fixes #23: Verify GitHub webhook signatures (+ replay protection)
Changes
MAX_WEBHOOK_AGE_MSconstant (5 minutes)extractEventTimestamp()helper to extract timestamp from payloadvalidateWebhookTimestamp()function that returns validity + reasonSecurity Impact
Prevents replay attacks where an attacker with a valid signed webhook reuses it after the valid time window.
Files Changed
app/api/integrations/github/webhook/route.ts