Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe event handling doesn't verify the source #1765

Open
alexgmin opened this issue Nov 23, 2024 · 1 comment
Open

Stripe event handling doesn't verify the source #1765

alexgmin opened this issue Nov 23, 2024 · 1 comment

Comments

@alexgmin
Copy link
Contributor

# For security, re-request the event object from Stripe.
# TODO: Verify shared secret here?
try:
event = stripe.Event.retrieve(data["id"])
except stripe.error.InvalidRequestError:
return HttpResponse(422)

Instead of calling Stripe with the event id it should verify the source of the event and prevent replay attacks as indicated here
https://docs.stripe.com/webhooks#verify-events

The Stripe library already has a method to do this https://docs.stripe.com/webhooks?lang=python#verify-webhook-signatures-with-official-libraries

@bmispelon
Copy link
Member

@alexgmin I've opened a PR for this: #1770

Does that seem ok to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants