Fix express-checkout env mismatch and drop a nonexistent CSP host - #28
Open
east-6 wants to merge 1 commit into
Open
Fix express-checkout env mismatch and drop a nonexistent CSP host#28east-6 wants to merge 1 commit into
east-6 wants to merge 1 commit into
Conversation
Two fixes, both reader-facing. lib/env.ts required WHOP_COMPANY_ID, but nothing at runtime reads it. Only scripts/setup.mjs uses it, and that reads process.env directly with its own error message. The published article does not list it in its env table, so a reader who followed the article and cloned this project hit a startup throw on an env var the app never needed. It is now out of the runtime schema and noted in .env.example as setup-only. next.config.ts allowed https://sandbox-js.whop.com in script-src. That host does not exist: DNS returns NXDOMAIN and the shipped @whop/checkout package contains zero references to it. The sandbox checkout is framed from sandbox.whop.com, which frame-src already covers. Allowlisting a dead host was a no-op, but it misleads anyone copying the policy. Verified: next build succeeds with only the four env vars the article lists. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Two small fixes to
express-checkout, both of which a reader following the published article can hit.1.
WHOP_COMPANY_IDwas required but never usedlib/env.tshad it in the runtime schema, sogetEnv()threw without it. Nothing in the app reads it. The only consumer isscripts/setup.mjs, which readsprocess.env.WHOP_COMPANY_IDdirectly and already prints its own message if it is missing.The published article does not list
WHOP_COMPANY_IDin its env var table, so anyone who followed the article and then cloned this project hit a startup error for a variable the app never needed.Removed from the runtime schema.
.env.examplekeeps it, now labelled as only needed bynpm run setup.Verified:
next buildsucceeds with only the four variables the article lists (WHOP_COMPANY_API_KEY,WHOP_SANDBOX,SESSION_SECRET,APP_URL).2.
sandbox-js.whop.comdoes not existIt was in
script-src. DNS returns NXDOMAIN for it, and grepping the shipped@whop/checkoutpackage finds zero references in either0.3.1or0.0.54. The only Whop hosts in that bundle aresandbox.whop.com,whop.comandt.whop.tw.The sandbox checkout is framed from
sandbox.whop.com, whichframe-src https://*.whop.comalready covers. Allowlisting a host that does not resolve is a no-op at runtime, but it is wrong and it gets copied.js.whop.com,t.whop.twandcdn.plaid.comare untouched.Note for a follow-up
The same phantom host appears in 10 other files across 6 projects:
embedded-chat,free-trial,linktree-clone,medium-cloneandpaywall, plus twodocs/files and avercel.ts. Left alone here to keep this PR scoped. Happy to do a sweep separately.