fix: filter transactions by user_id to prevent data exposure#31
Conversation
|
Reviewed against PR head commit The list endpoint now has the right owner filter, but the same trust boundary still needs to be applied to the other user-facing transaction reads. This PR adds That leaves these paths still able to read by public/shared identifiers without an explicit owner filter:
I’d extend the PR so every authenticated user-facing transaction lookup also constrains by the current user, e.g.: .eq("id", id)
.eq("user_id", user.id)and for the duplicate fallback: .eq("idempotency_key", idempotencyKey)
.eq("user_id", user.id)That keeps the current fix, but closes the direct lookup/idempotency paths instead of only the dashboard list. |
|
Thanks for the thorough analysis, @Cassxbt! You're right that with the new RLS policies the owner boundary needs to be explicit at every authenticated read path. All three gaps closed in 9c7cec6:
Each path was already authenticated, so the only change was the additional owner filter. |
|
Re-checked |
Problem
The
GET /api/transactionsendpoint authenticates the user but fetches all transactions withtransaction_type = 'USER'— without filtering by the authenticated user's ID.This means any logged-in user can see every other user's transaction history.
Fix
Added
.eq("user_id", user.id)filter to the Supabase query so each user only sees their own transactions.Impact