Skip to main content

Open-source High-performance authorization engine for RBAC, ReBAC, and ACL. Multi-tenant policy engine

Project description

KeyNetra Logo

KeyNetra animated typing banner

CI Release Docker Hub Python License OpenAPI

KeyNetra

Policy-driven authorization control plane for applications that need deterministic, explainable access decisions across RBAC, ACL, and ReBAC.

What KeyNetra Provides

  • Authorization engine with deterministic evaluation and explain traces
  • FastAPI API server and operational CLI
  • Multi-tenant policy evaluation with strict tenancy controls
  • Policy lifecycle operations (validation, compile, simulation, impact analysis)
  • Caching and access indexing for low-latency checks
  • Structured logging, metrics, and dashboard-ready monitoring
  • Deployment assets for Docker, Kubernetes, and Helm

Architecture

Layering is enforced through import contracts:

  • keynetra.api -> transport only
  • keynetra.services -> orchestration and runtime flow
  • keynetra.engine -> pure policy decision logic
  • keynetra.domain -> shared models/schemas
  • keynetra.infrastructure -> repositories, storage, cache adapters
  • keynetra.config -> configuration loading and guardrails

Detailed architecture notes: ARCHITECTURE.md

Quick Start (Local)

1) Setup

python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pip install -e .
cp .env.example .env

2) Run API

keynetra serve --host 0.0.0.0 --port 8080

3) Health and Docs

curl -i http://localhost:8080/health/ready
open http://localhost:8080/docs

4) First Authorization Check

curl -s -X POST http://localhost:8080/check-access \
  -H "Content-Type: application/json" \
  -H "X-API-Key: devkey" \
  -H "X-Tenant-Id: acme" \
  -d '{
    "user": {"id": "u1", "role": "admin"},
    "action": "read",
    "resource": {"resource_type": "document", "resource_id": "doc-1"},
    "context": {}
  }'

CLI Usage

Entrypoint is standardized to keynetra:

keynetra --help
keynetra check-openapi
keynetra migrate --confirm-destructive
keynetra doctor --service core

API Surface (Core)

  • POST /check-access
  • POST /check-access-batch
  • POST /simulate
  • POST /simulate-policy
  • POST /impact-analysis
  • GET /health, GET /health/ready, GET /metrics

OpenAPI contracts:

Multi-Tenant and Security

  • Tenant-aware request flow and storage isolation
  • Strict tenancy mode available via KEYNETRA_STRICT_TENANCY=true
  • API key and JWT auth support
  • Admin auth flow for privileged operations
  • Rate limiting and request correlation IDs

See SECURITY.md for security policy and reporting.

Observability and Monitoring

KeyNetra exposes Prometheus metrics at GET /metrics including:

  • HTTP request count/latency/error metrics
  • Authorization decision and stage latency metrics
  • Cache hit/miss metrics
  • DB query latency metrics
  • Tenant activity dimensions

Monitoring assets:

Deployment

Docker

docker build -t keynetra:test .
docker run --rm -p 8080:8080 --env-file .env keynetra:test

Docker Compose (Full Dev/Obs Stack)

docker compose up --build

Includes:

  • KeyNetra API
  • PostgreSQL
  • Redis
  • Prometheus
  • Grafana
  • node-exporter
  • Loki

Kubernetes

kubectl apply -f deploy/kubernetes/

Helm

helm install keynetra ./deploy/helm/keynetra

More deployment detail: DEPLOYMENT.md

SDKs

SDKs are maintained separately from this engine repository.

  • Python SDK package: keynetra-client
  • SDK guide: SDK_GUIDE.md

Example (Python SDK):

from keynetra_client import KeyNetraClient

client = KeyNetraClient("http://localhost:8080")
decision = client.check_access(
    user={"id": "alice"},
    action="read",
    resource={"type": "document", "id": "doc-1"},
)
print(decision.allowed)

Developer Workflow

ruff check .
black --check .
pytest
lint-imports --config .importlinter

Convenience commands are available in Makefile.

Documentation Index

Contributing

Contributions are welcome. Start with CONTRIBUTING.md and CODE_OF_CONDUCT.md.

License

Apache-2.0. See LICENSE.

Citation

@software{keynetra_2026,
  title   = {KeyNetra},
  author  = {KeyNetra Community},
  year    = {2026},
  version = {0.1.1-beta},
  url     = {https://github.com/keynetra/keynetra}
}

Made with love ❤️ for KeyNetra Community.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keynetra-0.1.1.tar.gz (128.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keynetra-0.1.1-py3-none-any.whl (142.3 kB view details)

Uploaded Python 3

File details

Details for the file keynetra-0.1.1.tar.gz.

File metadata

  • Download URL: keynetra-0.1.1.tar.gz
  • Upload date:
  • Size: 128.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keynetra-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b87a45c936a0fa7ed7bd5a2ecf92d5a49ffce9b791db6ef642d0870d76c0dd36
MD5 24f0453a667586177db5153df6f3b1b1
BLAKE2b-256 42f4de960f6ef43b2a74660fd41042a883f6a5d6c84cdeed67025f8b072ca639

See more details on using hashes here.

Provenance

The following attestation bundles were made for keynetra-0.1.1.tar.gz:

Publisher: release.yml on KeyNetra/keynetra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keynetra-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: keynetra-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 142.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keynetra-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01efeb4328969c0ab12a070bcb6e685c502e1c1bb3ce675604dd30f856cf78b8
MD5 c79fa7297995c9e03a7048e2e4cfda41
BLAKE2b-256 a1a0b53b2fef6c52f8f976c3826b94f8542f4ed414e2135e267ef45b5578b375

See more details on using hashes here.

Provenance

The following attestation bundles were made for keynetra-0.1.1-py3-none-any.whl:

Publisher: release.yml on KeyNetra/keynetra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page