What has been built, and what remains.
For architecture and design, see DESIGN.md
- HTTP/HTTPS MITM proxy with TLS interception and custom CA
- Request classification (READ vs WRITE by HTTP method) for audit purposes
- SHA-256 request hashing with body/query normalization
- JSON audit log to stdout or file
- YAML configuration with sensible defaults
- Central notification dispatcher (fan-out to all registered channels)
- SSE channel for real-time browser updates with auto-reconnect
- React + TypeScript + Tailwind web UI
- Expandable audit trail with full request/response details, JSON formatting, filters
- Production binary with embedded UI; dev mode with Vite HMR
- LLM-as-judge approval: all requests evaluated against user's policy via AWS Bedrock
- Per-user LLM policy management with versioning (fork/publish model)
- Static rules (allow/deny by URL pattern) evaluated before LLM judge
- Sealed
EventDatainterface: compile-time enforcement of valid event payload types - Per-user SSE filtering: each authenticated browser session sees only its own events
- Web token auth: static pre-shared token per user stored in PostgreSQL; passed as
Authorization: Bearerheader or HttpOnlytokencookie (set server-side viaPOST /admin/login) GET /admin/meendpoint for token validation- Gateway auth tokens (
gat_prefix) for proxy authentication
- PostgreSQL-backed storage for all runtime state (audit log, users, policies)
- Database migrations managed via
internal/db/migrations/ - Evaluation system: replay audit log entries against policies to measure accuracy
- LLM response metadata persistence (
llm_responsestable) - Configurable log level (
log_levelconfig) with slog-based structured logging
- SSO/SAML/OIDC integration (replace static web tokens)
- Token rotation and expiry
- RBAC beyond admin/non-admin
internal/proxy/proxy.go,handler.go— Full HTTP/HTTPS MITM proxy, TLS interception, keep-alive, graceful shutdown; request/response payload logging at debug level via sloginternal/proxy/tls.go— Custom CA, per-host certificate generation, in-memory cert cacheinternal/approval/manager.go— Orchestrates approval flow: mode check → static rule matching → LLM judge evaluation; reads user ID and LLM policy from context
internal/judge/llm_judge.go— LLM evaluation interface; builds prompts from request context and policyinternal/llm/bedrock.go— AWS Bedrock adapter for Anthropic models with prompt cachinginternal/llmpolicy/pg_store.go— PostgreSQL policy store with CRUD, fork, publish, soft-deleteinternal/builder/— Policy agent with agentic AI loop for policy synthesisinternal/eval/— Evaluation runner: replays audit entries against policies, tracks results and stats
internal/notifications/dispatcher.go— Fans outEventto all registered channels in parallelinternal/notifications/types.go—Event{Type, Data types.EventData, Channel};EventDatais a sealed interface frompkg/typesinternal/notifications/sse.go— SSE channel;SSEClientwithuserID;TargetUserID-based event routing;ServeHTTPForUserfor authenticated clients
internal/admin/api.go—WebTokenValidatorinterface; token extraction (Bearer → cookie);GET /admin/me; user/policy/eval/audit endpoints; SSE servinginternal/admin/pg_audit_reader.go— PostgreSQL-backed audit reader with filtering and paginationinternal/admin/pg_user_store.go— User CRUD, gateway auth token management, policy assignment
internal/db/pool.go— PostgreSQL connection pool via pgxinternal/db/migrations/— Sequential SQL migrations (001–023)internal/dbtest/— Test helpers for database setup
internal/audit/logger.go— JSON structured logging; captures request headers and body; broadcasts*types.AuditEntryto dispatcher
web/src/App.tsx— Hash router withAuthProviderandRequireAuthguardweb/src/contexts/AuthContext.tsx— Auth state machine: restore token from localStorage → validate viaPOST /admin/login(sets HttpOnly cookie for SSE) →LoginPageor audit trailweb/src/components/LoginPage.tsx— Token input formweb/src/components/AuditTrail.tsx— Searchable history, expandable rows, request/response side-by-side view (landing page)web/src/components/PoliciesPanel.tsx,PolicyDetail.tsx— LLM policy list, detail, fork, publish, agent chatweb/src/components/UsersPanel.tsx,UserDetailPage.tsx— User management, policy assignmentweb/src/components/EvalsPanel.tsx,EvalDetail.tsx— Evaluation runs and resultsweb/src/components/Layout.tsx— Navigation, signed-in user + sign-outweb/src/api/client.ts— REST client with auth headersweb/src/api/sse.ts— SSE client with auto-reconnect and exponential backoff
cmd/gateway/main.go— Wires proxy, user resolver, dispatcher, SSE, audit logger, admin API, LLM judge, policy agent; configures slog log levelcmd/gateway/web_handler.go— Serves embedded or filesystem web UIcmd/gateway/cmd_create_admin_user.go— CLI subcommand to bootstrap admin users
The current web token auth is a static pre-shared secret per user stored in PostgreSQL. This is sufficient for a single-user or trusted-team deployment but is not production auth:
- No token rotation or expiry
- No SSO/SAML/OIDC integration
- No RBAC beyond admin/non-admin (all admins can manage all resources)
- No multi-tenant isolation
The admin.WebTokenValidator interface is the abstraction point for swapping in a real auth provider.