seismoscope 0.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. seismoscope-0.9.1/LICENSE +21 -0
  2. seismoscope-0.9.1/PKG-INFO +473 -0
  3. seismoscope-0.9.1/README.md +431 -0
  4. seismoscope-0.9.1/agents/audit_agent.py +1462 -0
  5. seismoscope-0.9.1/agents/recon_agent.py +620 -0
  6. seismoscope-0.9.1/agents/regression_agent.py +464 -0
  7. seismoscope-0.9.1/agents/remediation_agent.py +568 -0
  8. seismoscope-0.9.1/agents/surface_agent.py +396 -0
  9. seismoscope-0.9.1/agents/verification_agent.py +923 -0
  10. seismoscope-0.9.1/api/__init__.py +5 -0
  11. seismoscope-0.9.1/api/server.py +1170 -0
  12. seismoscope-0.9.1/api/state_store.py +264 -0
  13. seismoscope-0.9.1/core/__init__.py +3 -0
  14. seismoscope-0.9.1/core/agent_runtime/__init__.py +54 -0
  15. seismoscope-0.9.1/core/agent_runtime/completion.py +238 -0
  16. seismoscope-0.9.1/core/agent_runtime/context.py +160 -0
  17. seismoscope-0.9.1/core/agent_runtime/graph.py +134 -0
  18. seismoscope-0.9.1/core/agent_runtime/guard.py +58 -0
  19. seismoscope-0.9.1/core/agent_runtime/loop.py +538 -0
  20. seismoscope-0.9.1/core/agent_runtime/react.py +320 -0
  21. seismoscope-0.9.1/core/agent_runtime/resume.py +92 -0
  22. seismoscope-0.9.1/core/agent_runtime/retry.py +50 -0
  23. seismoscope-0.9.1/core/agent_runtime/state_machine.py +196 -0
  24. seismoscope-0.9.1/core/agent_runtime/stop_hooks.py +37 -0
  25. seismoscope-0.9.1/core/agent_runtime/task.py +106 -0
  26. seismoscope-0.9.1/core/agent_runtime/tool_guard.py +106 -0
  27. seismoscope-0.9.1/core/agents/__init__.py +1 -0
  28. seismoscope-0.9.1/core/agents/base.py +427 -0
  29. seismoscope-0.9.1/core/agents/registry.py +257 -0
  30. seismoscope-0.9.1/core/audit/__init__.py +18 -0
  31. seismoscope-0.9.1/core/audit/candidate_cluster.py +169 -0
  32. seismoscope-0.9.1/core/audit/finding_cluster.py +389 -0
  33. seismoscope-0.9.1/core/audit/lanes.py +35 -0
  34. seismoscope-0.9.1/core/audit/models.py +142 -0
  35. seismoscope-0.9.1/core/audit/protocol_analysis.py +720 -0
  36. seismoscope-0.9.1/core/audit/react_discovery.py +514 -0
  37. seismoscope-0.9.1/core/audit/react_review.py +549 -0
  38. seismoscope-0.9.1/core/audit/review_budget.py +101 -0
  39. seismoscope-0.9.1/core/audit/scanner_signals.py +159 -0
  40. seismoscope-0.9.1/core/audit/standards_map.py +67 -0
  41. seismoscope-0.9.1/core/audit/target_planner.py +172 -0
  42. seismoscope-0.9.1/core/cache.py +259 -0
  43. seismoscope-0.9.1/core/deployment/__init__.py +5 -0
  44. seismoscope-0.9.1/core/deployment/manager.py +315 -0
  45. seismoscope-0.9.1/core/harness/__init__.py +24 -0
  46. seismoscope-0.9.1/core/harness/gates.py +75 -0
  47. seismoscope-0.9.1/core/harness/models.py +1478 -0
  48. seismoscope-0.9.1/core/harness/return_protocol.py +43 -0
  49. seismoscope-0.9.1/core/harness/trigger_policy.py +5 -0
  50. seismoscope-0.9.1/core/harness/vrtm.py +275 -0
  51. seismoscope-0.9.1/core/languages/__init__.py +0 -0
  52. seismoscope-0.9.1/core/languages/tree_sitter_gateway.py +164 -0
  53. seismoscope-0.9.1/core/llm_errors.py +29 -0
  54. seismoscope-0.9.1/core/llm_service.py +603 -0
  55. seismoscope-0.9.1/core/orchestrator/__init__.py +1 -0
  56. seismoscope-0.9.1/core/orchestrator/orchestrator.py +1515 -0
  57. seismoscope-0.9.1/core/plugin/__init__.py +30 -0
  58. seismoscope-0.9.1/core/plugin/base.py +210 -0
  59. seismoscope-0.9.1/core/plugin/loader.py +112 -0
  60. seismoscope-0.9.1/core/policy/__init__.py +6 -0
  61. seismoscope-0.9.1/core/policy/closure_policy.py +18 -0
  62. seismoscope-0.9.1/core/policy/trigger_policy.py +215 -0
  63. seismoscope-0.9.1/core/reasoning/__init__.py +1 -0
  64. seismoscope-0.9.1/core/reasoning/reasoning_guard.py +354 -0
  65. seismoscope-0.9.1/core/remediation/__init__.py +8 -0
  66. seismoscope-0.9.1/core/remediation/approval.py +163 -0
  67. seismoscope-0.9.1/core/remediation/skill_relay.py +362 -0
  68. seismoscope-0.9.1/core/remediation/tree_snapshot.py +109 -0
  69. seismoscope-0.9.1/core/reporting/__init__.py +1 -0
  70. seismoscope-0.9.1/core/reporting/output_formatter.py +533 -0
  71. seismoscope-0.9.1/core/runtime/__init__.py +1 -0
  72. seismoscope-0.9.1/core/runtime/browser_executor.py +228 -0
  73. seismoscope-0.9.1/core/runtime/docker_executor.py +335 -0
  74. seismoscope-0.9.1/core/runtime/permission_policy.py +242 -0
  75. seismoscope-0.9.1/core/sanitization.py +97 -0
  76. seismoscope-0.9.1/core/session/__init__.py +6 -0
  77. seismoscope-0.9.1/core/session/models.py +168 -0
  78. seismoscope-0.9.1/core/session/store.py +78 -0
  79. seismoscope-0.9.1/core/surface/__init__.py +17 -0
  80. seismoscope-0.9.1/core/surface/risk_chain.py +466 -0
  81. seismoscope-0.9.1/core/surface/runtime_surface.py +1418 -0
  82. seismoscope-0.9.1/core/surface/threat_model.py +1277 -0
  83. seismoscope-0.9.1/core/tool_fabric/__init__.py +66 -0
  84. seismoscope-0.9.1/core/tool_fabric/artifacts.py +191 -0
  85. seismoscope-0.9.1/core/tool_fabric/container.py +175 -0
  86. seismoscope-0.9.1/core/tool_fabric/dependency_inspection.py +458 -0
  87. seismoscope-0.9.1/core/tool_fabric/dependency_vulnerabilities.py +367 -0
  88. seismoscope-0.9.1/core/tool_fabric/framework_semantics.py +506 -0
  89. seismoscope-0.9.1/core/tool_fabric/gateway.py +246 -0
  90. seismoscope-0.9.1/core/tool_fabric/image_preflight.py +141 -0
  91. seismoscope-0.9.1/core/tool_fabric/models.py +202 -0
  92. seismoscope-0.9.1/core/tool_fabric/registry.py +62 -0
  93. seismoscope-0.9.1/core/tool_fabric/scanner_adapters.py +809 -0
  94. seismoscope-0.9.1/core/tool_fabric/semantic_javascript.py +341 -0
  95. seismoscope-0.9.1/core/tool_fabric/semantic_source.py +318 -0
  96. seismoscope-0.9.1/core/tool_fabric/semantic_typescript.py +329 -0
  97. seismoscope-0.9.1/core/tool_fabric/source_tools.py +766 -0
  98. seismoscope-0.9.1/core/verification/__init__.py +41 -0
  99. seismoscope-0.9.1/core/verification/authorization.py +156 -0
  100. seismoscope-0.9.1/core/verification/environment_runtime.py +330 -0
  101. seismoscope-0.9.1/core/verification/poc_protocol.py +478 -0
  102. seismoscope-0.9.1/core/verification/react_review.py +642 -0
  103. seismoscope-0.9.1/core/verification/service_runtime.py +201 -0
  104. seismoscope-0.9.1/core/verification/types.py +20 -0
  105. seismoscope-0.9.1/core/vrtm/__init__.py +22 -0
  106. seismoscope-0.9.1/core/vrtm/declaration.py +277 -0
  107. seismoscope-0.9.1/core/vrtm/exporters.py +99 -0
  108. seismoscope-0.9.1/core/vrtm/lifecycle.py +402 -0
  109. seismoscope-0.9.1/core/vrtm/observations.py +193 -0
  110. seismoscope-0.9.1/core/vrtm/service.py +343 -0
  111. seismoscope-0.9.1/core/vrtm/store.py +98 -0
  112. seismoscope-0.9.1/main.py +1453 -0
  113. seismoscope-0.9.1/pyproject.toml +89 -0
  114. seismoscope-0.9.1/seismoscope.egg-info/PKG-INFO +473 -0
  115. seismoscope-0.9.1/seismoscope.egg-info/SOURCES.txt +156 -0
  116. seismoscope-0.9.1/seismoscope.egg-info/dependency_links.txt +1 -0
  117. seismoscope-0.9.1/seismoscope.egg-info/entry_points.txt +3 -0
  118. seismoscope-0.9.1/seismoscope.egg-info/requires.txt +20 -0
  119. seismoscope-0.9.1/seismoscope.egg-info/top_level.txt +5 -0
  120. seismoscope-0.9.1/setup.cfg +4 -0
  121. seismoscope-0.9.1/tests/test_agent_runtime.py +652 -0
  122. seismoscope-0.9.1/tests/test_api_validation_results.py +307 -0
  123. seismoscope-0.9.1/tests/test_audit_signal_quality.py +141 -0
  124. seismoscope-0.9.1/tests/test_audit_target_planner.py +84 -0
  125. seismoscope-0.9.1/tests/test_basic_audit.py +247 -0
  126. seismoscope-0.9.1/tests/test_benchmark_recall.py +71 -0
  127. seismoscope-0.9.1/tests/test_browser_verification.py +114 -0
  128. seismoscope-0.9.1/tests/test_candidate_cluster.py +41 -0
  129. seismoscope-0.9.1/tests/test_container_scanners.py +358 -0
  130. seismoscope-0.9.1/tests/test_container_scanners_real.py +254 -0
  131. seismoscope-0.9.1/tests/test_dependency_vulnerability_scanner.py +146 -0
  132. seismoscope-0.9.1/tests/test_deployment_manager.py +115 -0
  133. seismoscope-0.9.1/tests/test_deployment_package.py +48 -0
  134. seismoscope-0.9.1/tests/test_environment_runtime.py +118 -0
  135. seismoscope-0.9.1/tests/test_finding_cluster.py +44 -0
  136. seismoscope-0.9.1/tests/test_framework_semantics.py +93 -0
  137. seismoscope-0.9.1/tests/test_issues_found_regressions.py +225 -0
  138. seismoscope-0.9.1/tests/test_llm_failure_degradation.py +48 -0
  139. seismoscope-0.9.1/tests/test_llm_model_configuration.py +302 -0
  140. seismoscope-0.9.1/tests/test_parallel_finding_review.py +147 -0
  141. seismoscope-0.9.1/tests/test_poc_protocol.py +144 -0
  142. seismoscope-0.9.1/tests/test_react_discovery.py +330 -0
  143. seismoscope-0.9.1/tests/test_recon_execution_hints.py +25 -0
  144. seismoscope-0.9.1/tests/test_remediation_regression.py +240 -0
  145. seismoscope-0.9.1/tests/test_runtime_surface_modeling.py +498 -0
  146. seismoscope-0.9.1/tests/test_sarif_output.py +98 -0
  147. seismoscope-0.9.1/tests/test_service_runtime.py +57 -0
  148. seismoscope-0.9.1/tests/test_skill_session_closure.py +173 -0
  149. seismoscope-0.9.1/tests/test_source_tools.py +369 -0
  150. seismoscope-0.9.1/tests/test_specialized_audit_lanes.py +292 -0
  151. seismoscope-0.9.1/tests/test_tool_fabric.py +196 -0
  152. seismoscope-0.9.1/tests/test_tree_sitter_gateway.py +126 -0
  153. seismoscope-0.9.1/tests/test_v2_contracts.py +666 -0
  154. seismoscope-0.9.1/tests/test_verification_authorization.py +57 -0
  155. seismoscope-0.9.1/tests/test_verification_controls.py +229 -0
  156. seismoscope-0.9.1/tests/test_vrtm_product.py +452 -0
  157. seismoscope-0.9.1/tests/test_web_audit_recall.py +173 -0
  158. seismoscope-0.9.1/tools/base.py +438 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vibe Sec Platform Maintainers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,473 @@
1
+ Metadata-Version: 2.4
2
+ Name: seismoscope
3
+ Version: 0.9.1
4
+ Summary: Seismoscope (候风) — security audit & verification platform for the Vibe Coding era
5
+ Author: Seismoscope Maintainers
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/dxz0069/seismoscope
8
+ Project-URL: Repository, https://github.com/dxz0069/seismoscope
9
+ Project-URL: Documentation, https://github.com/dxz0069/seismoscope#readme
10
+ Keywords: security,seismoscope,vibe-coding,ai-audit,vulnerability,sarif,mcp,llm
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Security
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: setuptools>=61.0
23
+ Requires-Dist: fastapi>=0.104.0
24
+ Requires-Dist: uvicorn[standard]>=0.24.0
25
+ Requires-Dist: pydantic>=2.5.0
26
+ Requires-Dist: openai>=1.3.0
27
+ Requires-Dist: anthropic>=0.8.0
28
+ Requires-Dist: httpx>=0.25.0
29
+ Requires-Dist: playwright>=1.40.0
30
+ Requires-Dist: python-dotenv>=1.0.0
31
+ Requires-Dist: PyYAML>=6.0.0
32
+ Requires-Dist: esprima>=4.0.1
33
+ Requires-Dist: tree-sitter-language-pack==1.13.3
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
38
+ Requires-Dist: black>=23.11.0; extra == "dev"
39
+ Requires-Dist: ruff>=0.1.6; extra == "dev"
40
+ Requires-Dist: mypy>=1.7.0; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ # 候风 Seismoscope
44
+
45
+ [![CI](https://github.com/dxz0069/seismoscope/actions/workflows/ci.yml/badge.svg)](https://github.com/dxz0069/seismoscope/actions/workflows/ci.yml)
46
+ [![PyPI](https://img.shields.io/pypi/v/seismoscope.svg)](https://pypi.org/project/seismoscope/)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
48
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](pyproject.toml)
49
+
50
+ **候风——AI 编码时代的候风地动仪。** 面向 Vibe Coding 范式的安全审查验证平台,以 Claude Code Skill 形式嵌入 AI 辅助开发全流程,在 AI 生成的代码里感知安全"地动":确定性多智能体审查 + 三态验证,修复指令直达 AI 编码上下文。
51
+
52
+ > **English** — Seismoscope (候风, after Zhang Heng's earthquake-detecting instrument) is a security audit & verification platform for the AI coding era. It embeds into AI-assisted development as a Claude Code Skill / CLI, models the compound runtime surface (code · prompts · tools · permissions) with a four-plane graph (VRTM), runs deterministic multi-agent review with tri-state verification (vulnerable / fixed / legitimate-control), and returns AI-consumable remediation bundles instead of PDF reports — sensing the tremors in AI-generated code before they quake.
53
+
54
+ > 分发名 **seismoscope**(`pip install seismoscope`),项目名 **候风 Seismoscope**(曾用名 vibe-guard / vibe-sec-platform);CLI 提供 `vibe-sec` 与 `seismoscope` 两个等价命令,均指同一项目。
55
+
56
+ **版本**: v0.9.1 | **状态**: ✅ 所有阶段完成(Phase 1-5),工程验证版(本地单人 Beta),成熟度自评见 [docs/progress/CURRENT_PROJECT_STATUS_2026-08-01.md](docs/progress/CURRENT_PROJECT_STATUS_2026-08-01.md)
57
+
58
+ ## 项目定位
59
+
60
+ - **目标用户**: 独立开发者 / 小团队
61
+ - **核心接入方式**: Claude Code Skill 优先
62
+ - **审查范围**: 传统 Web 漏洞 + 智能体特有漏洞(提示词注入、MCP 风险、越权、密钥泄露)
63
+ - **验证深度**: AI 驱动验证(静态 + 动态 + Fuzzing + 浏览器证据)
64
+ - **输出格式**: 可配置多格式(Claude Code 原生、Markdown、JSON、HTML、SARIF 2.1.0)——SARIF 可直接上传 GitHub Code Scanning(示例:[docs/examples/seismoscope-code-scanning.yml](docs/examples/seismoscope-code-scanning.yml))
65
+
66
+ ## 核心特性
67
+
68
+ ### 1. 确定性编排
69
+
70
+ 借鉴 AutoCVE 的成熟架构,强制执行固定的审查流程:
71
+
72
+ ```
73
+ Recon → Surface → Audit(并行) → Merge → Verify → Remediate → Retest
74
+ ```
75
+
76
+ - 不让 LLM 决定主要阶段
77
+ - Agent 间通过 TaskHandoff 结构化交接
78
+ - 支持并行审计和验证
79
+
80
+ ### 2. 智能体漏洞审查
81
+
82
+ 专门针对 AI 智能体的安全审查能力:
83
+
84
+ - **提示词注入检测**: 直接注入、间接注入、越狱攻击
85
+ - **MCP 安全审计**: 不安全的 MCP Server、工具权限过大、数据泄露
86
+ - **越权访问检测**: 身份认证绕过、权限提升、角色混淆
87
+ - **密钥泄露检测**: 硬编码密钥、API Key、私钥暴露
88
+
89
+ ### 3. 混合验证机制
90
+
91
+ 根据风险等级自动选择验证方式:
92
+
93
+ | 风险等级 | 验证方式 |
94
+ |---------|---------|
95
+ | High (CVSS 7.0+) | 动态执行 + Fuzzing + 浏览器证据 |
96
+ | Medium (CVSS 4.0-6.9) | 静态分析 + 动态执行(沙箱) |
97
+ | Low (CVSS < 4.0) | 静态分析 |
98
+
99
+ ### 4. 整改闭环
100
+
101
+ 完整的审查-验证-整改-复测闭环:
102
+
103
+ - 生成 RemediationBundle(整改包)
104
+ - 提供 ai_patch_prompt(AI 修复指令)
105
+ - Skill Relay 状态机追踪整改包流转
106
+ - 自动复测验证修复效果
107
+
108
+ ## 系统架构
109
+
110
+ ### 五层架构
111
+
112
+ ```
113
+ ┌──────────────────────────────────────────────────────────────────────┐
114
+ │ L5 接入层 (Integration Layer) │
115
+ │ Claude Code Skill / CLI / REST API (可选 Web UI) │
116
+ └──────────────────────────────────────────────────────────────────────┘
117
+ ↓
118
+ ┌──────────────────────────────────────────────────────────────────────┐
119
+ │ L4 编排层 (Orchestration Layer) │
120
+ │ Deterministic Orchestrator + TaskHandoff + ReasoningGuard │
121
+ └──────────────────────────────────────────────────────────────────────┘
122
+ ↓
123
+ ┌──────────────────────────────────────────────────────────────────────┐
124
+ │ L3 智能体层 (Agent Layer) │
125
+ │ Recon / Surface / Audit / Verification / Remediation / Regression │
126
+ └──────────────────────────────────────────────────────────────────────┘
127
+ ↓
128
+ ┌──────────────────────────────────────────────────────────────────────┐
129
+ │ L2 能力层 (Capability Layer) │
130
+ │ RuntimeSurface / RiskChain / VerificationHarness / Skill KB │
131
+ └──────────────────────────────────────────────────────────────────────┘
132
+ ↓
133
+ ┌──────────────────────────────────────────────────────────────────────┐
134
+ │ L1 基础设施层 (Infrastructure Layer) │
135
+ │ ToolRuntime / SessionStore / EvidenceArchive / FindingStore │
136
+ └──────────────────────────────────────────────────────────────────────┘
137
+ ```
138
+
139
+ ### 核心组件
140
+
141
+ - **OrchestratorAgent**: 确定性编排器
142
+ - **ReconAgent**: 信息收集
143
+ - **SurfaceAgent**: 攻击面建模
144
+ - **AuditAgent**: 漏洞审查(支持并行)
145
+ - **VerificationAgent**: 漏洞验证
146
+ - **RemediationAgent**: 整改建议生成
147
+ - **RegressionAgent**: 回归测试
148
+
149
+ ## 快速开始
150
+
151
+ ### 安装
152
+
153
+ 将源码包交给编程助手后,由仓库内的确定性 bootstrap 完成 Python 环境、CLI 和工具镜像准备。不要让助手自行拼装 Docker 命令。
154
+
155
+ Windows:
156
+
157
+ ```powershell
158
+ scripts/setup.ps1
159
+ .venv/Scripts/vibe-sec.exe doctor --json
160
+ ```
161
+
162
+ Linux/macOS:
163
+
164
+ ```bash
165
+ sh scripts/setup.sh
166
+ .venv/bin/vibe-sec doctor --json
167
+ ```
168
+
169
+ 默认安装并校验 `vibe-sec-tools`、离线 `vibe-sec-trivy` 和精选模板 `vibe-sec-nuclei`。CodeQL 是显式可选能力:
170
+
171
+ ```powershell
172
+ vibe-sec setup --include-codeql --json
173
+ ```
174
+
175
+ 安装和更新由 `manifests/tool-images.lock.json` 锁定。`doctor` 只报告凭据是否配置,不读取或输出 Key;只有状态为 `READY` 的镜像能力会暴露给智能体。
176
+
177
+ AST 审计通道依赖 tree-sitter 解析器,首次使用会从 GitHub 下载(`setup` 自动预热,`doctor --json` 的 `tree_sitter` 段报告就绪状态)。离线或受限网络环境:
178
+
179
+ - 设置 `VIBE_SEC_TREE_SITTER_CACHE` 指向预置解析器缓存目录,可直接拷贝已下载缓存(当前缓存位置见 `doctor --json` 输出的 `tree_sitter.cache_dir` 字段);
180
+ - 或设置 `VIBE_SEC_DISABLE_TREE_SITTER=1` 跳过全部 AST 通道,平台自动降级到文本/正则分析,不会中断审计。
181
+
182
+ ### 召回/误报基线
183
+
184
+ `scripts/benchmark_recall.py` 在固定靶场集上度量确定性审计能力(无 LLM),当前基线为**平均召回 100%、safe 集零误报**。对真实 [VAmPI](https://github.com/erev0s/VAmPI) 靶场(11 个 Python 文件),6 个已知漏洞中 4 个静态可映射类型**全部命中且零误报**,IDOR/debug 端点等语义类由 LLM 审计通道负责:
185
+
186
+ ```bash
187
+ python scripts/benchmark_recall.py # 运行四个内置靶场集
188
+ python scripts/benchmark_recall.py --json baseline.json # 保存基线
189
+ python scripts/benchmark_recall.py --compare baseline.json # 对比基线,回退则退出码 1
190
+ python scripts/benchmark_recall.py --project /path/to/VAmPI --label vampi --expect sql_injection,api_key
191
+ ```
192
+
193
+ `--compare` 在召回下降或误报出现时以退出码 1 失败,用于防止能力回退;外部靶场(真实 VAmPI、Juice Shop 等)通过 `--project/--expect` 接入。
194
+
195
+ ### Docker 一键部署
196
+
197
+ Docker 部署提供 Web 前端、REST API、SQLite 状态和 VRTM 快照的统一运行边界:
198
+
199
+ ```powershell
200
+ scripts/deploy.ps1 -Build -Detach
201
+ ```
202
+
203
+ Linux/macOS:
204
+
205
+ ```bash
206
+ sh scripts/deploy.sh --build --detach
207
+ ```
208
+
209
+ 默认将仓库下的 `projects/` 只读挂载为容器内的 `/workspace`,访问
210
+ `http://localhost:8000`。自定义目录可设置 `VIBE_SEC_PROJECTS_PATH`;容器不会
211
+ 启动靶场,默认审查路径也不会修改项目源码(显式 `model-init` 除外)。需要 LLM 时使用外部 Secret 文件:
212
+
213
+ ```powershell
214
+ $env:VIBE_SEC_DEEPSEEK_API_KEY_FILE = "C:\secrets\deepseek.key"
215
+ scripts/deploy.ps1 -Build -Detach -LlmSecretFile $env:VIBE_SEC_DEEPSEEK_API_KEY_FILE
216
+ ```
217
+
218
+ 完整部署说明见 `docs/DEPLOYMENT.md`。默认 Compose 不挂载 Docker Socket,因此
219
+ 容器扫描器仍应由已授权的宿主机 Runner 执行。
220
+
221
+ ### 交给 Agent 一句话部署
222
+
223
+ 将源码包交给 Codex、Claude Code 或其他具备终端权限的 Agent 后,直接发送:
224
+
225
+ > 请在当前仓库执行 `scripts/agent-one-click-deploy.ps1 -Agent codex`(Linux/macOS 执行 `sh scripts/agent-one-click-deploy.sh --agent codex`),完成 Docker 构建、启动本地 Web UI、安装 `vibe-sec` Skill,并把健康检查结果和访问地址返回给我。
226
+
227
+ 脚本会自动创建 `projects/`、启动 `api` 和 `web`、安装 Skill,并等待
228
+ `/api/health` 返回 200。默认访问地址为 `http://localhost:8000`。完整边界和
229
+ 其他 Agent 选项见 `docs/AGENT_ONE_CLICK_DEPLOY.md`。
230
+
231
+ 开发环境可额外安装测试依赖:
232
+
233
+ ```bash
234
+ pip install -e ".[dev]"
235
+ ```
236
+
237
+ ### 使用
238
+
239
+ #### 作为 Claude Code Skill 使用
240
+
241
+ 1. 执行 `scripts/install-agent-skill.ps1 -Agent claude-code`,或 Linux/macOS 下执行 `sh scripts/install-agent-skill.sh claude-code`。
242
+ 2. 编程助手按照 Skill 先运行 `vibe-sec doctor --json`,未就绪时调用仓库 bootstrap。
243
+ 3. 在 Claude Code 中输入安全审查请求。
244
+
245
+ Codex 使用 `-Agent codex`;项目级安装使用 `-Agent project`。安装器默认拒绝覆盖已有 Skill,只有明确传入 `-Force` 或 `--force` 才会更新。
246
+
247
+ ```
248
+ 用户: 请对这个 Flask 应用进行安全审查
249
+ ```
250
+
251
+ #### 作为 Python 库使用
252
+
253
+ ```python
254
+ from core.orchestrator.orchestrator import OrchestratorAgent, OrchestrationConfig
255
+ from core.agents.registry import AgentRegistry
256
+ from core.llm.openai_service import OpenAIService
257
+
258
+ # 初始化
259
+ llm_service = OpenAIService(api_key="your-api-key")
260
+ registry = AgentRegistry()
261
+
262
+ # 注册 Agent
263
+ registry.register(AgentType.RECON, ReconAgent)
264
+ registry.register(AgentType.SURFACE, SurfaceAgent, dependencies=[AgentType.RECON])
265
+ registry.register(AgentType.AUDIT, AuditAgent, dependencies=[AgentType.SURFACE])
266
+
267
+ # 创建编排器
268
+ orchestrator = OrchestratorAgent(
269
+ llm_service=llm_service,
270
+ agent_registry=registry,
271
+ config=OrchestrationConfig(),
272
+ )
273
+
274
+ # 执行审查
275
+ result = await orchestrator.run({
276
+ "project_path": "/path/to/project",
277
+ "audit_scope": {
278
+ "web_vulns": True,
279
+ "agent_vulns": True,
280
+ "secret_leaks": True,
281
+ },
282
+ "output_format": "markdown",
283
+ })
284
+
285
+ # 获取结果
286
+ print(result.data["summary"])
287
+ print(f"发现 {len(result.data['verified_findings'])} 个漏洞")
288
+ ```
289
+
290
+ ## 项目结构
291
+
292
+ ```
293
+ vibe-sec-platform/
294
+ ├── skill/ # Claude Code Skill 入口
295
+ │ ├── SKILL.md # Skill 控制文件
296
+ │ ├── metadata.json # Skill 元数据
297
+ │ └── references/ # 知识库(渐进式披露)
298
+ │ ├── catalog.json # 漏洞类别目录
299
+ │ ├── checklists/ # 漏洞检查清单
300
+ │ │ ├── web/ # Web 漏洞
301
+ │ │ ├── agent/ # Agent 漏洞
302
+ │ │ └── secrets/ # 密钥泄露
303
+ │ ├── patterns/ # 漏洞模式库
304
+ │ ├── adapters/ # 语言适配器
305
+ │ └── examples/ # 真实案例
306
+ │
307
+ ├── core/ # 核心基础设施
308
+ │ ├── agents/
309
+ │ │ ├── base.py # BaseAgent + TaskHandoff
310
+ │ │ ├── registry.py # Agent 注册中心
311
+ │ │ └── executor.py # Agent 执行器
312
+ │ ├── orchestrator/
313
+ │ │ └── orchestrator.py # 确定性编排器
314
+ │ ├── runtime/
315
+ │ │ ├── tool_runtime.py # 工具运行时
316
+ │ │ ├── permission_policy.py # 权限策略
317
+ │ │ └── session_store.py # 会话存储
318
+ │ ├── surface/
319
+ │ │ ├── runtime_surface.py # 攻击面画像
320
+ │ │ ├── runtime_surface_graph.py # 攻击面关系图
321
+ │ │ └── risk_chain.py # 风险链
322
+ │ ├── reasoning/
323
+ │ │ └── reasoning_guard.py # 推理监护
324
+ │ ├── verification/
325
+ │ │ ├── harness.py # 验证沙箱
326
+ │ │ ├── fuzzing.py # Fuzzing Harness
327
+ │ │ └── browser_executor.py # 浏览器证据采集
328
+ │ ├── remediation/
329
+ │ │ ├── remediation_bundle.py # 整改包生成
330
+ │ │ └── skill_relay.py # Skill Relay 状态机
331
+ │ └── reporting/
332
+ │ ├── unified_report.py # 统一报告生成
333
+ │ └── output_formatter.py # 多格式输出
334
+ │
335
+ ├── agents/ # 智能体实现
336
+ │ ├── recon_agent.py
337
+ │ ├── surface_agent.py
338
+ │ ├── audit_agent.py
339
+ │ ├── verification_agent.py
340
+ │ ├── remediation_agent.py
341
+ │ └── regression_agent.py
342
+ │
343
+ ├── tools/ # 工具实现
344
+ │ ├── base.py
345
+ │ ├── file_tools.py
346
+ │ ├── analysis_tools.py
347
+ │ ├── execution_tools.py
348
+ │ └── knowledge_tools.py
349
+ │
350
+ ├── api/ # REST API (可选)
351
+ │ ├── main.py
352
+ │ ├── routes/
353
+ │ └── models/
354
+ │
355
+ ├── tests/ # 测试
356
+ │ ├── unit/
357
+ │ ├── integration/
358
+ │ └── fixtures/
359
+ │
360
+ └── docs/ # 文档
361
+ ├── ARCHITECTURE.md
362
+ ├── SKILL_DEVELOPMENT.md
363
+ └── CONTRIBUTING.md
364
+ ```
365
+
366
+ ## 技术栈
367
+
368
+ - **语言**: Python 3.11+
369
+ - **Web 框架**: FastAPI(可选 REST API)
370
+ - **LLM 调用**: OpenAI 兼容 API / Anthropic Claude
371
+ - **浏览器自动化**: Playwright
372
+ - **容器化**: Docker(沙箱执行)
373
+ - **测试**: pytest
374
+ - **文档**: Markdown
375
+
376
+ ## 实施路线图
377
+
378
+ ### Phase 1: MVP ✅
379
+
380
+ **目标**: 实现核心审查流程,支持 Web 漏洞检测
381
+
382
+ - ✅ 项目骨架搭建
383
+ - ✅ BaseAgent 基类和 TaskHandoff
384
+ - ✅ OrchestratorAgent 确定性编排
385
+ - ✅ ReconAgent 信息收集
386
+ - ✅ AuditAgent(Web 漏洞)
387
+ - ✅ 静态分析工具
388
+ - ✅ Markdown 报告生成
389
+ - ✅ 端到端测试(5 个漏洞检测)
390
+
391
+ ### Phase 2: 增强验证 ✅
392
+
393
+ **目标**: 实现混合验证机制,支持动态执行
394
+
395
+ - ✅ SurfaceAgent 攻击面建模
396
+ - ✅ RuntimeSurface + RiskChain
397
+ - ✅ 动态执行验证(Docker 沙箱)
398
+ - ✅ FuzzingHarness 模糊测试
399
+ - ✅ VerificationAgent 漏洞验证
400
+ - ✅ PermissionPolicy 权限策略
401
+ - ✅ ReasoningGuard 推理监护
402
+
403
+ ### Phase 3: Agent 漏洞审查 ✅
404
+
405
+ **目标**: 支持智能体特有漏洞审查
406
+
407
+ - ✅ Agent 漏洞知识库(OWASP Top 10 for LLM + MCP 安全清单)
408
+ - ✅ 提示词注入检测(prompt_injection)
409
+ - ✅ MCP 安全审计(mcp_insecurity)
410
+ - ✅ 过度代理检测(excessive_agency)
411
+ - ✅ 密钥泄露检测(hardcoded_password)
412
+ - ✅ 多格式输出(Markdown / JSON / Claude Code / HTML)
413
+ - ✅ 端到端测试(15 个漏洞检测,覆盖 Web + Agent)
414
+
415
+ ### Phase 4: 整改闭环 ✅
416
+
417
+ **目标**: 实现完整的审查-验证-整改-复测闭环
418
+
419
+ - ✅ RemediationAgent 整改建议生成(7 种修复策略)
420
+ - ✅ RemediationBundle 整改包(ai_patch_prompt + patch_constraints + retest_plan + acceptance_criteria)
421
+ - ✅ Skill Relay 状态机(draft → dispatched → acknowledged → in_progress → completed → returned)
422
+ - ✅ RegressionAgent 回归测试(漏洞修复验证 + 功能完整性 + 副作用检测)
423
+ - ✅ 完整的 7 阶段流程(Recon → Surface → Audit → Merge → Verify → Remediate → Regression)
424
+ - ✅ 端到端测试(15 个漏洞 → 15 个整改包 → 15 个回归测试报告)
425
+
426
+ ### Phase 5: 优化与扩展 ✅
427
+
428
+ **目标**: 性能优化、可扩展性、社区贡献
429
+
430
+ - ✅ 缓存系统(多级缓存:内存缓存 + 文件缓存)
431
+ - ✅ 插件系统(DetectionRulePlugin / ReportFormatPlugin / VerificationPlugin / RemediationPlugin)
432
+ - ✅ REST API(FastAPI,Swagger UI / ReDoc 自动文档)
433
+ - ✅ 文档完善(API 文档 / 插件开发指南 / 架构文档)
434
+
435
+ ## 借鉴来源
436
+
437
+ 本项目借鉴了两个参考项目的设计:
438
+
439
+ ### AutoCVE(智能体编排架构)
440
+
441
+ - 确定性 Orchestrator 编排
442
+ - TaskHandoff 结构化交接
443
+ - FindingAgent 候选队列状态机
444
+ - FinalizeFinding 终止工具
445
+ - Nudge 纠偏机制
446
+ - Skill 渐进式披露
447
+ - Fuzzing Harness 验证
448
+
449
+ ### lz-secure(安全审查能力)
450
+
451
+ - RuntimeSurface 攻击面画像
452
+ - RuntimeSurfaceGraph 关系图
453
+ - RiskChain 风险链
454
+ - PermissionPolicy 权限策略
455
+ - ReasoningGuard 推理监护
456
+ - Skill Relay 状态机
457
+ - Browser Executor 证据采集
458
+ - Remediation Bundle 整改包
459
+
460
+ ## 许可证
461
+
462
+ MIT License
463
+
464
+ ## 贡献
465
+
466
+ 欢迎贡献代码、报告问题或提出改进建议!
467
+
468
+ 请参阅 [CONTRIBUTING.md](docs/CONTRIBUTING.md) 了解详情。
469
+
470
+ ## 联系方式
471
+
472
+ - 项目主页: https://github.com/dxz0069/seismoscope
473
+ - 问题反馈: https://github.com/dxz0069/seismoscope/issues