MATIH Platform is in active MVP development. Documentation reflects current implementation status.
14. Context Graph & Ontology
Security & RBAC
Role-Based Access Control

Role-Based Access Control

The Context Graph enforces fine-grained RBAC on all API endpoints using the ContextGraphAuthorizer. Permissions follow the IAM service resource:action pattern, and visibility levels dynamically filter response data based on the user's permission set.


Overview

RBAC ensures that users only see data appropriate to their role. A viewer sees aggregate trace outcomes, while an admin sees full reasoning text, token counts, and embedding details. The authorizer resolves the appropriate visibility level from the user's JWT-derived permissions.

Source: data-plane/ai-service/src/context_graph/security/authorization.py


Permissions

PermissionDescription
context_graph:traces:readRead trace summaries
context_graph:thinking:readRead detailed thinking steps
context_graph:decisions:readRead decision outcomes
context_graph:patterns:readRead discovered patterns
context_graph:metrics:readRead analytics metrics
context_graph:embeddings:readRead embedding vectors
context_graph:feedback:writeSubmit feedback signals
context_graph:patterns:manageCreate and manage patterns
context_graph:adminFull admin access
context_graph:exportExport data

Visibility Levels

Permissions map to visibility levels that control response detail:

LevelFields IncludedRequired Permissions
SUMMARYtrace_id, status, outcome, duration, timestampstraces:read
STANDARD+ session_id, actor, goal, path, cost, tagsdecisions:read
DETAILED+ thinking steps, token counts, metadatathinking:read
FULL+ API calls, embedding IDs, raw dataadmin or thinking:read + embeddings:read

Field Sets by Visibility

SUMMARY Fields

trace_id, tenant_id, status, outcome, total_duration_ms, started_at, completed_at, step_count, api_call_count

STANDARD Fields

All SUMMARY fields plus: session_id, actor_urn, goal, path_taken, model_ids_used, total_cost_usd, avg_confidence, tags

DETAILED Fields

All STANDARD fields plus: steps, total_thinking_tokens, total_input_tokens, total_output_tokens, metadata

FULL Fields

All DETAILED fields plus: api_calls, input_embedding_id, output_embedding_id, thinking_embedding_id


Sensitive Field Masking

At non-FULL visibility levels, sensitive step fields are masked:

FieldMasked At
reasoningSUMMARY and STANDARD
input_summarySUMMARY and STANDARD
output_summarySUMMARY and STANDARD

Resolution Order

The authorizer resolves visibility level using the following priority:

  1. context_graph:admin -- FULL visibility
  2. context_graph:thinking:read + context_graph:embeddings:read -- FULL visibility
  3. context_graph:thinking:read -- DETAILED visibility
  4. context_graph:decisions:read -- STANDARD visibility
  5. context_graph:traces:read -- SUMMARY visibility

Usage in API Endpoints

from context_graph.security.authorization import get_context_graph_authorizer
 
authorizer = get_context_graph_authorizer()
visibility = authorizer.get_visibility_level(user_permissions)
filtered_response = authorizer.filter_trace_response(trace_data, visibility)