Example

Worked application ยท access check

A support route missing its role check

A delivery company’s support workspace keeps private staff notes on each case. A maintenance shortcut lets any signed-in customer reach the staff review helper and read those notes, and the access check catches it.

Five routes over one case record

Five routes over one case record
RouteUserAccess path
/cases/viewCustomerRead a row, use it only after owns_case
/cases/replyCustomerRead a row, then use and write it after owns_case
/staff/reviewSupportRole-protected private review
/staff/resolveSupportRole-protected read and write
/staff/quick-reviewSupportThe route repaired below

The flawed route

route("/staff/quick-review", handler("review_case", review_case),
  [ReadPerm("support_cases")]),

The check and its recorded result

api_access_check({
  "sources": [{
    "fileName": "support-access-before.bosatsu",
    "source": COMPLETE_LINKED_SOURCE
  }]
})

Tool report โ€” recorded: support_cases is violated.

{
  "binding": "load_for_staff",
  "resource": "support_cases",
  "operation": "use",
  "kind": "RowEscapesGuard",
  "status": "violated",
  "detail": "a value derived from a row of \"support_cases\" is returned outside any branch on owns_case applied to Principal.user_id and the row"
}

Repair the route, preserve the policy

- route("/staff/quick-review", handler("review_case", review_case),
+ role_route("/staff/quick-review", handler("review_case", review_case), ["support"],
    [ReadPerm("support_cases")]),

The same check on the repaired source marks support_cases holds.

Run, edit, repair, and reset

Code & run Customer support access before and after

Ask your agent about anything here; it has the detail.

Where this fits

What this is about: Safety and Permissions