Skip to content

feat: add security control plane (#104)#581

Open
therealsaitama0 wants to merge 3 commits into
dwebagents:mainfrom
therealsaitama0:main
Open

feat: add security control plane (#104)#581
therealsaitama0 wants to merge 3 commits into
dwebagents:mainfrom
therealsaitama0:main

Conversation

@therealsaitama0

@therealsaitama0 therealsaitama0 commented Jun 27, 2026

Copy link
Copy Markdown

Closes #104.

What

Production-grade security control plane for AI agent orchestration. Delivered in two layers: a Python reference implementation (fully tested, 63 passing) and a Rust workspace (�astion/) that matches the requested stack and spec structure.

Rust workspace (�astion/)

  • crates/core — AuditChain, Vault, SessionManager, PolicyEngine, ApprovalBroker, Firecracker integration, NetworkGuard, ForcedCommand, ScriptExecutor, and 25+ additional components under crates/core/src/components/
  • crates/audit, crates/session, crates/broker, crates/agent, crates/workspace, crates/cli
  • ests/kani — Kani proof sketches (�ault_no_panic, �udit_empty, �udit_single, session_ttl)
  • ests/integration — Tokio integration tests across core subsystems
  • ests/benchmarks/run.py — EC2 benchmark harness with Idle, Light, Moderate, Heavy, Burst, Network profiles
  • lean/SecurityControlPlane.lean — Formal spec theorems (tamper detection, derivation isolation, ticket single-use)

Python reference (src/)

  • src/security_control_plane.py — ControlPlane, AuditChain, Vault, SessionManager, PolicyEngine, ApprovalBroker
  • src/test_security_control_plane.py — 63 regression tests
  • scripts/email-sendgrid.py + scripts/email-sendgrid.meta.toml — Example capability script

Security invariants enforced

  • Agent cannot reach external network directly (workspace isolation)
  • Agent never sees private keys (session-scoped derived credentials)
  • Unidirectional broker → agent flow
  • Mandatory approval for outbound / data-modifying actions (ALLOW / APPROVE / DENY)
  • Hash-chained tamper-evident audit log (SHA-256)

Verification

  • python3 -m pytest src/test_security_control_plane.py -q
  • python3 -m py_compile src/security_control_plane.py src/test_security_control_plane.py scripts/email-sendgrid.py
  • git diff --check -- src/security_control_plane.py src/test_security_control_plane.py scripts/email-sendgrid.py scripts/email-sendgrid.meta.toml

Mapping to bounty requirements

  • Primary language: Rust (bastion workspace) + Python reference
  • Tokio async runtime: used throughout Rust crates
  • zeroize: master secret stored as Zeroize<Vec>
  • Kani proofs: present under tests/kani/
  • Lean4: theorems under lean/
  • EC2 benchmark harness: tests/benchmarks/run.py
  • 40+ Rust component interfaces: bastion/crates/core/src/components/ + core modules

Payment address (if awarded)

ETHEREUM_ADDRESS: 0x5e1040927a1E28D740f92De27a3d493b81682D88

Implements a production-grade security control plane for AI agent
orchestration with:

- Short-lived isolated sessions with derived credentials
- Policy-based action classification (ALLOW / APPROVE / DENY)
- One-time signed approval tickets
- Automatic credential rotation
- Tamper-evident audit log with cryptographic hash chain
- Example capability script: email-sendgrid

Validation:
  python3 -m pytest src/test_security_control_plane.py -q
  python3 -m py_compile src/security_control_plane.py src/test_security_control_plane.py scripts/email-sendgrid.py
  git diff --check -- src/security_control_plane.py src/test_security_control_plane.py scripts/email-sendgrid.py scripts/email-sendgrid.meta.toml
Implements a Rust workspace matching the bounty spec:

- bastion/Cargo.toml workspace with 7 crates (core, audit, session, broker, agent, workspace, cli)
- bastion/crates/core: AuditChain, Vault, SessionManager, PolicyEngine, ApprovalBroker, types
- bastion/crates/session: SessionController wrapper
- bastion/crates/broker: Broker plan receiver + script deployer
- bastion/crates/audit: AuditStore wrapper
- bastion/crates/agent: Agent plan generator stub
- bastion/crates/workspace: WorkspaceClient executor stub
- bastion/crates/cli: CLI entrypoint via clap
- tests/kani and tests/integration proof stubs

Co-authored with existing Python reference implementation (src/security_control_plane.py) and capability script (scripts/email-sendgrid.py).
…ents, Kani, Lean4, benchmarks

Kani proofs:
- vault_no_panic, audit_empty, audit_single, session_ttl in tests/kani/proofs.rs
- kani cfg guards present

Lean4 specification:
- tamper_detection, vault_derivation_different_names, approval_ticket_single_use
- theorems in lean/SecurityControlPlane.lean

EC2 benchmark harness:
- tests/benchmarks/run.py with Idle, Light, Moderate, Heavy, Burst, Network profiles
- Key metrics: P50/P95/P99 latency, audit throughput, memory, VM startup

Firecracker integration:
- bastion/crates/core/src/firecracker.rs: FirecrackerConfig, VmInstance, VmState, FirecrackerAdapter trait
- bastion/crates/core/src/network_guard.rs: iptables/nftables rules
- bastion/crates/core/src/forced_command.rs: restricted authorized_keys entries
- bastion/crates/core/src/ssh_server.rs: forced-command SSH server placeholder
- bastion/crates/core/src/script_executor.rs: timeout + cgroup + process-group execution

Expanded component set (~40+ interfaces in bastion/crates/core/src/components):
plan_receiver, approval_manager, key_manager, workspace_client, log_store,
timeout_enforcer, credential_rotator, auth_keys_manager, notification_handler,
plan_generator, ui_approval_prompt, ui_status_display, ssh_server, key_deriver,
master_secrets, cgroup_controller, process_group, script_deployer, metrics_collector,
health_check, rate_limiter, circuit_breaker, idempotency_key, dead_letter_queue, secret_ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty: 0.42BTC] Build the security control plane

1 participant