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.
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: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
1
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.2
API Request
The client includes the JWT in the
Authorization: Bearer <token> header and the active project in the X-Project-ID header.3
Token Validation
The Governance service validates the JWT signature, expiry, and issuer. It extracts
org_id from the realm claim.4
Permission Check
OpenFGA evaluates the user’s relationship to the requested resource. Computed permissions are resolved at query time based on role inheritance.
5
Request Processing
If authorized, the request proceeds with the authenticated context. Database queries are scoped to
org_id and project_id.Network Security
Observability and Audit
The platform provides comprehensive observability for security monitoring: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.

