Update README: change repository URL to GitLink
AgentVet 是一个专门针对 AI Agent 项目的安全审计平台,集成了静态扫描、污点分析、对抗测试等多种安全检测技术,帮助开发者发现和修复 AI Agent 代码中的安全漏洞。
# 1. 克隆项目 git clone https://gitlink.org.cn/tlyyxjz/agentvet.git cd agentvet # 2. 创建虚拟环境 python -m venv venv # 3. 激活虚拟环境 # Windows venv\Scripts\activate # Linux/Mac source venv/bin/activate # 4. 安装依赖 pip install -r requirements.txt
# 启动仪表盘 python cli.py dashboard --port 9090
然后在浏览器中访问 http://localhost:9090/
# 扫描项目 python cli.py scan /path/to/your/agent-project -o reports # 查看可用规则 python cli.py list-rules # 验证漏洞 python cli.py verify reports/project.json # 生成报告 python cli.py report reports/project.json -o reports -f all # 启动仪表盘 python cli.py dashboard --port 9090
python cli.py scan <target> [选项] 参数: target 目标项目路径 选项: -o, --output 输出目录(默认: reports) -m, --mode 扫描模式:quick(快速)、full(完整)、custom(自定义) -r, --rules 指定规则文件(逗号分隔) -i, --include 包含的文件模式(逗号分隔) -e, --exclude 排除的文件模式(逗号分隔) -v, --verbose 详细输出 --format 输出格式:json、csv、md、html
python cli.py fix <rule-id> <file-path> 参数: rule-id 规则编号(如 DL-002) file-path 要修复的文件路径 示例: python cli.py fix DL-002 location_service.py
python cli.py taint <target> 参数: target 目标项目路径 示例: python cli.py taint /path/to/project
python cli.py adversarial <target> <attack-type> 参数: target 目标项目路径 attack-type 攻击类型:prompt_injection、command_injection、ssrf、xss、data_poisoning 示例: python cli.py adversarial /path/to/project prompt_injection
python cli.py full <target> -o reports 参数: target 目标项目路径 -o, --output 输出目录 示例: python cli.py full /path/to/project -o reports
python cli.py batch <config-file> 参数: config-file 配置文件路径(JSON格式) 配置文件示例: { "projects": [ "/path/to/project1", "/path/to/project2" ], "output": "reports", "format": ["json", "md"] }
agentvet/ ├── agentvet/ # 核心模块 │ ├── __init__.py │ ├── scan_engine.py # 扫描引擎 │ ├── verifier.py # 漏洞验证器 │ ├── taint_analyzer.py # 污点分析器 │ ├── adversarial_tester.py # 对抗测试器 │ ├── fix_engine.py # 修复引擎 │ ├── rule_loader.py # 规则加载器 │ ├── noise_filter.py # 噪声过滤器 │ └── rules/ # 规则库 │ ├── __init__.py │ ├── dl_rules.py # 数据泄露规则 │ ├── ta_rules.py # 工具滥用规则 │ ├── pi_rules.py # Prompt注入规则 │ ├── fw_rules.py # 框架集成规则 │ ├── mcp_rules.py # MCP安全规则 │ ├── sc_rules.py # 技能安全规则 │ ├── ai_rules.py # AI特有规则 │ └── sec_rules.py # 通用安全规则 ├── reporting/ # 报告生成模块 │ ├── __init__.py │ ├── reporter.py # 报告生成器 │ └── templates/ # 报告模板 ├── dashboard/ # 可视化仪表盘 │ ├── index.html # 主页面 │ ├── styles.css # 样式文件 │ └── app.js # 前端逻辑 ├── cli.py # CLI命令行工具 ├── run_tests.py # 测试脚本 ├── requirements.txt # 依赖列表 └── README.md # 项目说明
# 运行所有测试 python run_tests.py # 运行特定测试 python run_tests.py -t test_scan_file
测试覆盖模块:
POST /api/scan Content-Type: application/json { "target": "/path/to/project", "mode": "full", "output_format": "json" } 响应: { "success": true, "score": "B", "summary": { "critical": 0, "high": 2, "medium": 3, "low": 1, "total": 6 }, "findings": [...], "duration_ms": 2340 }
POST /api/fix Content-Type: application/json { "rule_id": "DL-002", "file_path": "/path/to/file.py" } 响应: { "success": true, "message": "修复成功", "backup_path": "backups/file.py_1783401033.bak" }
POST /api/report Content-Type: application/json { "scan_result": {...}, "format": ["json", "md", "simple"] } 响应: { "success": true, "reports": [ {"name": "report.json", "path": "reports/report.json"}, {"name": "report.md", "path": "reports/report.md"}, {"name": "report_simple.txt", "path": "reports/report_simple.txt"} ] }
在 agentvet/rules/ 目录下创建新的规则文件,例如 custom_rules.py:
agentvet/rules/
custom_rules.py
from agentvet import Rule, Severity rules = [ Rule( rule_id="CUSTOM-001", title="自定义规则", severity=Severity.HIGH, category="自定义", pattern=r"custom_vulnerability_pattern", description="漏洞描述", fix_suggestion="修复建议", confidence=90, languages=["python"], skip_paths=["/tests/"] ) ]
本项目采用 MIT 许可证,详见 LICENSE 文件。
版本: v1.0.0更新日期: 2026年7月7日
AI Agent Security Audit Platform - 集成静态扫描、污点分析、对抗测试等多种安全检测技术,为AI Agent项目提供全方位安全审计能力
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
AgentVet - AI Agent 安全审计平台
AgentVet 是一个专门针对 AI Agent 项目的安全审计平台,集成了静态扫描、污点分析、对抗测试等多种安全检测技术,帮助开发者发现和修复 AI Agent 代码中的安全漏洞。
🌟 功能特性
核心功能
特色功能
覆盖的安全问题类别
📦 安装指南
环境要求
安装步骤
🚀 使用指南
方式一:可视化仪表盘
然后在浏览器中访问 http://localhost:9090/
仪表盘功能
方式二:命令行工具(CLI)
基础命令
扫描命令详解
修复命令详解
污点分析命令
对抗测试命令
完整审计命令
批量扫描命令
📁 项目结构
🧪 运行测试
测试覆盖模块:
🔌 API 接口
扫描接口
修复接口
报告接口
📊 扫描结果说明
安全评分
漏洞严重程度
📝 自定义规则
添加新规则
在
agentvet/rules/目录下创建新的规则文件,例如custom_rules.py:规则字段说明
🤝 贡献指南
贡献流程
代码规范
📄 许可证
本项目采用 MIT 许可证,详见 LICENSE 文件。
📞 联系方式
📚 参考资料
版本: v1.0.0
更新日期: 2026年7月7日