Skip to content

security: Khao Pad v4.5.1 order-page access fix - #26

Merged
thunpisit merged 1 commit into
mainfrom
hotfix/order-access-v4.5.1
Oct 25, 2026
Merged

thunpisit merged 1 commit into
mainfrom
hotfix/order-access-v4.5.1

Conversation

@thunpisit

Copy link
Copy Markdown

Cherry-pick of codustry/khaopad@4c86687 (v4.5.1, codustry#220): customer order pages, return requests and pay-by-order-number now require proof of access (staff, owner, order email, or the placing browser's signed cookie). Before this, anyone could read any order's name/email/phone/address by walking sequential order numbers.

Hotfix only: no other upstream changes, no migration. Fork suite + svelte-check + build pass locally.

🤖 Generated with Claude Code

The customer order page looked orders up by number alone whenever no
?email= was given, and order numbers are sequential — so anyone could
walk KHP-2026-00001, 00002, … and read every buyer's name, email,
phone and shipping address. Any signed-in account, customers included,
could do the same. The return-request action and pay-by-orderNumber
had the same gap.

Access now needs one of: staff (admin+), the owning account (user id,
or a verified email matching the order), the order's email (receipt
links and /lookup), or the browser that placed the order — checkout/
start sets an HMAC-signed cookie (keyed by BETTER_AUTH_SECRET) so a
guest returning from the payment page still lands on their order.
Refusals are the same 404 as a missing order.

Ported from bactrack-website 70d37f5, with a generic cookie name and a
verified-email requirement on the account-email path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4c86687)
@thunpisit
thunpisit merged commit b5b9c4e into main Oct 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant