Security Audit Report
【免费下载链接】agent-skillsProduction-grade engineering skills for AI coding agents.项目地址: https://gitcode.com/GitHub_Trending/agentskill/agent-skills
Summary
- Critical: [count]
- High: [count]
- Medium: [count]
- Low: [count]
Findings
[CRITICAL] [Finding title]
- Location:[file:line]
- Description:[What the vulnerability is]
- Impact:[What an attacker could do]
- Proof of concept:[How to exploit it]
- Recommendation:[Specific fix with code example]
[HIGH] [Finding title]
...
Positive Observations
- [Security practices done well]
Recommendations
- [Proactive improvements to consider]
模板中 `Positive Observations` 一节对应规则 4:好的安全实践要被点名表扬。`Summary` 中的计数则是 `/ship` 合并阶段的聚合输入——主 Agent 按 Critical/High 数量把发现提升为发布阻塞项。 ## 七、检查项背后的实现证据 人格文件本身只定义“审什么、怎么报”,每个检查项在仓库中都有可对照的落地实现,审计者可以按图索骥: **注入与参数化查询。** [skills/security-and-hardening/SKILL.md](https://link.gitcode.com/i/cdcf28f25a4ae83830492228af107cb2) 给出了坏/好对照: ```typescript // BAD: SQL injection via string concatenation const query = `SELECT * FROM users WHERE id = '${userId}'`; // GOOD: Parameterized query const user = await db.query('SELECT * FROM users WHERE id = $1', [userId]); ``` **XSS 与输出编码。** 该技能同样给出对照:`element.innerHTML = userInput` 为反例;React 默认自动转义,或必须渲染 HTML 时先用 `DOMPurify.sanitize()`。 **SSRF(对应范围 5 的最后一问)。** 技能中给出了完整的白名单 + 私有 IP 阻断实现,并明确指出 `fetch` 在检查后会再次解析 DNS,存在 TOCTOU 缺口: ```typescript // GOOD: allowlist scheme + host, reject if ANY resolved IP is private, forbid redirects const ALLOWED_HOSTS = new Set(['hooks.example.com']); async function assertSafeUrl(raw: string): Promise<URL> { const url = new URL(raw); if (url.protocol !== 'https:') throw new Error('https only'); if (!ALLOWED_HOSTS.has(url.hostname)) throw new Error('host not allowed'); const addrs = await lookup(url.hostname, { all: true }); if (addrs.some((a) => ipaddr.parse(a.address).range() !== 'unicast')) { throw new Error('private/reserved IP'); } return url; } await fetch(await assertSafeUrl(req.body.webhookUrl), { redirect: 'error' }); ``` `range() !== 'unicast'` 一条检查覆盖回环、链路本地(`169.254.169.254` 云元数据,SSRF 首要目标)、私有与 IPv6 ULA 地址段。对高风险面,技能进一步要求“一次解析、连接固定 IP”或前置过滤代理。 **通用错误信息(对应范围 4)。** [references/security-checklist.md](https://link.gitcode.com/i/0a1274043b8d6b4a1361dfa1f47a53c2) 的反例很直接:生产环境返回 `{ error: err.message, stack: err.stack, query: err.sql }` 会同时暴露内部逻辑与数据库细节;正确做法是返回 `INTERNAL_ERROR` 这类通用代码。 **供应链风险(对应规则 6 的 typosquats、postinstall 脚本)。** 仓库对依赖审计的处理相当细:[skills/security-and-hardening/SKILL.md](https://link.gitcode.com/i/cdcf28f25a4ae83830492228af107cb2) 提供了按严重度 × 可达性 × 是否有修复版本的审计结果分诊决策树,以及“先定位安装边界 → 用原生 audit 命令 → 阻断未审查的安装脚本”的供应链卫生流程;[references/security-checklist.md](https://link.gitcode.com/i/0a1274043b8d6b4a1361dfa1f47a53c2) 则按包管理器(npm/pnpm/Yarn 各版本)给出冻结安装与审计命令对照表。`security-auditor` 在审依赖时可直接引用这些标准。 **LLM 特性的不可信输出(对应范围 6 第一问)。** 技能中的反例恰好覆盖了人格所问的 `eval`/SQL/`innerHTML` 三类 sink: ```typescript // BAD: trusting model output as a command or as markup const sql = await llm.generate(`Write SQL for: ${userQuestion}`); await db.query(sql); // arbitrary query execution container.innerHTML = await llm.reply(userMessage); // stored XSS, via the model // GOOD: model output is data — parse defensively, then validate, then encode let intent; try { intent = CommandSchema.parse(JSON.parse(await llm.replyJson(userMessage))); } catch { throw new ValidationError('unexpected model output'); } await runAllowlistedAction(intent.action, intent.params); container.textContent = await llm.reply(userMessage);【免费下载链接】agent-skillsProduction-grade engineering skills for AI coding agents.项目地址: https://gitcode.com/GitHub_Trending/agentskill/agent-skills
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考