Documentation Index
Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
Use this file to discover all available pages before exploring further.
Security Overview
Security is embedded into every layer of CRAFT. The security model is built on four pillars: authentication (who you are), authorization (what you can do), secrets management (protecting credentials), and multi-tenant isolation (keeping organizations separate).Security Architecture
- Authentication (AuthN)
- Secrets Management
- Multi-Tenant Isolation
Technology: Keycloak with multi-realm JWT and OIDC/PKCEKeycloak provides the identity layer for the entire platform. Each organization is a separate Keycloak realm, providing complete identity isolation between tenants.
| Feature | Details |
|---|---|
| Protocol | OpenID Connect (OIDC) with PKCE for browser clients |
| Token format | JWT containing org_id (from realm), groups, and user claims |
| Multi-realm | Each organization = one Keycloak realm (realm ID = org ID) |
| SSO support | Enterprise SSO via SAML or OIDC identity provider federation |
| Session management | Token refresh, revocation, and session timeout policies |
The
project_id is never stored in the JWT. It is passed via the X-Project-ID HTTP header or as a path parameter, allowing users to switch project context without re-authenticating.Dual Authorization Pattern
The platform enforces authorization through a dual pattern that combines database filtering with OpenFGA checks:| Operation Type | Database Filter | OpenFGA Check |
|---|---|---|
| List operations | Filter by auth.org_id + project_id | require_permission() for project access |
| Get-by-ID operations | Not needed | require_permission() handles authorization |
| Create operations | Stamp auth.org_id on resource | require_permission() for project write access |
| Delete operations | Not needed | require_permission() for resource delete access |
This dual pattern prevents two classes of vulnerabilities: (1) listing resources across organizations (database filter) and (2) accessing specific resources without permission (OpenFGA check).
Authentication Flow
User Login
The user authenticates via OIDC/PKCE flow against their organization’s Keycloak realm. The browser receives a JWT token containing
org_id and group memberships.API Request
The client includes the JWT in the
Authorization: Bearer <token> header and the active project in the X-Project-ID header.Token Validation
The Governance service validates the JWT signature, expiry, and issuer. It extracts
org_id from the realm claim.Permission Check
OpenFGA evaluates the user’s relationship to the requested resource. Computed permissions are resolved at query time based on role inheritance.
Network Security
| Control | Implementation |
|---|---|
| SSRF protection | Webhook and data connection endpoints validate target URLs against allowlists |
| HMAC signatures | Webhook payloads will be signed with HMAC for integrity verification (planned — not yet released) |
| TLS | All inter-service communication uses TLS in production |
| Private networking | Cloud deployments use private VPC networking; self-managed clusters should use equivalent network segmentation |
| Firewall rules | Terraform-managed ingress/egress rules |
Observability and Audit
The platform provides comprehensive observability for security monitoring:| Component | Technology | Purpose |
|---|---|---|
| Traces | OpenTelemetry + Tempo | Distributed request tracing across services |
| Metrics | OpenTelemetry + Mimir | Service health, latency, and throughput metrics |
| Logs | OpenTelemetry + Loki | Structured logging with correlation IDs |
| Dashboards | Grafana | Visualization and alerting for all telemetry |
All telemetry is exported via the OTLP (OpenTelemetry Protocol) standard — a vendor-neutral protocol compatible with any OTLP-capable backend. You choose your observability stack; the Grafana LGTM bundle (Loki, Grafana, Tempo, Mimir) is included by default but never required.
Security Best Practices
For Platform Operators
For Platform Operators
- Enable TLS for all ingress and inter-service communication
- Configure Keycloak password policies and brute-force detection
- Set up regular secret rotation (Infisical rotation policies or ESO + Stakater Reloader)
- Monitor OpenFGA permission check latency and error rates
- Review audit logs for unauthorized access attempts
- Use private networking for database and cache connections
For Solution Developers
For Solution Developers
- Never implement permission checks directly — always use
require_permission() - Always use
auth.org_idfrom JWT, never from request parameters - Never store secrets in configuration files or environment variables in source control
- Use the Governance SDK for all authentication and authorization operations
- Validate webhook signatures before processing events (when webhook feature is released)
- Use parameterized queries to prevent SQL injection (enforced by SQLAlchemy ORM)
Next Steps
Authentication
Deep dive into Keycloak configuration and OIDC flows.
Data Classification
Understand data classification and handling policies.
Network Security
Learn about network-level security controls and firewall configuration.
RBAC Configuration
Step-by-step guide for configuring roles and permissions.

