Skip to content
/ sark Public

Zero-trust gateway for AI systems. OPA policies, audit logging, authentication (OIDC/LDAP/SAML), MCP/HTTP/gRPC adapters. FastAPI + Rust extensions. Production-ready.

License

Notifications You must be signed in to change notification settings

apathy-ca/sark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

364 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SARK (Security Audit and Resource Kontroler)

Enterprise-Grade Multi-Protocol AI Governance Platform

"He's not any kind of user, SARK, he's a program." β€”MCP, probably

SARK provides zero-trust governance for AI deployments at scale. Built for Model Context Protocol (MCP), with support for MCP, HTTP/REST, gRPC, and custom protocols through a universal adapter interface.

Target Scale: 50,000+ employees, 10,000+ AI resources

πŸ“– Quick Start | Changelog | Full Documentation


What is This?

The Problem: AI assistants accessing enterprise systems (databases, APIs, cloud infrastructure) without governance creates security chaosβ€”no visibility, no control, no audit trail.

The Solution: SARK sits between AI and your systems, providing:

  • πŸ” Authentication - OIDC, LDAP, SAML, API Keys
  • πŸ›‘οΈ Authorization - Policy-based access control (OPA)
  • πŸ“Š Audit - Complete trail of every AI action
  • ⚑ Performance - <100ms p95 latency, 847 req/s sustained

Example: Developer asks AI "Show P0 bugs for my team" β†’ AI uses MCP β†’ SARK validates auth & policy β†’ If approved, executes β†’ Logs everything.

πŸ“– What is MCP? | Architecture | Use Cases


Quick Start

Prerequisites:

  • Python 3.11+
  • Rust 1.92+ (install Rust) - Required for building native extensions
# 1. Clone and setup
git clone <repository-url>
cd sark
python3.11 -m venv venv && source venv/bin/activate
pip install -e ".[dev]"

# 2. Build Rust extensions
maturin develop

# 3. Start services
docker compose --profile full up -d

# 4. Access UI and API
# UI: http://localhost:5173 (admin/password)
# API: http://localhost:8000/docs

Next Steps:


Features

Multi-Protocol Support

  • MCP - SSE and HTTP transports functional (stdio in development)
  • HTTP/REST - OpenAPI discovery, 5 auth strategies
  • gRPC - Reflection-based, mTLS support
  • Custom - Plugin system for any protocol

Enterprise Security (v1.3.0 Enhanced)

  • Authentication - OIDC, LDAP, SAML, API Keys
  • Authorization - OPA policy engine, ReBAC+ABAC
  • Audit - Immutable logs, SIEM integration (Splunk, Datadog)
  • Federation - Cross-organization governance with mTLS
  • πŸ†• Prompt Injection Detection - 20+ patterns, entropy analysis, 30x faster
  • πŸ†• Anomaly Detection - Behavioral baselines, real-time alerts
  • πŸ†• Secret Scanning - 25+ patterns, automatic redaction, 50x faster
  • πŸ†• MFA - TOTP/SMS/Push/Email for critical actions
  • πŸ†• Network Controls - Kubernetes policies, egress filtering

Production Ready

  • βœ… 64% test coverage (improving to 85%), 1 low-severity vulnerability (Windows-only, dev dependency)
  • βœ… <100ms p95 latency, 847 req/s sustained throughput
  • βœ… Kubernetes-native, Helm charts, Terraform modules
  • βœ… 100+ pages of documentation

πŸ“– Features Overview | Security | Performance


Web UI

Modern React UI for managing AI governance:

  • πŸ“Š Dashboard with metrics
  • πŸ–₯️ Server/resource management
  • πŸ“ Policy editor (Rego syntax)
  • πŸ“œ Audit log viewer
  • πŸ”‘ API key management
cd frontend && npm install && npm run dev
# Access: http://localhost:5173

πŸ“– UI User Guide | UI Deployment


Deployment

Development

docker compose --profile full up -d

Production

# Kubernetes with Helm
helm install sark ./helm/sark -n production --create-namespace

# Or with kubectl
kubectl apply -f k8s/

Cloud Platforms

  • AWS EKS, GCP GKE, Azure AKS
  • Terraform modules included for all platforms

Home Deployment (v1.7.0)

Lightweight deployment for home networks and low-resource environments:

# Quick start with Docker
make home-up

# Or with Docker Compose directly
docker compose -f docker-compose.home.yml up -d
  • Target: 512MB RAM, single core
  • Database: SQLite (instead of PostgreSQL)
  • Platform: OPNsense plugin or Docker
  • Features: Family governance (bedtime, parental controls, cost limits)

πŸ“– Home Deployment Guide | Policy Cookbook

Enterprise Deployment

Full-featured deployment with PostgreSQL, Redis, and external OPA:

# Kubernetes with Helm
helm install sark ./helm/sark -n production --create-namespace

πŸ“– Deployment Guide | Terraform Guide | Production Readiness


Documentation

Getting Started

Deployment & Operations

Development

Security & Compliance

πŸ“š Full Documentation Index


Project Status

πŸš€ v1.7.0 - Current Release (Released Feb 2, 2026)

New in v1.7.0 - YORI Home Deployment:

  • βœ… Home Deployment Profile - 512MB RAM, single-core target for home networks
  • βœ… Governance Modules - Allowlist, time rules, emergency override, consent tracking
  • βœ… Policy Templates - Bedtime, parental controls, privacy, cost limits
  • βœ… Analytics Services - Token tracking, cost calculation, usage reporting
  • βœ… OPNsense Plugin - Web UI dashboard, service management, policy configuration
  • βœ… Comprehensive Tests - Unit, integration, and OPA policy tests

v1.6.0 - Polish & Validation:

  • βœ… Security Hardening - 96% vulnerability remediation (24/25 CVEs fixed)
  • βœ… Test Infrastructure - 39 tests fixed, 100% pass rate for export + tools routers
  • βœ… Dependency Cleanup - Eliminated ecdsa, migrated to PyJWT[crypto]
  • βœ… Bug Fixes - Keyword detection for snake_case, FastAPI route ordering
  • βœ… Documentation - Comprehensive release notes, migration guides

v1.5.0 - Production Readiness:

  • βœ… Gateway Transport Implementations (HTTP, SSE, stdio)
  • βœ… Security Fixes (LDAP injection, CSRF, credentials)
  • βœ… Frontend Authentication UI (Login, MFA, API key management)
  • βœ… E2E Integration Tests (Complete user flow testing)
  • βœ… Performance Benchmark Infrastructure (Locust, pytest-benchmark)

v1.4.0 - Rust Foundation:

  • βœ… Embedded Rust OPA engine (4-10x faster policy evaluation)
  • βœ… Rust in-memory cache (10-50x faster than Redis)
  • βœ… Feature flags & gradual rollout (0% β†’ 100% with instant rollback)
  • βœ… 2.4x higher throughput (2,100+ req/s)
  • βœ… 2.3x faster requests (42ms p95, down from 98ms)
  • βœ… 100% backwards compatible with v1.3.0
  • βœ… Automatic Python fallback for safety
  • βœ… Comprehensive migration and performance documentation

Completed (v1.3.0):

  • βœ… Enterprise authentication (OIDC, LDAP, SAML, API Keys)
  • βœ… Policy-based authorization (OPA)
  • βœ… MCP Gateway integration (opt-in)
  • βœ… SIEM integration (Splunk, Datadog)
  • βœ… Prompt injection detection (20+ patterns, 30x faster than target)
  • βœ… Behavioral anomaly detection (30-day baseline, real-time alerts)
  • βœ… Secret scanning & redaction (25+ patterns, 50x faster than target)
  • βœ… MFA for critical actions (TOTP, SMS, Push, Email)
  • βœ… Network security controls (NetworkPolicies, egress filtering)
  • βœ… Comprehensive testing (350+ unit, 530+ integration, 2200+ performance)
  • βœ… Complete documentation (100+ pages)
  • βœ… Production deployment guides

Future Roadmap:

  • v1.8.0 - OPNsense plugin submission to official repository
  • v1.9.0 - Local LLM support (Ollama integration)
  • v2.0.0 - GRID Reference Implementation (protocol abstraction, federation, cost attribution)

πŸ“– Roadmap | Changelog


Requirements

  • Python 3.11+
  • Docker with Docker Compose v2
  • PostgreSQL 15+, Valkey 7+ (Redis-compatible)
  • Open Policy Agent 0.60+
  • Kong Gateway 3.8+ (production)
  • Kubernetes 1.28+ (production)

πŸ“– Requirements


GRID Protocol

SARK is the reference implementation of GRID Protocol Specification v0.1.

GRID (Governed Resource Interaction Definition) is a universal governance protocol for machine-to-machine interactionsβ€”protocol-agnostic, federated, zero-trust, policy-first.

SARK v1.1.0 Compliance: 85% of GRID v0.1 specification

πŸ“– Gap Analysis - Detailed compliance matrix

πŸ“– GRID Specification | Gap Analysis


Related Projects

YORI - Home LLM Gateway (Integrated in v1.7.0)

YORI (Your Observant Router Intelligence) provides zero-trust LLM governance for home networks. As of v1.7.0, YORI's home deployment profile is integrated directly into SARK.

Deployment Options:

  • SARK Home Profile - Use make home-up or the OPNsense plugin (recommended)
  • Standalone YORI - See YORI repository for standalone builds

Features:

  • Target: OPNsense routers, home users (512MB RAM, 1 CPU)
  • Database: SQLite (lightweight, no external dependencies)
  • Policies: Bedtime rules, parental controls, privacy protection, cost limits
  • Governance: Allowlist, time-based rules, emergency override, consent tracking
  • Analytics: Token tracking, cost estimation, usage reports

YORI reuses SARK's battle-tested Rust core (sark-opa, sark-cache) via PyO3 bindings, bringing enterprise-grade policy evaluation to resource-constrained home routers.

πŸ“– YORI Repository | Project Plan


Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Code style and standards
  • Development workflow
  • PR process
  • Multi-agent collaboration guidelines

License

MIT License - see LICENSE file for details.

Copyright Β© 2025 James Henry. All rights reserved.


Built with ❀️ for enterprise AI governance at scale.