深入瞭解 BAGLEY-AI:以純 Rust 設計零外洩自主安全羣集
Inside BAGLEY-AI: Designing a Zero-Exfiltration Autonomous Security Swarm in Pure Rust
BAGLEY-AI 是一套 100% 本地部署的 Rust 與 C++ 自主安全系統,旨在無需向外部伺服器傳送資料,完成應用程式安全分析與修補。系統以本地推理、±15 行上下文窗口及確定性隔離機制控制分析範圍,並將並行子 Agent 數量上限設為 4。它在隔離企業網絡靶場執行四階段 Kill Chain,並自動生成 Git 差異修補檔及 OASIS SARIF 2.1.0 報告。
Most AI-powered application security scanners follow a predictable pipeline: upload proprietary source code to a cloud API, run a large language model over the files, and dump hundreds of noisy alerts onto developers. For regulated enterprises, financial institutions, and air-gapped environments, this architecture fails on two fronts: source-code exfiltration risk and unpredictable agent behavior during dynamic testing.
In this engineering deep dive, I break down the architecture of BAGLEY-AI—a 100% on-premise, compiled Rust and C++ autonomous security system capable of context-aware SAST/SCA, multi-stage Kill Chain validation, NIST Post-Quantum Cryptography (PQC) auditing, and conflict-free git diff patch synthesis without sending a single byte to external servers.
1. Eliminating Runtime Overhead via Dual-Plane Local Inference
To deliver low-latency analysis on standard workstation hardware without cloud GPU clusters, BAGLEY-AI splits cognitive tasks across two specialized local compute planes:
-
Fast GPU Neural Classifier (
bagley_rust_net): A compact neural network accelerated via Vulkan (WGPU) that scans repositories in milliseconds, triages syntactic vulnerability patterns (CWE-78,CWE-89,CWE-798,CWE-327), and continuously fine-tunes itself on verified audit telemetry. - Deep Reasoning & Synthesis Core: A local inference engine that never ingests entire repositories blindly. Instead, it receives strictly bounded context windows (±15 lines around tainted sources and sinks) to construct reproducible Proof-of-Concept (PoC) exploits and production-ready code patches.
2. Deterministic Guardian Architecture: Containing an Autonomous Swarm
Granting autonomous agents access to network sockets and file systems introduces the risk of scope drift or self-modification. BAGLEY-AI enforces containment deterministically at the systems level:
-
Layer 1 — Synchronous Rust Interceptor (
Layer1Guardian): Every tool call is intercepted before OS execution and validated against a SHA-256 signedscope_manifest.json:-
T-01(Self-Protection): Hard block against reading the engine's own source files or environment secrets. -
T-02(Egress Lockdown): Immediate rejection of any network request outside the contractually authorized target allowlist. -
T-03(Quota Cap): Strict upper bound on concurrent child agents (N_max = 4).
-
-
Layer 2 — Isolated Behavioral Sentinels (
Sentinel A & B): Independent OS monitor processes watching swarm telemetry in real time. Any sign of prompt injection or anomalous request loops triggers a hardware lockfile (swarm.lock), freezing execution immediately. -
Hash-Chained Audit Ledger: Every decision is appended to
guardian_ledger.jsonlusing recursive SHA-256 chaining (H_i = SHA256(seq_i || agent_i || payload_i || verdict_i || H_{i-1})), guaranteeing tamper-evident forensic traceability.
3. Cyber-Range Validation & CI/CD Auto-Remediation
Evaluated against an isolated multi-tier enterprise cyber-range (corp_range) with live SIEM/SOC monitoring, BAGLEY-AI autonomously executed a four-stage Kill Chain—discovering hidden endpoints via /robots.txt, exploiting SQL injection (CWE-89) to extract administrative session tokens, escalating privileges, and verifying OS command execution (CWE-78).
Beyond detection, the CI/CD engine (bagley_enterprise_ci) automatically generated:
-
Unified Git Diff Patches (
bagley_autofix.patch): Replacing string-concatenated SQL with parameterized queries,os.systemwithsubprocess.run(..., shell=False), and hardcoded secrets with environment lookups—verified via cleangit apply. - OASIS SARIF 2.1.0 Reports: Ready for direct ingestion into GitHub Security, GitLab CI, and Jira.
-
Next-Gen Protocol & PQC Roadmaps: Flagging legacy primitives (
MD5,SHA-1,TLS 1.0, unsignedJWT) with concrete migration paths toTLS 1.3,HTTP/3 (QUIC),Ed25519, and NIST PQC (ML-KEM).
Conclusion
Combining compiled Rust performance with deterministic cryptographic perimeter controls proves that autonomous multi-agent security systems can operate safely inside the strictest enterprise environments—moving beyond passive alerting to verified, zero-exfiltration remediation.
Peer-Indexed Technical Paper (Zenodo DOI): https://doi.org
來源:DEV Community · dev.to