Skip to main content
Version: 1.0.0-beta

Security Architecture

Enterprise-grade security for audit data — RBAC, encryption, evidence integrity, and multi-layer protection.

Security Model

5-Layer Middleware Chain

LayerPurposeTechnology
1. CORSDomain isolationFastAPI CORSMiddleware
2. Security HeadersHSTS, CSP, X-FrameCustom middleware
3. Rate LimitingDoS protectionRedis-backed
4. CSRFRequest forgery preventionDouble-submit cookie
5. AuditImmutable loggingAuditLogEvent

Authentication

Keycloak OIDC

  • JWT tokens issued by Keycloak
  • Token validation at API gateway
  • Refresh token rotation
  • Session management

API Keys

  • For system integrations
  • Scoped permissions
  • Expiry dates
  • Revocation support

Guest Tokens

  • For PBC portal access
  • Time-limited
  • Engagement-scoped
  • No Keycloak account needed

Authorization (RBAC)

Permission Model

resource:action

Enforced at two layers:

  1. API Layer: PermissionChecker FastAPI dependency
  2. UI Layer: Frontend permission context hides unauthorized elements

SoD Enforcement

Segregation of Duties prevents:

  • Self-review of workpapers
  • Self-approval of findings
  • Conflicting role assignments

Data Isolation

Multi-Tenancy

LayerMechanism
APIOrgScopedQuery filter
DatabasePostgreSQL RLS (19 policies)
Sessionapp.current_org_id variable
StorageOrg-prefixed MinIO paths

RLS Policies

19 Row-Level Security policies enforce data isolation:

CREATE POLICY org_isolation ON engagement
USING (org_id = current_setting('app.current_org_id')::int);

Applied to all tenant-scoped tables.

Evidence Integrity

Chain of Custody

Every evidence file receives:

  • SHA-256 hash — computed on upload
  • Virus scan — ClamAV integration
  • Uploader identity — from auth context
  • Timestamp — UTC server time
  • Immutability — cannot be modified after upload

Encryption

DataMethod
Data in transitTLS 1.3
Data at restPostgreSQL encryption
API keysAES-256-GCM
License keysRS256 asymmetric
PasswordsKeycloak (bcrypt)

Audit Trail

Every CUD operation, state transition, approval, export, and AI action creates an immutable AuditLogEvent:

FieldDescription
user_idWho performed the action
actionWhat was done
resource_typeWhich entity
resource_idWhich record
detailsJSON change details
ip_addressClient IP
timestampWhen it happened

See Audit Trail for querying and compliance.