Reference implementation of GCAP-SPEC-SHELLBOUND-BROKER-0001
in FastAPI. Designed for ISVs and enterprises implementing
the governed shell authorization protocol.
Architecture:
FastAPI + SQLModel + Pydantic + async SQLite
Single container deployment: Dockerfile included
OpenAPI schema at /docs is the machine-readable GSAP contract
Broker Interface (§5):
POST /governance/authorize/ — Issue AC
GET /governance/authorize/{p}/ — Poll elevation
POST /governance/complete/ — Receive CR
GET /governance/session/{id}/ — View chain of custody
POST /governance/elevate/ — JIT elevation
GET /governance/drivers/ — List drivers
Identity Driver Interface (§2.2):
IdentityDriver — abstract base (ISV extension point)
KeycloakDriver — Keycloak implementation
DriverRegistry — driver lookup and registration
Chronicle integration (§1.4):
Optional CloudEvents emission via CHRONICLE_WEBHOOK_URL
Forgejo push event format for receiver compatibility
Models:
Pydantic schemas for AC, CR, Principal, Accord, Operation
SQLModel DB models for persistence
Tests: 6 async tests including full AC→CR cycle
695 lines across 27 files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
758 B
TOML
31 lines
758 B
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "fastapi-gsap"
|
|
version = "0.1.0"
|
|
description = "Lightweight FastAPI GSAP broker — GCAP-SPEC-SHELLBOUND-BROKER-0001"
|
|
requires-python = ">=3.11"
|
|
dependencies = [
|
|
"fastapi>=0.111.0",
|
|
"uvicorn[standard]>=0.29.0",
|
|
"pydantic>=2.7.0",
|
|
"pydantic-settings>=2.2.0",
|
|
"httpx>=0.27.0",
|
|
"python-jose[cryptography]>=3.3.0",
|
|
"sqlmodel>=0.0.19",
|
|
"aiosqlite>=0.20.0",
|
|
"structlog>=24.1.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "httpx>=0.27", "ruff>=0.4", "pytest-mock>=3.14"]
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py311"
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests"]
|