SNAPWOO-101 Purchase pixel exposes order and hashed billing data on unauthenticated order-received requests - #89
Open
zamanq wants to merge 2 commits into
Open
Conversation
zamanq
marked this pull request as ready for review
August 19, 2026 17:53
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.
Changes proposed in this Pull Request:
The Snapchat purchase pixel loaded the order straight from the numeric
order-receivedendpoint, without checking the WooCommerce order key. WooCommerce renders a generic confirmation page when the key is missing or wrong, but the pixel handler still added a PURCHASE event to the footer - exposing order total, currency, product IDs, categories, item count and transaction ID, plus SHA-256 hashed billing email/phone/name/city/postcode/country when PII collection is on. Anyone who guessed an order number could read all of that from the page source, no login required.This PR adds
Helper::get_verified_order_received_order(), a single gate that returns the current order-received order only when the request is authorized, mirroring what WooCommerce itself checks before rendering order details:?key=is present and passeskey_is_valid()(a malformed/array key is rejected without a PHP warning)RemotePixelTracker::track_purchase_event()now uses that gate and bails before building any payload and before writing the_snapchat_pixel_trackedmeta, so a blocked request leaves the order untracked and the real customer still gets their event.UserIdentifier::add_user_details()was independently loading the order from the query var, so it leaked hashed billing identifiers on its own. It now accepts an optional WC_Order (the pixel tracker passes the already-verified one) and otherwise falls back to the same gate. This also covers the CAPIuser_datapath.Closes https://linear.app/a8c/issue/SNAPWOO-101/purchase-pixel-exposes-order-and-hashed-billing-data-on
Screenshots:
N/A
Detailed test instructions:
wp eval '$o = wc_get_order( 123 ); $o->delete_meta_data( "_snapchat_pixel_tracked" ); $o->save();'/checkout/order-received/123/(no key) and also try a wrong key (?key=wc_order_bogus) and a malformed one (?key[]=x). In each case the page source must contain nosnaptr("track", "purchase"payload and no hashed identifiers, and the generic confirmation page must render without any errors.