Work Order Notes Visible Across Sites
Level 2 · node · Security · Missing site-scoped authorization in note lookup
Scenario
A fictional maintenance system stores work orders and inspection notes separately for each site. Operators submit their site identifier and work order ID when requesting a note. The current API looks up notes only by work order ID, exposing notes from other sites. Trace the request handler, note service, and repository lookup.
Requirements
Return 200 and the note only when both the requesting site ID and work order ID match the stored record. Return 404 for work orders belonging to another site, nonexistent IDs, or a missing site ID. Preserve successful access to notes in the operator's own site.
Acceptance criteria
- A note belonging to the requester's site is accessible.
- A work order from another site cannot be accessed.
- An unknown work order ID returns 404.
- A request without a site ID cannot access a note.