Repository navigation
Don't open Stripe checkout sessions for scripts and scanners - #203
Merged
Merged
Conversation
POST /api/checkout now applies the same bot check as GET, and the GET handoff keeps the visitor's headers so the per-IP rate limit and the bot check still see the real IP and user agent.
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.
Why
Stripe shows 6 expired Godmode Pro checkouts since 15.10 with no email. Matching them against D1 (
orders+events):curl -X POST /api/checkouthealth check (tool call 07:24:06, session 07:24:17)None of them was a real visitor leaving at the card step. They inflate "expired checkouts" and hide the real funnel.
What
POST /api/checkoutruns the sameBOTSuser-agent check asGET(curl, python, scanners, monitors) and answers303 /#pricing(or403JSON) without creating a Stripe session.GEThandoff toPOSTnow keeps the original request headers, so the per-IPCHECKOUT_LIMITand the bot check see the real IP and user agent (before, every GET was rate-limited under the keyunknown).Test
Local
wrangler devbuild:curl -X POST -d plan=monthly /api/checkout->303 /#pricing, no sessioncurl /api/checkout?plan=monthly->303 /#pricingutm_source=app) -> go on to Stripe session creation (fails locally on the dummy key as expected)pnpm typecheck: 0 errors