fix: webhook secret rotation rejects valid events#1587
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
…ails The webhook verification loop collects errors from each secret attempt. When multiple secrets are configured for rotation, if the first secret fails but a later one succeeds, the error check `len(parseErrs) > 0` incorrectly returns an error despite successful verification. Change condition to only fail when all secrets have been exhausted.
5f25fb0 to
4153901
Compare
Coverage Report for CI Build 25155145290Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage remained the same at 41.949%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Summary
BillingWebhookwhere valid Stripe webhook events are rejected during secret rotationStripeWebhookSecretsare configured, if the first secret fails verification but a later one succeeds, the conditionlen(parseErrs) > 0incorrectly returns an errorlen(parseErrs) == len(secrets)so it only fails when all secrets are exhaustedTest plan
core/eventtests pass