Skip to content

Stripe webhook accepts events when no webhook secret is configured #6404

Description

@rtibbles

🙂 Looking for an issue? Welcome! This issue is open for contribution. If this is the first time you’re requesting an issue, please:

  • Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that don’t follow the guidelines won’t be answered.
  • Confirm that you’ve read the guidelines in your comment.

Overview

STRIPE_WEBHOOK_SECRET defaults to an empty string when its environment variable is unset, and stripe_webhook then verifies events against that empty key. On a deployment without the variable, anyone can send a webhook signed with the empty key and change a user's subscription storage.

Complexity: Low
Target branch: hotfixes

Context

  • settings.py reads STRIPE_LIVE_WEBHOOK_SECRET or STRIPE_TEST_WEBHOOK_SECRET with a default of "".
  • stripe_webhook passes that value to stripe.Webhook.construct_event unchecked.
  • Reproduced under the test settings: a customer.subscription.updated event signed with an empty secret was accepted and set the user's subscription_disk_space.

The Change

  • stripe_webhook should reject every event when the webhook secret is empty, and log an error saying the secret isn't configured.
  • Studio should still start without the Stripe variables, so development and test environments keep working.

Acceptance Criteria

General

  • With an empty webhook secret, every webhook request returns 4xx and changes no subscription.
  • With a webhook secret set, correctly signed events are handled as before.

Testing

  • Tests cover an event signed with an empty secret while none is configured, and a correctly signed event while one is.

AI usage

I chose which audit findings belong in #6398 and set the access pattern. Claude Code found and reproduced this gap and drafted this issue.

Activity

  1. added theissue type on Nov 15, 2026
  2. added
    good first issue
    help wanted
    on Nov 15, 2026
  3. learning-equality-bot commented on Nov 15, 2026

    @learning-equality-bot
    Contributor

    Hi! 👋

    This issue is available for contribution and supports self-assignment. Here's how to get started:

    • Comment /assign to assign yourself to this issue
    • You can have up to 2 issues assigned at a time across all community repos
    • Dropping an issue has a 7-day cooldown before the slot opens up
    • Link your pull request to this issue when you submit it

    📖 Read the Contributing guidelines before starting.

    Are you preparing for Google Summer of Code? See our GSoC guidelines.

  4. adibmbrk commented on Nov 17, 2026

    @adibmbrk
    Contributor

    /assign

  5. learning-equality-bot commented on Nov 17, 2026

    @learning-equality-bot
    Contributor

    Hi! 👋

    You've been assigned to this issue. Here's what to do next:

    • Read the issue description carefully and make sure you understand the requirements
    • Link your pull request to this issue when you submit it
    • If you can no longer work on this, unassign yourself so others can pick it up

    Good luck! 😊

    Are you preparing for Google Summer of Code? See our GSoC guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

DEV: backendcommunity-contribution-in-progressgood first issuehelp wanted

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions