Skip to main content

Immunizations Service — Security Model

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template

1. Authentication and Authorization

  • Authentication: Keycloak JWT (RS256). Every request must carry a valid Bearer token.
  • Authorization: RBAC via Keycloak realm roles + module entitlement guard (clinical.immunizations).
  • Tenant isolation: PostgreSQL RLS with app.tenant_id session variable set from JWT claim.

2. RBAC Matrix

OperationCLINICIANNURSEVACCINATION_OFFICERPATIENTADMINANALYSTDATA_MIGRATION
Record administrationYesYesYesNoNoNoNo
Record refusalYesYesYesNoNoNoNo
Amend recordYesNoYesNoNoNoNo
Correct (enter-in-error)YesNoNoNoYesNoNo
Import historicalYesNoNoNoNoNoYes
View own recordsYesYesYesOwnYesNoNo
View forecastYesYesYesOwnYesNoNo
Add contraindicationYesNoNoNoNoNoNo
View defaultersNoNoYesNoYesNoNo
Coverage reportNoNoNoNoYesYesNo
Generate certificateYesNoNoOwnNoNoNo
Registry sync adminNoNoNoNoYesNoNo

3. Encryption

Data classAt restIn transit
Immunization recordsAES-256 (PostgreSQL TDE or volume encryption)TLS 1.3
Lot numbersNot classified as PII; standard encryptionTLS 1.3
Digital certificate JWTSigned (RS256); not encryptedTLS 1.3
NATS event payloadsEncrypted at rest on JetStream volumeTLS 1.3

4. PII and Sensitive Fields

FieldClassificationMasking rule
patientIdPIIResolved to name only for VACCINATION_OFFICER in defaulter list
performerIdPIIVisible to ADMIN and CLINICIAN only
lotNumberClinical dataNo masking; visible to clinical roles
notesPIIVisible to clinical roles; hidden from ANALYST

5. Audit Events

All state-changing operations write to the platform audit log with:

  • eventType (e.g., IMMUNIZATION_RECORDED, IMMUNIZATION_CORRECTED, CONTRAINDICATION_ADDED)
  • actorId, actorRole, tenantId, patientId, resourceId, timestamp
  • changeDetails (diff of changed fields for amendments)

Audit records are immutable and retained for 7 years per MoPH data retention policy.

6. Data Residency

  • All immunization data must reside within the Afghanistan MoPH-approved data centre jurisdiction.
  • National registry sync data may transit to the national registry endpoint over a secured government network connection only.
  • Cloud deployments must apply data residency constraints in Kubernetes NodeAffinity rules.

7. GDPR / Patient Rights

RightImplementation
Right to accessGET /v1/immunizations?patientId= for patient-owned records
Right to rectificationPUT /v1/immunizations/:id (clinical correction, not patient self-service)
Right to erasureNot applicable for clinical records (legal hold under MoPH mandate); pseudonymization on platform delete request
Right to portabilityGET /fhir/R4/Immunization export; digital certificate endpoint

8. Module Entitlement Guard

Requests to immunizations-service endpoints are rejected with 403 MODULE_NOT_ENTITLED if the tenant's Keycloak realm does not include the clinical.immunizations entitlement scope.