Architecture Role
The Gateway serves as the data plane in Sigilum’s architecture:- Gateway (Data Plane): Enforces approved claims, injects credentials, proxies requests
- API (Control Plane): Manages authorization state and identity
- SDK Layer: Signs requests and verifies authorization
Core Features
Request Signature Verification
Verifies RFC 9421 signed requests:signature-inputandsignatureheaderssigilum-namespace,sigilum-subject,sigilum-agent-key,sigilum-agent-cert- Content digest validation for request bodies
- Ed25519 signature algorithm
Nonce Replay Protection
- In-memory nonce tracking per namespace
- 5-minute replay window
- Returns
AUTH_REPLAY_DETECTEDfor duplicate nonces
Approved Claims Enforcement
- Queries Sigilum API approved claims feed (
/v1/namespaces/claims) - Local cache with configurable TTL and refresh interval
- Validates
<namespace, public_key, service>tuple - Auto-submits authorization requests for unapproved agents (rate-limited)
Connector Credential Management
- Encrypted local storage (BadgerDB)
- Multiple auth modes: Bearer, custom header, query parameter
- Shared credential variables with
{{KEY}}references - Credential rotation tracking with grace periods
- Strips Sigilum signing headers before upstream forwarding
MCP Protocol Support
Native support for Model Context Protocol:- Protocol:
mcp(vshttpfor standard REST APIs) - Streamable HTTP transport
- Tool discovery with caching (TTL + stale-if-error)
- Subject-level tool filtering policies
- Circuit breaker for upstream failures
- Bounded retry behavior for transient errors
Error Handling
Structured error envelope for all failures:Deployment
The Gateway is built in Go and designed for local, single-instance operation.System Requirements
- Go 1.21+
- BadgerDB for local storage
- Network access to Sigilum API
- Optional: Envoy for local ingress
Installation
Docker Compose
Local-Only Design
The gateway is not production-ready for multi-instance deployments:- Nonce replay protection is process-local (resets on restart)
- Connector secrets stored in local BadgerDB
- No distributed lock/state coordination
- No HA or multi-node consistency guarantees
- Admin routes are for trusted local environments
API Surface
Canonical schema:apps/gateway/openapi.yaml
Health Endpoints
Proxy Endpoints (Runtime)
Admin Endpoints
Connection Management
Connection Management
Credential Variables
Credential Variables
Service Catalog
Service Catalog
Configuration
The Gateway uses environment variables for configuration.Core Configuration
Core Environment Variables
Core Environment Variables
Claims Cache
Claims Cache Configuration
Claims Cache Configuration
REFRESH_SECONDS and considers cached claims fresh for TTL_SECONDS.MCP Configuration
MCP Environment Variables
MCP Environment Variables
Rate Limiting
Rate Limit Configuration
Rate Limit Configuration
connection_id + namespace pair.Timeouts
Timeout Configuration
Timeout Configuration
Admin Access Control
Admin Access Configuration
Admin Access Configuration
hybrid: Allow loopback OR valid admin token (default)loopback: Allow loopback only (most secure for local dev)token: Require admin token (for remote access)
Credential Rotation
Rotation Configuration
Rotation Configuration
block mode, overdue connections return ROTATION_REQUIRED error.Logging
Logging Configuration
Logging Configuration
- Auth decisions (signature, nonce, claim)
- Admin access decisions
- Runtime requests
- Upstream decisions
- Secret-bearing fields replaced with
[redacted] - Identity fields hashed to stable fingerprints
- Client IPs masked (
/24for IPv4,/64for IPv6)
Development Bypass (Unsafe)
Development Bypass Configuration
Development Bypass Configuration
Request Flow
HTTP Protocol (Standard REST APIs)
MCP Protocol
refresh=auto(default): Use cache if fresh or stale-if-errorrefresh=force: Bypass cache and refresh discovery
Connection Types
HTTP Connections
bearer: InjectAuthorization: Bearer <token>headerheader_key: Custom header name + valuequery_param: Add?KEY=VALUEquery parameter
MCP Connections
- Connection-level
mcp_tool_allowlist(if set) - Connection-level
mcp_tool_denylist(if set) - Subject-level policy (if
sigilum-subjectmatches a policy key) - Default: Allow all discovered tools
Shared Credential Variables
created_by_subject for audit traceability.
CLI Tools
The gateway includes a local CLI for direct connection management:GATEWAY_DATA_DIR(default:$XDG_DATA_HOME/sigilum-gateway)GATEWAY_MASTER_KEY(required; can be passed via--master-key)
Auth Failure Codes
The gateway returns deterministic auth failure codes:| Code | Description |
|---|---|
AUTH_HEADERS_INVALID | Duplicate or malformed signed headers |
AUTH_SIGNATURE_INVALID | RFC 9421 signature verification failed |
AUTH_SIGNED_COMPONENTS_INVALID | Signed component list doesn’t match required profile |
AUTH_IDENTITY_INVALID | Missing or invalid Sigilum identity headers |
AUTH_NONCE_INVALID | Signature nonce missing or malformed |
AUTH_REPLAY_DETECTED | Nonce already seen within replay window |
AUTH_CLAIMS_UNAVAILABLE | Gateway claim cache is unavailable |
AUTH_CLAIMS_LOOKUP_FAILED | Claim cache lookup failed |
AUTH_CLAIM_REQUIRED | Caller not approved for requested service |
AUTH_CLAIM_SUBMIT_RATE_LIMITED | Auto-claim registration rate-limited |
AUTH_FORBIDDEN | Generic auth denial |
ROTATION_REQUIRED | Connection credentials are overdue for rotation |
Metrics
Prometheus-style metrics atGET /metrics:
Dashboard Pairing
For managed/enterprise deployments, use gateway pairing to connect local gateway to hosted dashboard:- List/create/update/delete connections
- Test connections
- Run MCP discovery
- Rotate credentials
Pairing Modes
Related Documentation
- API - Control plane
- CLI - Local development tools
- SDK Reference - Client libraries
- Error Codes - Gateway error taxonomy