fix(billing): reject Stripe webhooks with no signature header - #864
Merged
Conversation
stripe 15.5.1 tightened the type of Webhook.construct_event's sig_header parameter to str, so passing the possibly-absent Stripe-Signature header straight through fails pyright. Raise explicitly when the header is missing instead. The raise lands in the existing except block, so the response is unchanged: the rejection is logged, recorded with has_signature_header=False, and answered with 400 - the same outcome construct_event produced for a missing signature. Unblocks the typecheck job on the stripe 15.5.1 bump (#860).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unblocks the typecheck failure on #860 (bump stripe 15.3.1 -> 15.5.1).
stripe 15.5.1 tightened
Webhook.construct_event'ssig_headerparameter tostr, so passing the possibly-absentStripe-Signatureheader straight through fails pyright:This raises explicitly when the header is missing. The raise lands in the existing
exceptblock, so behaviour is unchanged: logged, recorded withhas_signature_header=False, answered with 400 - the same outcomeconstruct_eventproduced for a missing signature.Verified against stripe 15.5.1 with pyright: the old call pattern reproduces the CI error, the guarded one is clean.
After this merges, #860 needs a dependabot rebase to pick it up.