Skip to main content

Command centre for the Pico Security Series — security orchestration, firewall, and monitoring

Project description

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 keyPICOSHOGUN_SECRET_KEY must be set; the default is rejected in production
  • No wildcard CORSPICOSHOGUN_CORS_ORIGINS must list explicit origins in production
  • No wildcard allowed hostsPICOSHOGUN_ALLOWED_HOSTS must be explicit in production
  • No debug modePICOSHOGUN_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.

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

picoshogun-1.0.1.tar.gz (110.9 kB view details)

Uploaded Source

Built Distribution

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

picoshogun-1.0.1-py3-none-any.whl (115.9 kB view details)

Uploaded Python 3

File details

Details for the file picoshogun-1.0.1.tar.gz.

File metadata

  • Download URL: picoshogun-1.0.1.tar.gz
  • Upload date:
  • Size: 110.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for picoshogun-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3317d71d7039577db1ff47910e9509c8863a1d22f07e0b380ff3f47ec173f2e4
MD5 fc7f128fdd5549fb4e902a364ea13d95
BLAKE2b-256 3461c16127afb13d2b098c61547509be4aedeec656401e2c7306f6b440cc66a6

See more details on using hashes here.

File details

Details for the file picoshogun-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: picoshogun-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 115.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for picoshogun-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f158e4a97a7e3b55ac54a58c45b387bf32f9e1fd0b3c9c57ebe01647914c4d9a
MD5 954d2bd66c2ee93fd4bfb51abc6800cc
BLAKE2b-256 8d280e529f352eacbb49f0d72863184385770cdea71cd925c12cdac4e68d2da8

See more details on using hashes here.

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