Files
bsk/lib
tiennm99 8331ad5087 fix: close auth bypass in staff RPCs and tighten data-access boundaries
- set_staff_role/remove_staff guards were NULL-unsafe: an authenticated but
  unenrolled principal (possible on the shared auth pool) skipped the RAISE
  and could promote or delete staff; rewritten with the null-safe form.
- Report/prescription PDFs now require a clinical role and the invoice PDF a
  staff role, matching the screens that link to them; the role sets live in
  lib/db/roles.js and are shared by layouts, actions, and route handlers.
- Storage policies on bsk-checkup-media scoped to clinical roles.
- Billing RPCs serialize on a per-checkup advisory lock so a line rewrite can
  never commit after payment; mark_order_paid rejects deleted checkups and
  zero-line invoices.
- PDF customer lookups skip soft-deleted patients; invite rate limiter fails
  closed (SMTP spend is irrecoverable); patient search escapes LIKE wildcards.
2026-08-18 20:41:45 +07:00
..