Anyone with the app's public key can read every clinic's visit notes
What we found
Row level security was never turned on for the visit notes table. The public key, which ships in the app's JavaScript by design, is enough to read every note from every clinic without signing in. Signed in at Harbor Street, Alice also read Maple Row's notes and changed one of them.
Why it matters
Visit notes are the most sensitive records Wrenfield holds. With real patients, anyone who found the key could have read every note, and with no access record (F10) Wrenfield couldn't show that nobody did. Under HIPAA, an impermissible disclosure is presumed to be a breach unless a risk assessment shows a low probability the information was compromised, and a business associate must tell the clinic no later than 60 days after discovering one.
The fix
Turn row level security on for visit notes with the clinic rule the patients table already uses, and send reads and edits through two database functions that check the clinic and record who did what. Those functions also close F10.
Effort: About a day, with tests · Plan: week 1
Where it lands
- CC6.1 Logical access security over protected information
- CC6.3 Access granted by role, with least privilege
- §164.312(a)(1) Access control
- §164.308(a)(4) Information access management
- §164.410 A business associate's breach notice to the covered entity
Not affected: no card data involved
Evidence: 3 steps, recorded as the review ranShowHide
Clinic IDs starting a0 are Harbor Street Physio; b0 are Maple Row Physical Therapy. Keys and tokens are shortened here; the requests carried them in full.
- 1. Read visit notes with only the public key, no sign-in
GET /rest/v1/visit_notes?select=clinic_id,note apikey: eyJhbGciOiJIUzI1NiIs… (public key, from the app's JavaScript)
200 OK [ { "clinic_id": "a0000000-0000-4000-8000-000000000001", "note": "Pain 6/10 when bending. Started core stabilization; home exercises twice daily." }, { "clinic_id": "a0000000-0000-4000-8000-000000000001", "note": "Week 6 after ACL repair. Range of motion 0 to 115 degrees. Begin closed-chain strengthening." }, { "clinic_id": "b0000000-0000-4000-8000-000000000001", "note": "Painful arc 70 to 120 degrees. Rotator cuff strengthening; no overhead lifting for 3 weeks." }, { "clinic_id": "b0000000-0000-4000-8000-000000000001", "note": "Fall at home last month. Timed up-and-go 14 seconds. Start balance program; review home hazards." } ] - 2. Alice reads visit notes
GET /rest/v1/visit_notes?select=clinic_id,note apikey: eyJhbGciOiJIUzI1NiIs… (public key, from the app's JavaScript) Authorization: Bearer eyJhbGciOiJIUzI1NiIs… (Alice's sign-in token, Harbor Street)
200 OK [ { "clinic_id": "a0000000-0000-4000-8000-000000000001", "note": "Pain 6/10 when bending. Started core stabilization; home exercises twice daily." }, { "clinic_id": "a0000000-0000-4000-8000-000000000001", "note": "Week 6 after ACL repair. Range of motion 0 to 115 degrees. Begin closed-chain strengthening." }, { "clinic_id": "b0000000-0000-4000-8000-000000000001", "note": "Painful arc 70 to 120 degrees. Rotator cuff strengthening; no overhead lifting for 3 weeks." }, { "clinic_id": "b0000000-0000-4000-8000-000000000001", "note": "Fall at home last month. Timed up-and-go 14 seconds. Start balance program; review home hazards." } ] - 3. Alice edits a Maple Row note
PATCH /rest/v1/visit_notes?id=eq.b00000c1-0000-4000-8000-000000000001 apikey: eyJhbGciOiJIUzI1NiIs… (public key, from the app's JavaScript) Authorization: Bearer eyJhbGciOiJIUzI1NiIs… (Alice's sign-in token, Harbor Street) Prefer: return=representation { "note": "Painful arc 70 to 120 degrees. Rotator cuff strengthening; no overhead lifting for 3 weeks. (changed by Har…" }200 OK [ { "id": "b00000c1-0000-4000-8000-000000000001", "clinic_id": "b0000000-0000-4000-8000-000000000001", "patient_id": "b0000001-0000-4000-8000-000000000001", "appointment_id": "b00000a1-0000-4000-8000-000000000001", "note": "Painful arc 70 to 120 degrees. Rotator cuff strengthening; no overhead lifting for 3 weeks. (changed by Har…", "created_at": "2026-11-05 14:45:00+00" } ]
After the fix: Without a sign-in, the request is refused.



