An open API service indexing awesome lists of open source software.

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.

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.**