跳转到正文
报告库
用途分类 / 开发辅助

Best Practices Skill 安全审计

作者说它能做什么(原文)

Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities".

第三方安全检查结论

发现安全风险

已检查文件
2
发现的风险
4
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。未发现风险
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

依赖审计可能向配置的包注册表披露依赖名称和版本

原文依据:4 处
发现了什么

该 Skill 把 `npm audit` 列为最低安全检查,并在安全参考中直接给出命令。运行该命令通常会把依赖包及版本信息发送给当前配置的 npm 注册表以查询漏洞。

为什么需要注意

如果项目使用私有包,包名和版本可能暴露内部产品、组件命名、技术栈或尚未公开的依赖关系。

这段证据能说明什么

源码确实要求或建议运行 `npm audit`,但所给内容没有说明该命令会访问哪个注册表、传输哪些依赖信息,或当前环境如何配置网络。因此无法仅凭这些行确认候选所述的数据披露。用户可要求作者说明该检查的网络行为,并在敏感项目中限制外网或先使用获准的内部注册表。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:434来自说明文档打开原文件
## Audit checklist### Security (critical)- [ ] HTTPS enabled, no mixed content- [ ] No vulnerable dependencies (`npm audit`)- [ ] CSP headers configured (with `frame-ancestors`, `base-uri`, `form-action`)- [ ] `require-trusted-types-for 'script'` enforced (or report-only during rollout)
查看另外 3 个位置
references/SECURITY.md:120来自说明文档打开原文件
```bash# Check for vulnerabilitiesnpm audityarn audit# Auto-fix when possiblenpm audit fix
SKILL.md:23来自说明文档打开原文件
If live tools are unavailable, use the Lighthouse CLI plus focused dependency and header checks. Never report a high Lighthouse score as proof that the application is secure.
SKILL.md:438来自说明文档打开原文件
- [ ] HTTPS enabled, no mixed content- [ ] No vulnerable dependencies (`npm audit`)- [ ] CSP headers configured (with `frame-ancestors`, `base-uri`, `form-action`)
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
中风险

仅请求审计或审查也可能触发项目修改

原文依据:5 处
发现了什么

触发说明包含“security audit”和“code quality review”,但统一工作流明确要求修复代码。审计请求本身不一定授权修改文件;安全参考还列出会改动依赖树和锁文件的 `npm audit fix`。

为什么需要注意

代理可能在用户只希望获得报告时改写源代码、配置、依赖版本或锁文件,造成行为变化、兼容性问题或难以审查的附带变更。

该 Skill 会由“security audit”或“code quality review”触发,而实时审计工作流明确要求“修复相关代码”。只请求评估的用户可能因此遭遇未明确授权的文件修改;参考中的 `npm audit fix` 虽是示例,也进一步展示了可能改动依赖和锁文件的操作。用户应在运行前限定为只读审计,或要求作者把“报告”和“修复”拆成需要单独确认的阶段。

SKILL.md:2来自说明文档打开原文件
---name: best-practicesdescription: Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities".license: MIT
查看另外 4 个位置
SKILL.md:21来自说明文档打开原文件
3. Supplement runtime evidence with dependency, header, configuration, and source inspection; Lighthouse is not a complete security assessment.4. Fix the implicated code, re-run the same audit, and keep security findings separate from style preferences.
references/SECURITY.md:120来自说明文档打开原文件
```bash# Check for vulnerabilitiesnpm audityarn audit# Auto-fix when possiblenpm audit fix
SKILL.md:3来自说明文档打开原文件
name: best-practicesdescription: Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities".license: MIT
references/SECURITY.md:125来自说明文档打开原文件
# Auto-fix when possiblenpm audit fix
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
中风险

静态示例 nonce 若被直接应用,会削弱 CSP 的脚本保护

原文依据:2 处
发现了什么

参考把包含固定 `nonce-abc123` 的 CSP 标为推荐,并让脚本使用固定 `abc123`,但没有在相邻指导中说明 nonce 必须为每个响应重新生成且不可预测。固定或可预测 nonce 不能有效区分受信脚本与注入脚本。

为什么需要注意

若代理按示例实施,攻击者一旦得知该固定值,可能让注入的脚本通过 CSP,从而产生虚假的 XSS 防护感。

安全参考把含固定 `'nonce-abc123'` 的策略标为“recommended”,随后又展示固定 `abc123` 的脚本 nonce,却未在相关说明中要求每个响应生成新的不可预测值。虽然这些内容位于示例代码中,明显可能是占位符,但直接照抄会使 nonce 可预测并削弱 CSP 对注入脚本的区分。用户可要求作者明确标注占位符,并说明 nonce 必须逐响应安全生成且同步注入策略和脚本。

references/SECURITY.md:37来自说明文档打开原文件
**CSP Header (recommended):**```Content-Security-Policy:  default-src 'self';  script-src 'self' 'nonce-abc123' https://trusted.com;  style-src 'self' 'nonce-abc123';  img-src 'self' data: https:;  connect-src 'self' https://api.example.com;  frame-ancestors 'self';  base-uri 'self';  form-action 'self';```
查看另外 1 个位置
references/SECURITY.md:50来自说明文档打开原文件
**Using nonces for inline scripts:**```html<script nonce="abc123">  // This inline script is allowed</script>```
中风险

通过 HTML meta 设置 Permissions Policy 可能被浏览器忽略

原文依据:3 处
发现了什么

主说明建议用 `<meta http-equiv="Permissions-Policy">` 限制定位、摄像头和麦克风;Permissions Policy 应由 HTTP 响应头或 iframe 的 `allow` 属性传递。安全参考自身也展示的是响应头形式。

为什么需要注意

按主示例实施后,页面可能看似禁用了敏感能力,实际却未建立该限制;同源脚本或嵌入内容仍可能请求这些权限。

主说明把 `<meta http-equiv="Permissions-Policy">` 明确呈现为限制定位、摄像头和麦克风的方法,而安全参考对同一策略展示的是响应头。若浏览器不支持通过该 meta 指令实施策略,用户可能误以为敏感权限已被封锁。用户可要求作者删除或验证 meta 方案,并以部署后的 HTTP `Permissions-Policy` 响应头为准。

SKILL.md:420来自说明文档打开原文件
### Permissions policy```html<!-- Restrict powerful features --><meta http-equiv="Permissions-Policy"       content="geolocation=(), camera=(), microphone=()"><!-- Or allow for specific origins --><meta http-equiv="Permissions-Policy"       content="geolocation=(self 'https://maps.example.com')">```
查看另外 2 个位置
references/SECURITY.md:111来自说明文档打开原文件
# Control referrer informationReferrer-Policy: strict-origin-when-cross-origin# Permissions policy (formerly Feature-Policy)Permissions-Policy: geolocation=(), microphone=(), camera=()```
references/SECURITY.md:114来自说明文档打开原文件
# Permissions policy (formerly Feature-Policy)Permissions-Policy: geolocation=(), microphone=(), camera=()```
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 会在“安全审计”“代码质量审查”等请求下启动;工作流结合 Lighthouse 运行时结果、依赖、响应头、配置和源代码进行检查。

查看原文
SKILL.md:2来自说明文档打开原文件
---name: best-practicesdescription: Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities".license: MIT
SKILL.md:18来自说明文档打开原文件
1. Run a live Lighthouse Best Practices audit when that capability is available; with Chrome DevTools MCP, use `lighthouse_audit`. Use navigation mode for a normal page load or snapshot mode when the current state must be preserved.2. Inspect the listed console and network failures and fetch individual details only when they support a finding.3. Supplement runtime evidence with dependency, header, configuration, and source inspection; Lighthouse is not a complete security assessment.4. Fix the implicated code, re-run the same audit, and keep security findings separate from style preferences.

安全任务会引入单独的安全参考,其中包含 HTTPS、CSP、Trusted Types、依赖审计、输入净化和 Cookie 配置指导。

查看原文
SKILL.md:25来自说明文档打开原文件
## SecurityRead [the security reference](references/SECURITY.md) when security is in scope or a live audit surfaces a related failure. It covers HTTPS/HSTS, CSP and Trusted Types, Subresource Integrity, headers, dependencies, sanitization, and cookies.

工作流不仅生成报告,还指示代理修复代码并重新运行审计,因此它具有修改项目的预期行为。

查看原文
SKILL.md:21来自说明文档打开原文件
3. Supplement runtime evidence with dependency, header, configuration, and source inspection; Lighthouse is not a complete security assessment.4. Fix the implicated code, re-run the same audit, and keep security findings separate from style preferences.If live tools are unavailable, use the Lighthouse CLI plus focused dependency and header checks. Never report a high Lighthouse score as proof that the application is secure.
从这里开始 · 工作说明SKILL.md
best-practices
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。 另有 4 个章节,可在原文件中查看。

文件引用关系图

1 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录2 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • references/SECURITY.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • references/SECURITY.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:131来自说明文档打开原文件
**Never load polyfills from a third-party CDN you don't control.** The `polyfill.io` service was [compromised in mid-2024](https://sansec.io/research/polyfill-supply-chain-attack) in a supply-chain attack and used to serve malware to ~100k sites. Self-host, or use a vetted mirror (e.g. [Cloudflare's `cdnjs` polyfill build](https://blog.cloudflare.com/polyfill-io-now-available-on-cdnjs-reduce-your-supply-chain-risk/)) — and pin the version with [Subresource Integrity](#subresource-integrity-sri-for-third-party-scripts).
SKILL.md:153来自说明文档打开原文件
// ✅ Async fetchconst response = await fetch(url);
SKILL.md:429来自说明文档打开原文件
<meta http-equiv="Permissions-Policy"       content="geolocation=(self 'https://maps.example.com')">```
修改文件
SKILL.md:141来自说明文档打开原文件
// ❌ document.write (blocks parsing)document.write('<script src="..."></script>');
references/SECURITY.md:169来自说明文档打开原文件
element.innerHTML = userInput;document.write(userInput);
读取文件
SKILL.md:150来自说明文档打开原文件
const xhr = new XMLHttpRequest();xhr.open('GET', url, false); // false = synchronous
读取密钥或账号配置
SKILL.md:263来自说明文档打开原文件
module.exports = {  devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',};
运行命令
references/SECURITY.md:120来自说明文档打开原文件
```bash# Check for vulnerabilities
读取了多少行
677
文件校验值(用于核对版本)
f7365550bb24932ceb1aa0152c6a08813487d866c94aa4492e4f1ab3c9ea892e