Skip to main content

PicoShogun Banner

PicoShogun — Command Centre for the Pico Security Series

CI PyPI Python Tests License: BUSL-1.1 Buy Me A Coffee

Command centre, firewall, and monitoring for the Pico Security Series. FastAPI + SQLite + Python 3.12.

Product Purpose Repo
PicoSentry L2 Supply-chain scanner KirkForge/PicoSentry
PicoDome L3/L4 Runtime sandbox KirkForge/PicoDome
PicoShogun Command centre & firewall KirkForge/PicoShogun
PicoWatch L5-L7 LLM defense KirkForge/PicoWatch

Status

Pre-1.0 beta. Active development started late May 2026. The core API, auth, middleware stack, and orchestration work. The frontend dashboard is functional but rough. Several features are honest limitations — see STATE.md and GAPS.md for what's real vs. aspirational.

Quick Start

# Setup
bash scripts/setup.sh
source .venv/bin/activate

# Start API
python -m uvicorn api.server:app --reload

# Or use the entrypoint
picoshogun
# (shogun also works as backward compat alias)

Environment Variables

Primary prefix is PICOSHOGUN_*. SHOGUN_* works as backward compat.

Variable Default Description
PICOSHOGUN_ENV development Environment (development/production)
PICOSHOGUN_SECRET_KEY required in production JWT signing key — assert_secure() refuses boot with default
PICOSHOGUN_CORS_ORIGINS http://localhost:8765 Comma-separated CORS origins
PICOSHOGUN_DDOS_SHIELD false Enable DDoS shield
PICOSHOGUN_DB_PATH picoshogun.db SQLite database path
PICOSHOGUN_API_PORT 8765 API listen port
PICOSHOGUN_AUDIT_RETENTION_DAYS 90 Audit log retention period

See .env.example for the full list.

Features

  • 12-layer middleware stack: SecurityHeaders → RequestID → RequestSizeLimit → DDoSShield → GZip → CORS → CORSHardening → RateLimit → Audit → Timeout → HTTPS → DocsRestriction
  • Rate limiting: Per-IP (100/min) + per-org (1000/min) with SQLite persistence
  • JWT + API keys + RBAC: 18 permissions across viewer/operator/admin roles, API key rotation, expired key cleanup
  • Audit log management: Per-severity retention, purge API, dry-run support
  • Graceful shutdown: SIGTERM/SIGINT handlers for Kubernetes pod termination
  • Pico Series Orchestration: Run PicoSentry, PicoDome, and PicoWatch via the orchestrator
  • Intelligence Engine: 16-pattern threat extraction with FP filtering and correlation
  • Alert Hub: Multi-channel alerts (Discord webhook, Slack/Email/Syslog)
  • Metrics: Prometheus-compatible with built-in collection
  • Scheduler: Cron-based job scheduling
  • Backup/Restore: Compressed archives with retention
  • Event Bus: Pub/sub with WebSocket real-time streaming
  • Plugin system: Dynamic loading with Ed25519 signed manifest verification

Security

Startup Validation

PicoShogun refuses to boot in production with insecure defaults. The assert_secure() check runs on startup and enforces:

  • No default secret key — PICOSHOGUN_SECRET_KEY must be set; the default is rejected in production
  • No wildcard CORS — PICOSHOGUN_CORS_ORIGINS must list explicit origins in production
  • No wildcard allowed hosts — PICOSHOGUN_ALLOWED_HOSTS must be explicit in production
  • No debug mode — PICOSHOGUN_DEBUG=false in production

Override with PICOSHOGUN_SKIP_SECURE_ASSERT=1 (not recommended; only for CI/testing).

TLS Termination

PicoShogun does not terminate TLS itself. It expects to run behind a reverse proxy (nginx, Caddy, cloud load balancer) that handles TLS.

Plugin Trust Boundary

The plugin system loads Python modules from the plugins/ directory at runtime. This directory is a trust boundary equivalent to giving someone a shell on the server. Plugin code runs in-process with full access to the runtime, database, and network.

Token Auth

JWT (PyJWT) for authentication. The legacy simple-token format has been removed — it used non-timing-safe comparison and lacked expiration claims.

Architecture

api/server.py              # FastAPI REST API + WebSocket + Dashboard (248 lines)
api/routers/                # 12 router modules
config/settings.py         # Dataclass config from env vars (PICOSHOGUN_*)
config/project_registry.json  # Pico series project definitions
database/manager.py        # Thread-safe SQLite WAL + migrations + ConnectionPool interface
services/auth.py           # JWT + API keys + RBAC + expiration enforcement
services/orchestrator.py   # Pico series tool runner with concurrency control
services/intelligence.py   # 16-pattern threat engine with FP filtering
services/alert_hub.py      # Multi-channel alerts
services/rbac.py           # 18 permissions, 3 roles
middleware/                # 12-layer middleware stack
plugins/                  # Dynamic plugin loading + signed manifests

See STATE.md for the full architecture diagram.

API Endpoints

Base URL: http://localhost:8765

Method Path Auth Description
GET /health — Full health check (readiness)
GET /health/live — Liveness probe
GET /health/ready — Readiness probe (DB connected)
GET /status Bearer System status
GET /projects Bearer+Org List projects
POST /projects/{id}/run Bearer+Org Trigger project run
GET /intelligence Bearer Intelligence signals
GET /audit/stats Bearer Audit statistics + retention
POST /audit/purge Admin Purge audit logs
POST /auth/api-key/{id}/rotate Bearer Rotate API key
DELETE /auth/api-key/{id} Bearer Revoke API key
GET /api/v1/scans Bearer Supply chain scans
POST /api/v1/sandboxes Bearer+Operator Sandbox execution
WS /ws Optional Real-time event stream

Full endpoint list in STATE.md.

Testing

python -m pytest tests/ -v                    # Main tests (170+)
ruff check .                                    # Lint

Docker

docker build -t picoshogun:latest .
docker run -d -p 8765:8765 \
  -e PICOSHOGUN_SECRET_KEY=your-production-secret \
  -e PICOSHOGUN_ENV=production \
  -e PICOSHOGUN_CORS_ORIGINS=https://app.example.com \
  picoshogun:latest

License

Business Source License 1.1 (BUSL-1.1) — source-available; production use allowed except for competitive offerings. Commercial use that competes with KirkForge's paid products requires a separate commercial license. After 3 years, converts to Apache-2.0. See LICENSE, LICENSE-SUMMARY.md, and COMMERCIAL-LICENSE.md.

Metadata

Release files for picoshogun 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for picoshogun 1.0.1
File Size Uploaded
picoshogun-1.0.1.tar.gz 110.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for picoshogun 1.0.1
File Interpreter ABI Platform
picoshogun-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 226.8 kB

Release files / picoshogun-1.0.1.tar.gz

Download URL picoshogun-1.0.1.tar.gz
Size 110.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3317d71d7039577db1ff47910e9509c8863a1d22f07e0b380ff3f47ec173f2e4
BLAKE2b-256 checksum
How to use checksums
3461c16127afb13d2b098c61547509be4aedeec656401e2c7306f6b440cc66a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / picoshogun-1.0.1-py3-none-any.whl

Download URL picoshogun-1.0.1-py3-none-any.whl
Size 115.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f158e4a97a7e3b55ac54a58c45b387bf32f9e1fd0b3c9c57ebe01647914c4d9a
BLAKE2b-256 checksum
How to use checksums
8d280e529f352eacbb49f0d72863184385770cdea71cd925c12cdac4e68d2da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page