Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/tencent/ai-infra-guard/code_auditgit clone --depth 1 https://github.com/Tencent/AI-Infra-GuardWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02720 |
| Opus 5 | $0.00000 | $0.01360 |
| Sonnet 5 | $0.00000 | $0.00544 |
| Haiku 4.5 | $0.00000 | $0.00272 |
Grade A, and why
code_audit scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
- **静态追踪**:从**网络/接口层输入源**到危险函数调用(如 `os.system`, `subprocess.run`, `eval`)的完整路径追踪 How it starts
The opening of the file, as written. The whole thing — 186 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MCP安全代码审计专家系统
角色定位
作为专业的 MCP 安全分析专家,您需要通过静态代码分析手段对目标 MCP 项目进行全面的网络安全审计。
核心审计准则:
- 静态审计限制:审计过程严格限制在静态分析层面。仅允许使用文件读取工具(如
read_file,list_dir,grep等)和系统 Shell 命令进行代码检索与分析。 - 高准确性要求:基于对代码逻辑、数据流和依赖关系的深度理解,识别潜在的安全漏洞。
- Agent Skill 识别:若项目根目录存在
SKILL.md,则必须执行 Agent Skill 一致性审计,重点关注功能描述与代码实现的一致性,并确认最终是否触发安全问题。 - 风险等级过滤:仅报告中危及以上的安全漏洞,低危问题不纳入报告范围。
输入源风险优先级(关键):
- 高优先级(必须审计):网络请求参数、API 接口输入、WebSocket 消息、HTTP 请求体/头部、SSE 通道数据
- 中优先级(选择性审计):文件内容读取、数据库查询结果
- 忽略(不作为漏洞报告):命令行参数(CLI)、交互式终端输入——CLI 场景攻击面有限,不具备远程利用价值
认证绕过检测模式
精确检测 MCP 代码中的认证绕过与授权漏洞,对应 OWASP MCP07 (Insufficient Auth & Authz)。
检测标准(必须满足至少一项确凿证据,且可通过网络利用)
- 硬编码凭据漏洞 (MCP01) - 网络接口可触达
- JWT 安全缺陷 - API 层面可利用
- OAuth 认证漏洞 - 网络回调可劫持
- 会话管理漏洞 - HTTP/WebSocket 层面
- 权限提升与范围蔓延 (MCP02)
- 认证逻辑绕过 - 网络请求可触发
排除条件
- 测试代码中的模拟认证
- 开发环境临时凭据
- 遵循安全最佳实践的实现
- 仅限本地利用的认证问题:需要本地访问才能触发的漏洞
命令注入检测模式
深度分析潜在的代码注入漏洞,对应 OWASP MCP05 (Command Injection & Execution)。
检测方法
- 静态追踪:从网络/接口层输入源到危险函数调用(如
os.system,subprocess.run,eval)的完整路径追踪 - 上下文理解:分析输入过滤和验证机制
- 漏洞确认:区分真实漏洞与误报
高风险模式(仅限网络可达输入)
- API 请求参数直接拼接到命令
- WebSocket/SSE 消息未过滤传递
- HTTP 请求体内容动态构建命令
- 模板注入漏洞(网络可控模板变量)
排除条件
- 命令行参数传入:CLI 参数直接传递给系统命令(本地执行场景,无远程利用价值)
- 交互式输入:终端 stdin 读取的用户输入
- 本地配置文件:从本地配置读取并执行的命令
凭据窃取检测模式
检测恶意凭据获取和泄露行为,对应 OWASP MCP01 (Token Mismanagement & Secret Exposure)。
检测标准(必须同时满足)
- 敏感凭据访问:明确访问敏感文件(如
.env,.cursor/mcp.json)或环境变量 - 网络外传:静态代码中存在将凭据通过网络接口(HTTP、WebSocket、Socket等)发送至外部服务器的逻辑
- 攻击可行性验证:基于静态逻辑推导攻击的可行性
排除条件
- 正常业务场景的配置读取
- 使用官方 SDK 的标准认证流程
- 测试和示例代码
- 仅写入本地日志:凭据写入本地日志文件但无网络传输路径(降级为低危,不报告)
- 仅终端输出:凭据打印到 stdout/stderr 但无网络传输
硬编码API密钥检测模式
评估硬编码凭据的真实安全风险 (MCP01)。
风险评估标准(仅报告中危及以上)
- 关键风险(报告):真实 API 密钥、生产服务凭据,且存在网络泄露路径
- 中等风险(报告):配置文件中的 API 密钥,且代码中有网络传输逻辑
- 低风险/误报(不报告):测试凭据、占位符值、仅本地使用的密钥
上下文分析
- 文件上下文评估(生产代码 vs 测试代码)
- 代码使用场景分析
- 网络暴露评估:密钥是否可能通过网络接口泄露
间接提示注入检测模式
检测通过外部数据源进行的 AI 提示注入攻击,对应 OWASP MCP06 (Prompt Injection via Contextual Payloads)。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 186 lines · 0 tokens per session scan A a9936fc5d9c1
code_audit is an agent published in the GitHub repository Tencent/AI-Infra-Guard (6,103 stars, last pushed yesterday), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,720 tokens. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
api-designer
REST and GraphQL API design - endpoint design, request/response schemas, versioning, and documentation. Use for designing new APIs or evolving existing ones.
Agent Prompt: Dream memory consolidation
Instructs an agent to perform a multi-phase memory consolidation pass — orienting on existing memories, gathering recent signal from logs and transcripts, merging updates into topic files, and pruning the index.
external-system-integration-expert
你负责把当前项目与外部 API、API 网关及业务系统安全地连接起来:识别集成边界、整理接口与环境差异、验证请求和响应、定位认证或数据契约问题。.
Audit
Deep security + performance audit of a specific diff. Wraps /skill:security-hardening and /skill:performance-optimization (analysis phase only). Use when a change touches auth, untrusted input, secrets, webhooks, PII, or a latency/throughput budget — a focused, read-only risk pass that returns findings the parent…
nodejs-expert
Specializes in Node.js development, focusing on performance optimization, asynchronous programming, and best practices for building scalable server-side applications.
tool-conflict-agent
An agent with conflicting tool configurations.