跳转到正文
报告库
用途分类 / 数据分析

Performance Optimization Skill 安全审计

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

Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.

第三方安全检查结论

发现安全风险

已检查文件
1
发现的风险
3
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
中风险

CI 示例使用未固定版本的 npx 包执行代码

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

该 Skill 建议运行 `npx bundlesize` 和 `npx lhci`,但没有固定包版本、校验来源或要求使用项目已锁定的依赖。若本机没有对应包,npx 可能从包注册表下载并立即执行代码。

为什么需要注意

在开发机或 CI 权限下执行被替换、被劫持或与预期不兼容的包代码,可能接触源码、环境变量和 CI 凭据,并改变构建结果。

源码确实建议在 CI 中运行两个未指定版本的 npx 包,也没有在这些命令附近要求只使用已锁定的本地依赖。npx 在缺少本地包时可能下载并执行注册表代码,因此存在供应链与 CI 凭据暴露风险;这证明的是可行风险,不代表恶意代码已经执行。

SKILL.md:432来自说明文档打开原文件
**Enforce in CI:**```bash# Bundle size checknpx bundlesize --config bundlesize.config.json# Lighthouse CInpx lhci autorun```
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

通用 public 缓存示例可能把 API 响应存入共享缓存

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

示例直接为“API responses”设置 `public, max-age=300`,没有在代码旁限定为公开、与用户无关的响应。文档其他位置虽给出正确警告,但复制该片段或自动应用它仍可能漏掉限制。

为什么需要注意

若端点返回登录用户、租户或权限相关内容,浏览器、代理或 CDN 的共享缓存可能在五分钟内把一个用户的响应提供给另一个用户。

示例直接把未展示鉴权或个性化条件的“API responses”标记为可由共享缓存保存五分钟。若复制到含用户、租户或权限数据的接口,其他用户可能收到缓存内容。文档随后明确说明缓存键必须包含查看者等输入,并禁止错误缓存每用户数据,这降低了误用可能,但没有让该通用代码片段本身变得安全。用户可要求示例仅用于明确公开且响应一致的端点。

SKILL.md:344来自说明文档打开原文件
// HTTP caching headers for static assetsapp.use('/static', express.static('public', {  maxAge: '1y',           // Cache for 1 year  immutable: true,        // Never revalidate (use content hashing in filenames)}));// Cache-Control for API responsesres.set('Cache-Control', 'public, max-age=300'); // 5 minutes```
查看另外 4 个位置
SKILL.md:327来自说明文档打开原文件
| Shared (Redis, Memcached) | All instances | Instances must agree, or the value is expensive to recompute | A network hop, and another service to run and monitor || CDN / edge | Everyone, per URL | Responses are public and identical for a given key | Invalidation is the hard part; assume you cannot recall a bad response quickly |
SKILL.md:354来自说明文档打开原文件
**Key design decides correctness.** Every input that changes the response belongs in the key: tenant, locale, permissions, feature flags. A key that omits the viewer is how one user's data gets served to another, and that ships as a performance win.
SKILL.md:366来自说明文档打开原文件
**Do not cache:** anything whose staleness is a correctness bug (balances, permissions, inventory at checkout), or per-user data under a key that does not identify the user. See `../../references/performance-checklist.md` for request coalescing, write strategies, negative caching, and the cache checklist.
SKILL.md:350来自说明文档打开原文件
// Cache-Control for API responsesres.set('Cache-Control', 'public, max-age=300'); // 5 minutes```
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 1 项风险
低风险

安装命令没有固定依赖版本

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

安装命令没有指定依赖版本。同样的命令以后可能下载不同代码,你实际安装的内容可能与这次检查时不同。

为什么需要注意

即使命令和报告没变,以后安装时也可能下载到另一份代码。

这是用于 CI 的实际命令示例,不只是文字提及。它通过 `npx` 执行未固定版本的 `bundlesize`;如果项目中没有已锁定的本地副本,npx 可能下载并运行注册表当时提供的代码,使日后执行内容发生变化。用户可要求作者固定版本并说明应使用项目锁文件中的依赖。

该 CI 示例通过 `npx` 执行未固定版本的 Lighthouse CI。若项目未预装并锁定该包,执行时可能联网获取并立即运行不同版本的代码,影响运行环境和 CI 凭据可接触范围。用户可限制为锁文件中固定的本地依赖。

SKILL.md:435来自说明文档打开原文件
# Bundle size checknpx bundlesize --config bundlesize.config.json
查看另外 3 个位置
SKILL.md:432来自说明文档打开原文件
**Enforce in CI:**```bash# Bundle size checknpx bundlesize --config bundlesize.config.json
SKILL.md:438来自说明文档打开原文件
# Lighthouse CInpx lhci autorun```
SKILL.md:437来自说明文档打开原文件
# Lighthouse CInpx lhci autorun```
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 的主要流程是先测量性能、定位瓶颈,再修改并复测;未达到阈值或造成测试失败的修改应撤回,随后添加监控或测试。

查看原文
SKILL.md:33来自说明文档打开原文件
```1. MEASURE  → Establish baseline with real data2. IDENTIFY → Find the actual bottleneck (not assumed)3. FIX      → Address the specific bottleneck4. VERIFY   → Measure again; keep or revert5. GUARD    → Add monitoring or tests to prevent regression```

它可能建议修改应用代码、数据库索引、连接池、缓存与 CI 配置,因此实际使用范围不只限于只读分析。

查看原文
SKILL.md:172来自说明文档打开原文件
```sqlCREATE INDEX idx_tasks_owner_created ON tasks (owner_id, created_at DESC);```
SKILL.md:195来自说明文档打开原文件
// GOOD: one pool per process, sized against the database's ceilingconst pool = new Pool({  max: 10,                        // instances × max must stay under max_connections  idleTimeoutMillis: 30_000,  connectionTimeoutMillis: 5_000, // fail fast instead of queueing forever});```
SKILL.md:432来自说明文档打开原文件
**Enforce in CI:**```bash# Bundle size checknpx bundlesize --config bundlesize.config.json# Lighthouse CInpx lhci autorun```

缓存部分明确提醒:缓存键必须包含租户、区域、权限和用户等所有影响响应的输入,并禁止把要求实时正确的数据或未区分用户的数据这样缓存。

查看原文
SKILL.md:354来自说明文档打开原文件
**Key design decides correctness.** Every input that changes the response belongs in the key: tenant, locale, permissions, feature flags. A key that omits the viewer is how one user's data gets served to another, and that ships as a performance win.
SKILL.md:366来自说明文档打开原文件
**Do not cache:** anything whose staleness is a correctness bug (balances, permissions, inventory at checkout), or per-user data under a key that does not identify the user. See `../../references/performance-checklist.md` for request coalescing, write strategies, negative caching, and the cache checklist.
从这里开始 · 工作说明SKILL.md
performance-optimization
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。
文件与检查记录1 个文件

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文

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

  • SKILL.md工作说明

代码和说明中提到的操作

运行命令
SKILL.md:48来自说明文档打开原文件
**Frontend:**```bash# Synthetic: Lighthouse in Chrome DevTools (or CI)
SKILL.md:62来自说明文档打开原文件
**Backend:**```bash# Response time logging
SKILL.md:433来自说明文档打开原文件
**Enforce in CI:**```bash# Bundle size check
安装其他软件包
SKILL.md:435来自说明文档打开原文件
# Bundle size checknpx bundlesize --config bundlesize.config.json
SKILL.md:438来自说明文档打开原文件
# Lighthouse CInpx lhci autorun```
读取了多少行
497
文件校验值(用于核对版本)
4183fc2e0ee955f525433f93d030a62154f44d9b4ea0ac0d6c0ce312720e91f0