Repository navigation
fix: read the Stripe secrets without the white space they were pasted with - #13
Merged
Merged
Conversation
… with The first purchase in Stripe's test mode found every webhook delivery refused as signed with another secret: the signing secret had been saved with the space before it on the line stripe listen prints, and Mallok keeps a secret exactly as pasted. Neither secret can contain white space, so every reading now goes through one function that trims it, and a test holds the shop to that one place.
Phase 2's last exit criterion, run against a local site on the owner's sandbox: paid, delivered twice, refunded, expired and cancelled. The README, its translation and SECURITY.md no longer say it has not been run, and say what is still untried at Stripe and how to recover an event stripe listen missed.
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.
Phase 2's last exit criterion: a purchase run end to end in Stripe's test mode, on the owner's sandbox, against a local site (
npm run preview, events forwarded bystripe listen --latest). It found one defect, fixed here.The defect
The webhook signing secret had been saved with the space before it on the line
stripe listenprints. Mallok stores a plugin secret exactly as it is sent, so every delivery from Stripe was refused as signed with another secret (400), while the admin showed the secret as set. A shop in that state confirms no payment.Neither Stripe secret can contain white space. Every reading of one now goes through
stripeSecretinlib/stripe-secrets.ts, which trims it. That covers nine readings: checkout, the webhook route, the admin's order actions, the cron and the admin's checks. A test fails when any other file reads a secret directly.Mallok's side is written up for the owner as M48: trim on save, and treat a value that is only white space as unset.
What the purchase covered
Each step was checked both in the shop's tables and through Stripe's API.
expired) by Stripe's event, with the stock untouched.seller). Stripe's expiry event that followed changed nothing.The full account is in design §22.
Verification
npm run lint,npm run typecheck,npm test(1,104 tests in workerd and 54 project tests),npm run buildandnpm run smoke:shopall pass locally.Docs
stripe listenmissed: its login lapses after an hour or two, after which it stops forwarding.Not verified