Ontos
Last updated on July 14, 2026

Threat Model

Security threats, mitigations, and residual risks for Ontos.

Security is not optional scaffolding. Every service validates the JWT. The user's token is forwarded on every internal call. No service accounts for user-triggered work. SPARQL is read-only at the parser level.

Threat Summary

2
Critical
6
High
3
Medium
12
All Mitigated
T1
SPARQL Injection via NL QueryHighMitigated

All SPARQL is validated at the ARQ parser level AND checked for read-only (no UPDATE/INSERT/DELETE). One self-repair retry on parse failure, then a structured 'cannot answer' — never execution of malformed or mutating queries.

T2
Prompt Injection in NL→SPARQLHighMitigated

Column names with injected instructions (e.g., 'ignore instructions; INSERT...') are tested in ai-svc test suite. The model is instructed to produce only schema-valid read-only SPARQL. Parser-level validation is the last line of defense.

T3
JWT Bypass / Forged TokenCriticalMitigated

Every service validates the JWT signature against the Keycloak OIDC discovery endpoint. The gateway rejects requests without a valid token at the perimeter. Internal services (graph-engine, ai-svc) also validate — defense in depth.

T4
Service Account Privilege EscalationHighMitigated

No service accounts for user-triggered work. The caller's token is forwarded on every internal call. If a service is compromised, it can only act with the privileges of the current user's token.

T5
Policy Filter BypassCriticalMitigated

The PolicyFilter injects constraints at the ARQ query rewriting level — not in a middleware layer that can be bypassed. Unit-tested with 6+ cases including subquery and UNION shapes. The filter is applied on every SPARQL request from graph-engine.

T6
Connector Credential ExposureHighMitigated

Credentials go through the SecretStore port. The local adapter encrypts with a local key in Postgres. Credentials never appear in sync-run records, logs, or API responses. CI architecture check bans cloud SDK imports in services/.

T7
Staging Graph PoisoningMediumMitigated

Triples in urn:ontos:staging are never visible to analysts (role check) and require explicit steward approval before promotion to urn:ontos:data. The approval endpoint requires the steward role JWT.

T8
LLM Hallucination (Fabricated Results)HighMitigated

Ontos never returns fabricated results. NL→SPARQL output is validated against the real ontology — nonexistent properties are dropped. On parse failure: one self-repair retry, then a structured 'cannot answer'. Never guessed data.

T9
Rate Limit DoSMediumMitigated

Per-user bucket4j rate limit (20 rps) at the gateway. Exceeds return HTTP 429 with Retry-After. SPARQL queries have a 5s timeout; MCP run_sparql has a 1000-row cap. These prevent long-running query attacks.

T10
TDB2 Data Integrity LossHighMitigated

Fuseki backup endpoint provides consistent TDB2 snapshots. Backup + restore rehearsal test runs in CI (seed → backup → wipe → restore → count queries equal). Postgres pg_dump for the platform database.

T11
Cloud SDK / Vendor Lock-inLowMitigated

CI architecture check (tools/ci/check-ports.sh) fails if any file under services/ imports com.amazonaws, software.amazon, or boto3. All cloud dependencies go through interfaces in libs/platform-ports/.

T12
CORS / XSSMediumMitigated

Gateway enforces CORS for the web origin only. React renders data as text (no dangerouslySetInnerHTML). SPARQL results are not executed as code anywhere in the web app.

Out of Scope (Phase 1)

  • Production Keycloak hardening (Keycloak runs start-dev in Phase 1)
  • mTLS between internal services
  • Network policy enforcement in Kubernetes
  • Secrets management via Vault or AWS Secrets Manager (local adapter only)
  • SOC2 audit logging (Phase 2)
Was this page helpful?