AS215932/soc-agent
GitHub: AS215932/soc-agent
一个只读安全治理代理,持续检测网络安全态势漂移与攻击路径,并将安全的修复方案移交工程团队执行,永不直接变更生产环境。
Stars: 0 | Forks: 0
# hyrule-soc-agent
AS215932 的 **SOC Agent** —— [NOC Agent](../hyrule-noc-agent) 和 [Engineering Loop](../engineering-loop) 的安全侧兄弟项目。它是一个持续运行的*安全治理循环*,其核心问题是**“面对有能力的攻击者,网络是否具备可防御性、可观测性和弹性?”**——而不是“它是否健康?”。
SOC Agent 的职责:
- **分诊** 将安全信号转化为带类型的 `SecurityCase`(夜班分析师角色)。
- **主动** 将期望的安全状态(`network-operations` 仓库 + 黄金清单)与实时遥测数据(Hyrule MCP,只读)进行差异对比,以暴露控制漂移和攻击路径(`SecurityFinding`)。
- **建模** 攻击路径 (RT-0),并针对已知拥有的资产运行非侵入式只读验证 (RT-1)。
- **移交** 安全、可审查的修复方案给 Engineering Loop,通过 **LHP-v1** 以 `loop:candidate` GitHub issue 的形式提交——并在修复发布后**验证**其效果。
## 核心策略(不可协商)
它永远不会启用 `HYRULE_MCP_ENABLE_ACTIONS`,永远不会生成已签名的 MCP `action_authorization`,也永远不会应用 `loop:approved`(这始终由人类 / Reliability-Governor 把关)。合并和生产部署仍通过 `network-operations` 的分支保护和 `production` GitHub Environment 由人工把关。
## 发布阶梯 (`SOC_MODE`)
`shadow` → `case_only` → `handoff_dry` → `handoff_live`。每一个层级都是前一个层级副作用的严格超集。启用过程是一个刻意的、人工把关的爬升过程,由实时的只读 shadow canary 进行把关。
| 模式 | 扫描 | 打开 `SecurityCase` | 构建 LHP 移交 | 打开 `loop:candidate` issue |
|------|:-:|:-:|:-:|:-:|
| `shadow` | ✅ (仅报告) | — | — | — |
| `case_only` | ✅ | ✅ | — | — |
| `handoff_dry` | ✅ | ✅ | ✅ (无 POST) | — |
| `handoff_live` | ✅ | ✅ | ✅ | ✅ |
## 目录结构
```
app/
config.py SOC_* settings (env > TOML > default; all off/shadow)
lhp.py VENDORED verbatim from noc app/cases/lhp.py (wire contract)
cases/ SecurityCase substrate (models, store, service, policy, verifier)
posture/ proactive read-only scanner + LHP handoff + verifier close-loop
graph/ + agents/ LangGraph SOC-commander + PydanticAI security specialists
redteam/ RT-0 attack-path modeling + RT-1 read-only validation
mcp_runtime.py SOC read-only MCP tool allowlists (no mutating tools)
main.py FastAPI: LHP-v1 origin endpoints (fetch + signed callback) + /health
socctl.py local CLI: status, posture run-once, posture verify
agent_core_trace.py best-effort agent-core TraceEvent emission
docs/soc-agent/ architecture, security-scope, posture-checks, redteam-safety, rollout
```
## 运行方式
```
socctl status # print effective SOC settings
socctl posture run-once --shadow # one read-only scan cycle (the shadow canary)
socctl posture verify # re-read live telemetry for cases awaiting verification
soc-agent # serve the FastAPI LHP endpoints (SOC_AGENT_HOST/PORT)
```
Engineering Loop 从 `GET /loop-handoff/v1/soc/handoffs/{id}` 获取移交任务,并向 `POST /webhook/engineering-loop/handoff-update` 报告进度——两者均使用 `SOC_LHP_ENGINEERING_SECRET` 进行 HMAC 签名。
有关架构和红队安全策略,请参阅 `docs/soc-agent/`;有关如何运行测试套件,请参阅 `TESTING.md`。
标签:CI/CD安全, Llama, 只读检测, 安全态势, 安全运营, 扫描框架, 攻击路径建模, 自动化巡检, 逆向工具