allowed Validator Documentation
allowed Validator Documentation
Unrestricted Access for Public or Trusted Resources
Intent
The allowed validator grants access to a resource or operation without any ownership or compartment check. Use this sparingly for public-facing data (e.g., read-only reference tables) or debugging scenarios.
⚠️ Security Note: Avoid using this validator for sensitive resources (e.g., Patient, Observation).
Key Features
- No compartment or reference checks:
- Performs no ownership test of any kind, and does not inspect the caller's relationship to the resource. The one thing it reads from the payload is
id, for the create check below.
- Performs no ownership test of any kind, and does not inspect the caller's relationship to the resource. The one thing it reads from the payload is
- Token validity only:
- The caller must hold a valid token, and the rule's own
client_rolemust match — that match is what selected the rule. Beyond that, nothing is checked.
- The caller must hold a valid token, and the rule's own
- Almost all operations behave identically:
read,update,deleteandsearchare granted with no further check.createis the one exception: acreatecarrying a client-suppliedidthat already exists is refused. See Creates that carry anidbelow.
- Role gating still applies:
required_role_systemandrequired_role_codedo work on a rule using this validator. Role gating is applied to the rule before the validator runs, so it is not somethingallowedcan skip. This is the one way to narrow anallowedrule.
- Role gating only fires for
Practitionercallers:- The gate is evaluated only when the rule's
client_roleisPractitioner. On a rule forPatient,DeviceorRelatedPerson, both keys are read and then ignored — noPractitionerRolelookup happens, nothing is compared, and the rule grants unconditionally. APatientrule carryingrequired_role_codeis not a narrower rule; it is the same rule with two inert keys on it.
- The gate is evaluated only when the rule's
allowed grants everything of that type, to every caller in that roleThere is no residual scoping. A Patient / Observation / read / allowed rule lets every patient in the project read every Observation in it, including other patients' — the compartment plays no part. On a write it is stronger still, because writes have no post-filter to fall back on.
The single exception is the create-with-id refusal described below, and it is a refusal of one specific shape — not a compartment check and not a substitute for one.
Reach for allowed when the resource genuinely carries no patient-specific data — terminology, questionnaires, clinical guidelines — and where it is broad on purpose, say so in a comment next to the rule so the next reader does not have to guess whether it was chosen or inherited.
Note also that an allowed rule does not override a restrictive rule on the same triple for the same callers. Every matching rule must pass, so an allowed rule sitting beside a forbidden one grants nothing. The one way two rules on a triple grant different things is by naming different practitioner roles: see Several roles on one triple.
Creates that carry an id
A create whose payload carries an id that already names a resource of that type is denied, with:
Create denied: a resource with this id already exists. Use update to modify an existing resource.
This exists because the FHIR write path upserts: a create naming an existing id is a full replace of that resource, not a create. Without the refusal, create / allowed would be an unconditional overwrite primitive over every id of that type — a strictly stronger grant than the rule names.
Three properties are worth knowing before you rely on it:
- It is an existence check, not an ownership check.
allowedhas no compartment, so there is no "does this belong to the caller" question it could ask. It asks only whether the id is already taken. - A create with no
idis unaffected and reaches no FHIR server for this check. A create carrying anidthat turns out to be free does issue one lookup, gets "no such row", and proceeds. - It fails closed. If the existence lookup cannot be completed, the create is refused rather than allowed through.
update is deliberately untouched. An unscoped replace of the one row the caller names is exactly what update / allowed says, and id is required on every update mutation, so it cannot turn into a different operation.
The refusal stops a create from overwriting an existing resource. It does nothing about a create that invents a new id, and nothing about who may read or replace what afterwards. If you need ownership enforced, use a compartment validator — allowed still grants everything else of that type to everyone in that role.
The guard lives inside this validator, not above rule matching, so it is not a platform-wide property you can rely on elsewhere. Other validators answer the same question differently: the compartment validators permit a create-with-id onto a row that already references the caller, and legitimate_interest checks it on some of its internal rules and not others. See how a request is decided.
Example Configuration
Shared reference data
{
"client_role": "Patient",
"entity_name": "Questionnaire",
"operation": "read",
"validator": "allowed"
}
Effect: any authenticated caller with the Patient role can read all Questionnaire resources in the project. That is appropriate here because a questionnaire definition is a form, not a patient's answers — the answers live in QuestionnaireResponse, which should stay compartment-scoped.
Use Case: Reference Data Exposure
A telehealth app uses this validator to:
- Allow patients to read public
CodeSystemresources (e.g., medication unit codes). - Enable practitioners to access a shared
Libraryof clinical guidelines.
Configuration:
{
"client_role": "Practitioner",
"entity_name": "Library",
"operation": "read",
"validator": "allowed"
}