Require auth for order status and message read routes#367
Require auth for order status and message read routes#367ayushshrivastv wants to merge 3 commits intoshopstr-eng:mainfrom
Conversation
|
@ayushshrivastv is attempting to deploy a commit to the shopstr-eng Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @ayushshrivastv |
|
@Aryan0699, thanks for pointing out the role based checks! I’ve included the fix here. |
The fix looks perfect🙂 . A buyer can cancel but not ship. A seller manages the confirmation and pending is shared which makes sense as any party might need to set the intial state. |
|
@ayushshrivastv would be great if you address the review comments when you get a chance. |
that is the intended behavior here, and this pr already enforces that same role split. buyer can cancel but not ship, seller manages confirmed, shipped, and completed, and pending is shared since either side may need to set the initial state. |
|
Yes, that part looks correct 👍 I was just referencing it. The pending review comments I mentioned are about the other suggestions I added above. |
Can you elaborate? |
|
Aren't they visible ? |
Actually, it’s not visible on my side! |
|
OK, now it's visible. |
|
Perfect thanks 👍 Might be some glitch !! |

Unauthenticated order status update API enables tampering
shopstr/pages/api/db/update-order-status.ts
Lines 1 to 35 in 7e26694
still accepts orderId, status, and messageId with no auth check, while
shopstr/pages/api/db/mark-messages-read.ts
Lines 1 to 20 in 7e26694
still accepts arbitrary messageIds with no auth check. the underlying db mutations in https://github.com/shopstr-eng/shopstr/blob/main/utils/db/db-service.ts#L856-L918 also still update message_events by id or order_id only, with no ownership validation