Skip to content

Guard mock billing upgrades in production - #47

Merged
AlexKitipov merged 1 commit into
mainfrom
codex/fix-payment-upgrade-exposure-in-production
Jun 9, 2026
Merged

Guard mock billing upgrades in production#47
AlexKitipov merged 1 commit into
mainfrom
codex/fix-payment-upgrade-exposure-in-production

Conversation

@AlexKitipov

Copy link
Copy Markdown
Owner

Motivation

  • Prevent demo/mock premium upgrades from being accidentally exposed in production by gating the mock endpoint behind an explicit configuration flag.
  • Provide placeholders for a future Stripe checkout integration so production billing can be wired in safely.

Description

  • Add ENABLE_MOCK_BILLING and Stripe placeholder settings (STRIPE_API_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRICE_ID, STRIPE_SUCCESS_URL, STRIPE_CANCEL_URL) to app/config.py.
  • Gate the mock upgrade flow in app/api/v1/users.py with a helper _mock_billing_enabled() and return a clear 403 MOCK_BILLING_DISABLED AppException when ENVIRONMENT=production and ENABLE_MOCK_BILLING=false.
  • Update README.md to document the production guard and Stripe placeholders.
  • Add tests tests/test_users_upgrade.py that assert the mock upgrade is blocked in production by default and allowed when ENABLE_MOCK_BILLING=true for controlled demos.

Testing

  • Ran the new unit tests with pytest -q tests/test_users_upgrade.py, which passed.
  • Ran the full test suite with pytest -q, which completed successfully (all tests passed, with only deprecation warnings reported).

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da5c0efa49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/api/v1/users.py
@AlexKitipov
AlexKitipov merged commit 6b869c0 into main Jun 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant