https://github.com/apathy-ca/sark
Zero-trust gateway for AI systems. OPA policies, audit logging, authentication (OIDC/LDAP/SAML), MCP/HTTP/gRPC adapters. FastAPI + Rust extensions. Production-ready.
https://github.com/apathy-ca/sark
ai-governance api-gateway audit-logging authentication authorization fastapi llm-security mcp model-context-protocol opa policy-engine python rust security zero-trust
Last synced: 12 days ago
JSON representation
Zero-trust gateway for AI systems. OPA policies, audit logging, authentication (OIDC/LDAP/SAML), MCP/HTTP/gRPC adapters. FastAPI + Rust extensions. Production-ready.
- Host: GitHub
- URL: https://github.com/apathy-ca/sark
- Owner: apathy-ca
- License: mit
- Created: 2025-11-20T04:29:04.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-05-24T06:06:36.000Z (16 days ago)
- Last Synced: 2026-05-24T08:11:56.534Z (15 days ago)
- Topics: ai-governance, api-gateway, audit-logging, authentication, authorization, fastapi, llm-security, mcp, model-context-protocol, opa, policy-engine, python, rust, security, zero-trust
- Language: Python
- Homepage: https://github.com/apathy-ca/sark/blob/main/docs/QUICK_START.md
- Size: 41.4 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
- Governance: docs/governance/HOME_GOVERNANCE.md
- Roadmap: docs/ROADMAP.md
- Copyright: COPYRIGHT
Awesome Lists containing this project
README
# 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](docs/QUICK_START.md)** | **[Changelog](CHANGELOG.md)** | **[Full Documentation](docs/)**
---
## 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?](docs/MCP_INTRODUCTION.md)** | **[Architecture](docs/ARCHITECTURE.md)** | **[Use Cases](docs/USE_CASES.md)**
---
## Quick Start
**Prerequisites:**
- Python 3.11+
- Rust 1.92+ ([install Rust](https://rustup.rs/)) - Required for building native extensions
```bash
# 1. Clone and setup
git clone --recurse-submodules
cd sark
# If you already cloned without --recurse-submodules:
# git submodule update --init
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:**
- π **[15-Minute Quick Start](docs/QUICK_START.md)** - Complete getting started guide
- π» **[Development Guide](docs/DEVELOPMENT.md)** - Development workflow and standards
- π **[Tutorials](tutorials/)** - Step-by-step examples
- π **[API Reference](docs/API_REFERENCE.md)** - Complete API documentation
---
## 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](docs/FEATURES.md)** | **[Security](docs/SECURITY.md)** | **[Performance](docs/PERFORMANCE.md)**
---
## 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
```bash
cd frontend && npm install && npm run dev
# Access: http://localhost:5173
```
π **[UI User Guide](docs/UI_USER_GUIDE.md)** | **[UI Deployment](docs/DEPLOYMENT.md#ui-deployment)**
---
## Deployment
### Development
```bash
docker compose --profile full up -d
```
### Production
```bash
# 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:
```bash
# 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](docs/deployment/HOME_DEPLOYMENT.md)** | **[Policy Cookbook](docs/policies/POLICY_COOKBOOK.md)**
### Enterprise Deployment
Full-featured deployment with PostgreSQL, Redis, and external OPA:
```bash
# Kubernetes with Helm
helm install sark ./helm/sark -n production --create-namespace
```
π **[Deployment Guide](docs/DEPLOYMENT.md)** | **[Terraform Guide](terraform/README.md)** | **[Production Readiness](docs/PRODUCTION_READINESS.md)**
---
## Documentation
### Getting Started
- **[Quick Start](docs/QUICK_START.md)** - 15-minute setup
- **[MCP Introduction](docs/MCP_INTRODUCTION.md)** - What is MCP?
- **[Architecture](docs/ARCHITECTURE.md)** - System design
- **[Use Cases](docs/USE_CASES.md)** - Real-world examples
### Deployment & Operations
- **[Deployment Guide](docs/DEPLOYMENT.md)** - Production deployment
- **[Monitoring](docs/MONITORING.md)** - Observability setup
- **[Operations Runbook](docs/OPERATIONS_RUNBOOK.md)** - Day-2 operations
### Development
- **[Development Guide](docs/DEVELOPMENT.md)** - Setup and workflow
- **[API Reference](docs/API_REFERENCE.md)** - Complete API docs
- **[Contributing](CONTRIBUTING.md)** - Contribution guidelines
### Security & Compliance
- **[Security Guide](docs/SECURITY.md)** - Security best practices
- **[OPA Policy Guide](docs/OPA_POLICY_GUIDE.md)** - Policy authoring
- **[Audit & Compliance](docs/AUDIT_COMPLIANCE.md)** - Compliance features
π **[Full Documentation Index](docs/README.md)**
---
## 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](docs/ROADMAP.md)** | **[Changelog](CHANGELOG.md)**
---
## 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](docs/REQUIREMENTS.md)**
---
## 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](docs/specifications/GRID_GAP_ANALYSIS_AND_IMPLEMENTATION_NOTES.md)** - Detailed compliance matrix
π **[GRID Specification](docs/specifications/GRID_PROTOCOL_SPECIFICATION_v0.1.md)** | **[Gap Analysis](docs/specifications/GRID_GAP_ANALYSIS_AND_IMPLEMENTATION_NOTES.md)**
---
## 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](https://github.com/apathy-ca/yori) 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 (`grid-opa`, `grid-cache`) via PyO3 bindings, bringing enterprise-grade policy evaluation to resource-constrained home routers.
π **[YORI Repository](https://github.com/apathy-ca/yori)** | **[Project Plan](docs/v2.0/YORI_PROJECT_PLAN.md)**
---
## Contributing
We welcome contributions! See **[CONTRIBUTING.md](CONTRIBUTING.md)** for:
- Code style and standards
- Development workflow
- PR process
- Multi-agent collaboration guidelines
---
## License
MIT License - see **[LICENSE](LICENSE)** file for details.
**Copyright** Β© 2025 James Henry. All rights reserved.
---
**Built with β€οΈ for enterprise AI governance at scale.**