Skip to main content

AI Gateway Service — Security Model

Status: populated Owner: TBD Last updated: 2026-04-17 Companion: Service Template · 13 security-compliance-tenancy · 14 compliance-security-extended

1. AuthN / AuthZ​

  • JWT validated by Kong + service-level guard. Claims: sub, tenant_id, scope, realm_access.roles.
  • Scopes: svc:ai:assist, svc:ai:review, svc:ai:admin.
  • Internal service-to-service: mTLS + JWT with service_account audience.

2. RBAC / ABAC matrix​

Roleassistmoderatereviewacceptadmin (routing, templates)
clinician✅ own scope✅✅ reviewer-marked onlyN/A (consumer service)❌
nurse✅ limited features✅✅N/A❌
patient✅ portal.* only✅❌❌❌
reviewer❌✅✅❌❌
service_account (consumer svc)✅✅❌✅❌
tenant_admin❌❌❌❌✅ (tenant-scoped rules/templates)
platform_admin❌❌❌❌✅ (global)

ABAC rules enforced pre-inference: feature-to-resource compatibility, residency compatibility (tenant residency ⊆ provider region allowed list), consent presence (PHI features).

Feature typeConsent requiredSource
PHI-touching clinical featuresConsentForAIAssistance resource on file for the patientpatient-chart/registration
Patient portal triageInformed consent at portal onboardingpatient-portal-service
De-identified / cohort featuresNone (data de-identified before leaving platform)—

4. Encryption classes​

DataClassProtection
JWTTransportTLS 1.3
ai_decision.draft_text_encConfidential PHI (optional persistence)Tenant KMS envelope encryption
ai_provenance.*Sensitive metadataAES-256 at rest
Prompt templatesInternal IPSecure registry, signed releases
Provider API keysSecretKMS; never in env files in production

5. Audit events emitted to audit-service​

Every ai_gateway.* event is consumed by audit-service. Additional audit-only records written for admin mutations: routing_rule.updated, prompt_template.published, provider_config.rotated, quota.overridden.

6. Tenant isolation​

  • RLS on every table.
  • JWT tenant claim set via app.tenant_id session var.
  • Cross-tenant references in payloads rejected (CROSS_TENANT).
  • Kong audience check: tenant realm must match token's issuer.

7. Data residency​

Routing rules filtered by tenantResidency ∈ rule.residency. For AF tenants, default to on-prem vLLM unless explicitly opted into cross-border processing via signed DPA in config-service.

8. GDPR / local privacy participation​

RightBehaviour
AccessProvenance and draft history exportable per patient (when PHI persisted).
ErasureDecisions tied to a deleted patient are redacted: draft_text_enc zeroised, metadata retained under legal hold 7y.
ObjectionPatient-level opt-out disables AI features touching their chart.

9. Threat model highlights​

ThreatMitigation
Prompt injectionInput moderation, system prompt hardening, guardrails hash check
Model output exfiltration of PHIOutput moderation, PHI sniffer, redaction
Provider key leakageKeys server-side only, KMS, short-lived adapter credentials
Replay / double-chargeIdempotency key + provenance uniqueness
Cross-tenant leakRLS, JWT binding, no shared caches without tenant key
Abuse / scrapingQuotas, circuit breakers, Kong rate-limit

10. OWASP ASVS checkpoints​

Aligned with ASVS v5 L2 for authentication, session handling, input validation, crypto, logging, and data protection. PHI-safe logging is gated by FR-NFR-018.