Designing Medplum access policies for least-privilege clinical data
Access policies are the layer in Medplum that enforces least privilege, by limiting each user, Bot or client application to the resource types, properties, criteria and compartments it needs. A team building or self-hosting Medplum should design these policies deliberately whenever more than one kind of person or system touches clinical data, such as clinicians, front-desk staff, patients, integrations and reporting jobs. Relying on broad defaults is easiest to start with, but it means that anyone with access to one record type may also reach data that belongs to a different role. Before writing any rule, list the roles in your organization, the FHIR resource types each role needs, and the properties that should stay hidden, such as sensitive notes or identifiers that a scheduler never uses.
Once the role list exists, map each role to the policy mechanisms the Medplum documentation describes: resource type rules, property-level restrictions, criteria-based filters that match records by their content, and compartment rules that tie access to a Patient or other anchor resource. Read-only roles are usually the first to define, because they show how a policy can allow reads while denying writes. Bots and client applications need their own policies, since a server-side process may not need the same reach as a person signed in through the web app. Check the exact policy syntax, the matching order of rules and the names of the properties and criteria fields against the current Medplum documentation and the access policy reference in the same docs set, because those details change between versions and a small error can widen access without warning.
Treat policy design as something to test before go-live, not something to inspect by reading. Create a test project, assign sample users and Bots to each role, and confirm for every role what it can read, create, update and delete, including searches and GraphQL queries that could return unexpected records. Record the results so that a later change can be compared against a known baseline. Ask your Medplum partner or internal owner to document who approves policy changes, how test cases are kept with the code or configuration, and how a rollback works if a policy blocks a clinical workflow. These steps are the evidence a compliance or security reviewer will ask for when deciding whether the access model matches the organization's stated controls.
Policy building blocks and when each fits
This table compares the five access policy building blocks you can combine in a Medplum access policy: resource type rules, property rules, criteria-based access, compartment access and read-only rules. Read each row for the typical use case and the most common misconfiguration, then confirm the exact syntax and behavior against the Medplum version you run before you rely on it.
| Building block | Typical use case | Main misconfiguration risk | Verify before go-live |
|---|---|---|---|
| Resource type rule | Grant a role access to whole resource types, such as Patient or Observation, for a clearly defined job | Granting a broad resource type with no narrowing, which exposes every record of that type in the project | Confirm which resource types the policy covers and that unlisted types are denied in your version |
| Property-level rule | Hide or restrict specific fields, such as financial or sensitive notes, from users who can otherwise read the resource | Assuming a hidden field is hidden everywhere, when it may still appear through search parameters, included resources or other APIs | Test each protected property through REST, search, GraphQL and Bots |
| Criteria-based access | Limit a role to records matching a search expression, for example a particular organization or status | A criteria expression that is too loose, or one that the user can change through their own search parameters | Run the same search as a restricted user and confirm the result set is limited |
| Compartment access | Let a patient or care team see only resources linked to one Patient, for example in a portal | Missing or incorrect compartment links on resources, so some data falls outside the compartment and is never visible, or is visible when it should not be | Check that every resource type you expose carries the expected patient reference and that Binary files are handled separately |
| Read-only resource rule | Give auditors, analysts or support staff view access without create, update or delete rights | Read-only at the resource level still allowing writes through operations, Bots or linked resource types | Attempt create, update and delete calls as the read-only user and review any operations the role can call |
| Combined policy for Bots and client applications | Scope a Bot or app to the minimum resource types and actions its function needs | Reusing a broad admin-like policy for convenience, so a compromised client has more reach than needed | Confirm the client's profile and policy assignment, then test with the client's own credentials |
Setting up and testing policies before go-live
This sequence turns a list of roles and data needs into access policies that have been tested in a non-production project, with both allowed and denied requests confirmed before anything reaches production. Each step ends with a check you can record as evidence for your security and compliance reviewers.
Inventory roles and data needs
Your security lead, clinical or operations owners and the Medplum administrator list every role that touches Medplum, such as front desk, clinician, billing, support and reporting. For each role, record the resource types it needs, the properties it must not see, whether it needs write access, and which patient or tenant data it may reach. Also list every Bot, integration and client application with its owner and the resources it reads or writes. The step is done when each identity has a written row in the inventory that a reviewer can sign off on.
Map each role to a policy
Translate each inventory row into a proposed access policy, deciding which resource types, properties and criteria apply and whether read-only access is enough. Flag any role that needs broad access so it can be justified in writing, and note where a criteria-based or compartment rule replaces a blanket grant. The output is a policy design document that lists every policy, the identities it attaches to and the reason for each permission. Confirm the exact policy fields and syntax against the current Medplum access policy documentation before you write them.
Create policies in a non-production project
The Medplum administrator creates the policies, user accounts, Bot identities and client application settings in a development or staging project, never in production first. Keep the names of policies aligned with the design document so that reviewers can trace each one. Confirm the current admin screens or API calls for creating and attaching access policies, because these change between releases. The step is complete when every policy in the design document exists in the test project and each identity is linked to the policy it is meant to use.
Assign representative test identities
Create or designate one test user, Bot and client application for each role in the inventory, using the same authentication method that production will use, including MFA where the role requires it. Avoid giving test identities administrator rights, since that hides permission gaps. Record which identity maps to which role so the test results can be read against the design. The check is that each test identity can sign in or authenticate the way its production counterpart will, and that its profile shows only the policies it was assigned.
Run allowed-access tests
For each role, run the searches, reads and writes it needs to do its job, using the test identities and realistic but synthetic records. Include searches by patient, by tenant or organization if you use tenants, and reads of the properties the role should see. Record the request, the response and the identity used in a test log. The step is done when every expected action in the inventory succeeds and the log can be replayed by someone outside the project team.
Test denied requests as carefully as allowed ones
For each role, attempt the actions it must not perform: reading other patients, reading hidden properties, writing to read-only resource types, touching Binary files without the right context, and calling endpoints outside its scope. Also test access from a network that should be blocked if you have IP rules in place. Confirm that each denial returns the expected error and that no data leaks through search results, included references or GraphQL queries. Record every denied request in the log alongside the allowed ones, since a policy that only passes positive tests has not been checked.
Review and promote only after sign-off
The security owner, the data owner for each affected resource type and the clinical or operations lead review the design document, the test log and any unexpected results before anything moves forward. Resolve every failed or unexpected test by changing the policy and rerunning the affected tests, not by widening access in production. Once approved, apply the same policies to production through your documented change process, then repeat a short set of allowed and denied checks there. The step is complete when the signed review, the test log and the production verification results are stored together for your audit trail.
Policy patterns for staff, Bots and client applications
Clinical staff need to read and write the records tied to their work, and little else. A least-privilege policy for this group usually starts from the resource types each role actually uses, then narrows them with property-level rules and criteria that tie access to the patient panel, care team or encounter. Read-only roles for schedulers, billing staff or auditors should be separate policies, not a flag on a broad clinician policy.
- Start from role tasks: List the resource types each role reads and writes, then grant only those. Illustrative: a front-desk role may need
AppointmentandPatientdemographics but notObservationorDiagnosticReport. - Use criteria for panel boundaries: Where the data model supports it, scope access to patients the user is linked to, such as a care team, rather than every patient in the project.
- Make read-only roles explicit: Give auditors and reporting users a policy with read access and no write or delete rights, and confirm that the policy does not inherit write access from another policy attached to the same user.
- Restrict sensitive properties: Hide or block properties that a role should not see, such as notes marked sensitive, and confirm the rule applies to search results and GraphQL responses, not only direct reads.
- Avoid shared logins: Each clinician should have an individual user with its own MFA enrollment so audit logs show who acted.
Test each role with a test account that matches it, and confirm what the account can read, create, update and delete across the resource types in scope.
Administrators configure the project, manage users and set policies, so they hold the broadest rights in the system. The least-privilege goal is to keep that set small, separate from clinical work, and tied to named people. Administrative rights should not be used for day-to-day charting, and the accounts that hold them should be few enough to review by hand.
- Separate admin and clinical accounts: An administrator who also treats patients should sign in with a second, non-admin account for routine work.
- Limit the admin group: Keep the number of accounts with project admin rights small and review membership on a fixed schedule that your governance process sets.
- Avoid broad admin scopes for integrations: Do not reuse an administrator's credential or an admin-level client for a routine integration. Create a narrower identity for that integration instead.
- Control policy changes: Treat changes to access policies as controlled changes, with a named approver and a record of what changed. Keep a copy of the previous policy so the change can be reversed.
- Protect the break-glass path: If an emergency admin account exists, store its credentials under your secrets process, enable MFA and alert on its use.
Test admin access by confirming which actions a non-admin user is refused, and by checking that a policy change appears in the audit trail with the user who made it.
Bots run server-side logic that reads and writes Medplum data without a person in the loop. Each Bot should run under its own identity with the smallest set of resource types it needs. A Bot that can read the whole project because it was easier to set up is the most common way automation widens access without anyone noticing.
- One identity per Bot: Give each Bot its own profile and access policy so that its activity is attributable and its rights can be changed without affecting other automation.
- Scope to the job: Illustrative: a Bot that writes lab results may need write access to
Observationand read access toServiceRequest, and nothing else. - Avoid shared credentials: Do not place one client secret in several pipelines or share it between a Bot and a person. Store secrets in your secrets manager and rotate them on a schedule you define.
- Keep execution settings reviewed: Changes to which Bot runs on which trigger should go through the same review as code changes, since a trigger can change what data a Bot touches.
- Watch for write amplification: A Bot triggered by writes may write back to the same resource types. Confirm the policy allows only the writes the workflow needs.
Test each Bot against a non-production project with realistic test data, and confirm that it fails on any resource type outside its policy.
Third-party and internal client applications connect to Medplum through OAuth clients, and their access is set by the client's configuration and by the policy of the profile that signs in. Server-to-server integrations usually use client credentials, while user-facing apps use a sign-in flow. Each application should have its own client and its own access policy, scoped to the data that product needs.
- One client per application: Register a separate client for each application and environment so a leaked secret affects one integration, and disable clients that are no longer used.
- Match the policy to the product: An app that displays medication lists should not hold write access to
MedicationRequest. Confirm the policy reflects the features the app ships. - Use patient or user scopes deliberately: Where apps reach patient data, confirm whether the grant is for a user or a patient context, and align the access policy with that choice.
- Limit token lifetimes: Shorter lifetimes reduce what an exposed token can reach. Set them according to your risk review and the app's needs.
- Avoid shared client secrets: Do not reuse a client secret across applications, and keep it out of front-end code.
Test each client by signing in as the app would, then attempt calls outside its intended resource types and confirm they are refused, including through search and GraphQL.
How a request is checked against Medplum access policies
The diagram starts with an identity, whether a user, a Bot or a client application, that signs in through Medplum Auth and receives a token. That token accompanies each request to the FHIR API, where the request is evaluated against the access policies that apply to the identity. The outcome is either the data the policy allows or a denial, and every decision is written to the audit trail as a separate output. When you review a design, check which policies match each identity and confirm the denial and audit behavior in your own environment before go-live.
Each request is authenticated, checked against matching policies, and logged separately.
Common policy mistakes that expose clinical data
Most exposure in a Medplum deployment comes from access policies that are broader than the role they serve, or from changes nobody tested against real user profiles. The cards below pair each common mistake with the control that prevents it and the test that catches it before go-live. Confirm each test against your own Medplum version, since policy behavior should be verified in your environment rather than assumed.
Overly broad resource access
A policy that grants read or write on a whole resource type, such as Patient or Observation, to a role that only needs a subset exposes every record of that type. The control is to scope each policy to the resource types and operations that the role's work requires, and to add criteria or compartment conditions where the role should see only some records. The test is to log in as a representative user from each role and attempt searches across resource types the role should not reach, then confirm each request is denied or returns no records.
Medplum compliance docsMissing property restrictions on sensitive fields
Granting access to a resource type often exposes fields that the role should never read, such as free-text notes, identifiers or social history. Property-level rules in an access policy can hide or block specific elements, but only when they are written explicitly. The control is to list sensitive properties for each resource type and write a rule for each one that the role must not see. The test is to read the same resource as each role and compare the returned JSON against the list of properties that role is allowed to see.
Bot and client credentials with excess rights
Bots and client applications often run under an access policy copied from an administrator or a broad integration account. Each Bot or client should have its own policy with only the resource types and operations its code calls, and its own credentials so that rotation and revocation do not affect other workloads. The test is to run each Bot or client against a sandbox project and record every request it makes, then confirm that any attempted write or search outside that list fails.
Interaction with IP rules and Binary files
An access policy that allows a resource type can behave differently once an IP rule is added to the same policy, or once Binary resources are involved, because Binary access is handled separately from compartment rules. A user may reach a file through a path the policy author did not model. The control is to review the rule order and the Binary handling in every policy that carries an IP restriction or grants file access. The test is to request the same file from inside and outside the approved network. For detail, see restricting Medplum access by IP address and securing Binary files with securityContext.
Untested policy changes
Access policies are changed during onboarding, new integrations and upgrades, and a single edited rule can widen access for every user assigned to it. Without a repeatable check, the change reaches production unnoticed. The control is to keep policies in version control or export them on every change, and to record who approved each change. The test is a regression suite that replays the role-based requests from the other cards against staging after each edit, and that fails the change if any previously denied request now succeeds. Confirm the suite runs against the same Medplum version as production.
Questions teams ask before designing Medplum access policies
Can our internal team design Medplum access policies without a partner?
Yes, many teams do, provided someone on the team understands FHIR resource types, the access policy model and how their clinical roles map to data. The harder part is usually not the policy syntax but the role inventory: deciding who needs which resource types, which properties and which patients or sites. Teams that have a clear list of roles, a named data owner for each data class and a non-production Medplum project to test in tend to finish with fewer rework cycles. A partner adds the most value when the role model is large, when policies must be reviewed by compliance staff, or when the team has no time to build a test suite. Confirm internally who will own policy changes after go-live, since that ongoing ownership is often the larger commitment.
What drives the effort of designing Medplum access policies?
Effort tracks the complexity of who needs access to what. The main drivers are the number of distinct roles, the number of FHIR resource types each role touches, how many properties need to be hidden or made read-only, and whether access depends on criteria such as a patient's care team or site. Integrations add work because Bots, client applications and machine accounts each need their own policy, and external identities such as corporate identity providers or patient sign-in add more account types to map. Each additional tenant or site multiplies the test cases. Ask any provider to break the estimate down by these drivers so you can see which ones your deployment actually has.
What do we need to provide before access policy work starts?
The work goes faster when the client supplies four inputs. First, a role inventory listing each job function, what it does in the workflow and which data it must read or change. Second, named data owners who can confirm whether a resource type, property or document category is appropriate for each role. Third, test identities for each role, ideally including at least one user who should be denied access, so negative tests can run. Fourth, a non-production Medplum project where policies can be applied and tested before they reach production. Also confirm which identity provider supplies users and which systems will act as clients or Bots, because those accounts need their own policies.
Do access policies need redesign after a Medplum upgrade?
Not always, but every upgrade should include a policy review. Medplum ships new minor and patch versions on a regular schedule, and any change to resource handling, search behavior or authentication can alter what a policy allows or blocks. The safe approach is to rerun the full policy test suite against the target version in a staging project before the upgrade reaches production, and to compare results against the previous version's expected outcomes. Self-hosted deployments must also move through each minor version in sequence, so policy tests should run at each step if the upgrade path crosses several versions. Check the Medplum versioning policy and upgrade guide before scheduling the work.
How is cost structured in a fixed-scope access policy engagement?
In a fixed-scope engagement, the written scope lists the roles, resource types, integrations, test cases and deliverables, and the quote follows from that scope. DeployOpen does not publish a price list, so the quote is the figure to compare. Costs usually fall into discovery and role mapping, policy build, test creation and execution, fixes after testing, and handover documentation. Some of these are one-time, while ongoing policy changes, retesting after upgrades and new roles recur. Ask each provider for a line-item quote, what happens if the role inventory changes mid-project, and whether retesting after an upgrade is included or priced separately.
What should we verify about our Medplum version before designing policies?
Confirm which Medplum version you run and which version you plan to run in production, because policy behavior can differ between releases. Check the Medplum versions and release policy to see the support window for your major version, and note whether security patch timing meets your internal requirements. Then confirm whether your deployment is Medplum Cloud or self-hosted, since self-hosted teams own the upgrade schedule and the test environment. If you plan a version change during the project, schedule policy testing against that version so the design is not validated against a release you will not run.
Who is responsible for compliance evidence of our access policies?
Medplum describes compliance as a shared responsibility between Medplum and its customers, so the access policy design is part of your deployment's own controls. DeployOpen prepares systems, controls and evidence for compliance assessments, including documented policies, test results and retest records, but it does not issue audit reports or certifications. Independent auditors and certification bodies make those determinations. Before the project starts, ask which assessment frameworks your organization answers to and which policy records the assessor will expect to see.
How DeployOpen designs and tests Medplum access policies
DeployOpen designs Medplum access policies under a fixed-scope engagement. Before any work starts, the scope, the deliverables and the timeline are agreed in writing, including which Medplum projects, roles, user populations and data types are covered. That written scope is the basis for a quote, so the reader should expect the cost to follow from what is listed, not from an hourly estimate. Ask for the deliverables to name each policy, each role it applies to and each test that proves it works, so the outcome can be checked later.
The design work starts from the client's own roles and data, not from a generic template. DeployOpen maps which staff, Bots and client applications need which resource types and properties, then writes the access policies that grant only those rights. Where access depends on the record itself, such as care team membership or a patient's own compartment, the design covers criteria-based rules and the reference fields they depend on. Read-only roles, Bot identities and client application logins each get their own policy so that a change to one does not silently widen another. Decisions the client must make include who approves a role, who may hold admin rights and which exceptions are acceptable.
Testing covers both the allowed and the denied paths. DeployOpen signs in with representative identities for each role, then checks what each one can read, write, search and export, and confirms that every denied action fails. Findings are delivered as a report with fixes, and DeployOpen supports a retest after policy changes, so that a later edit is checked against the same identities. The same evidence can be prepared for a compliance assessment, but DeployOpen does not issue audit reports or certifications. Independent auditors and certification bodies make that determination, and the client should confirm early which evidence its assessor expects.

