Hi team π
Weβre implementing provider-level access control and wanted to validate our approach.
Current state
- We have org-level AccessPolicies in place, so users can only access data within their organization.
- In the app, we restrict providers to only their CareTeam patients by:
-- Fetching CareTeams for the logged-in provider
-- Deriving patient IDs
-- Loading Patient and patient-linked resources (Observation, CarePlan, Encounter, DocumentReference, etc.) only for those patients
This works at the UI level, but we understand this is not a security boundary.
Identified limitation
AccessPolicy does not support chained or nested criteria (e.g. Patient β CareTeam), so a provider token can still directly call:
GET /fhir/R4/Patient
GET /fhir/R4/Observation?subject=Patient/{other-patient}
and see all org data.
Planned approach
We are planning to enforce access server-side by:
-- Preventing providers from calling Medplum FHIR APIs directly
-- Routing all provider access through our backend
-- Using backend/service credentials (systemRepo) to query Medplum
-- Enforcing CareTeam β Patient authorization in the backend
This ensures providers can only access assigned patients and their data, even via direct API calls.
Question
Is this *backend enforcement / proxy model * the recommended and supported approach in Medplum for CareTeam-based patient restriction?
Are there any other Medplum-supported patterns to achieve this that we should consider?
Thanks in advance!