Repository navigation
fix(core): limit /orders/by-draft to thank-you page fields - #69
Open
robertmonroe wants to merge 1 commit into
Open
robertmonroe wants to merge 1 commit into
robertmonroe wants to merge 1 commit into
Conversation
The public order poll returned the whole stored order to anyone holding the draft id, which travels in the thank-you URL: billing and shipping addresses, Stripe ids, IP address, user agent, coupon codes, notes and metadata. Return only what OrderSummaryIsland renders: order id, number, status, currency, total and a masked customer email, plus each item's id, name, quantity and total. Pending and failed responses are unchanged. Fixes emdashCommerce#68 Co-Authored-By: Claude Opus 5.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.
Fixes #68.
Problem
GET /orders/by-draft?id={draftId}is a public route. When the order exists it returned the whole storedOrderplus fullOrderItems. The draft id is not a secret in practice: it sits in the thank-you URL, so it ends up in browser history, logs andRefererheaders. Anyone with it could read billing and shipping addresses, the customer email, Stripe payment intent / customer / charge ids, IP address, user agent, coupon codes, the customer note, metadata and vendor ids.Fix
The
readyresponse now carries only whatOrderSummaryIslandrenders:id,orderNumber,status,currency,total, andcustomerEmailmasked asj***@example.comid,name,quantity,totalpendingandfailedresponses are unchanged. The full order is still available through the admin routes.toPublicOrder,toPublicOrderItemandmaskEmailare exported so other public surfaces can reuse the same shape.Visible change: the thank-you page's "A receipt has been sent to …" line now shows the masked email. If you'd rather keep the full address there, that's a one-line change in
toPublicOrder, but the address would then be readable by anyone with the URL.Tests
packages/core/test/orders-public.test.ts(5 tests): exact response shape, a check that none of the sensitive stored values appear anywhere in the JSON, pending/failed states, andmaskEmailedge cases. All pass.tsc --noEmitis clean.version-check/ signed-webhook dispatch tests. They fail the same way onmainwithout this change in my environment (Windows), so they look unrelated to this PR.Changeset included (
@dashcommerce/corepatch).🤖 Generated with Claude Code