Skip to main content

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​

  1. 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.
  2. Token validity only:
    • The caller must hold a valid token, and the rule's own client_role must match — that match is what selected the rule. Beyond that, nothing is checked.
  3. Almost all operations behave identically:
    • read, update, delete and search are granted with no further check. create is the one exception: a create carrying a client-supplied id that already exists is refused. See Creates that carry an id below.
  4. Role gating still applies:
    • required_role_system and required_role_code do work on a rule using this validator. Role gating is applied to the rule before the validator runs, so it is not something allowed can skip. This is the one way to narrow an allowed rule.
  5. Role gating only fires for Practitioner callers:
    • The gate is evaluated only when the rule's client_role is Practitioner. On a rule for Patient, Device or RelatedPerson, both keys are read and then ignored — no PractitionerRole lookup happens, nothing is compared, and the rule grants unconditionally. A Patient rule carrying required_role_code is not a narrower rule; it is the same rule with two inert keys on it.
allowed grants everything of that type, to every caller in that role

There 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. allowed has 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 id is unaffected and reaches no FHIR server for this check. A create carrying an id that 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.

This is not a compartment check, and it is not inherited

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:

  1. Allow patients to read public CodeSystem resources (e.g., medication unit codes).
  2. Enable practitioners to access a shared Library of clinical guidelines.

Configuration:

{
"client_role": "Practitioner",
"entity_name": "Library",
"operation": "read",
"validator": "allowed"
}

FHIR References​

  1. FHIR Observation Resource
  2. Custom Extensions Guide