fix(time): enforce user_id ownership on time-entry stop/update/delete #123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/mapps-136-time-entry-ownership-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The stop_timer, update_time_entry, and delete_time_entry routes scoped writes by tenant_id and id only, letting any user in a tenant stop, tamper with, or delete a colleague's timer or entry (same-tenant IDOR). The routes now derive an owner guard of Some(user.id) for non-admins and None for admins, threaded into each service call. The SQL predicate AND ($N::uuid IS NULL OR user_id = $N) skips the check for admins (None) and otherwise restricts the write to rows the caller owns, so a non-owner gets the existing not-found path rather than mutating another user's row.
#MAPPS-136