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

Security And Hardening Skill 安全审计

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

Hardens code against vulnerabilities. Use when handling user input, authentication, data storage, or external integrations. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services. Use when auditing dependencies for known vulnerabilities, triaging package-manager audit findings, or assessing supply-chain risk in a new package. Use wh

第三方安全检查结论

发现安全风险

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

建议的密钥检查命令会把疑似密钥所在整行输出

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

命令对已暂存差异执行 grep,并直接打印包含 password、secret、api_key 或 token 的行。若由代理、CI 或带日志的终端执行,真实凭据可能进入会话记录、模型上下文或构建日志。同时,该检查只覆盖四种文字模式,不能可靠发现其他命名或格式的密钥。

为什么需要注意

凭据可能被更多人员或系统看到,且用户可能因该检查未报警而误以为提交中没有密钥。

这是面向使用者的实际检查步骤,不只是反面示例。`git diff --cached` 的内容被交给未使用静默选项的 `grep`,因此匹配到的整行会写入终端输出;若该行含真实凭据,代理会话、CI 日志或终端记录可能保存它。命令也只匹配四类名称,不能作为完整的密钥检测。用户可要求作者改用仅返回文件名/状态且脱敏的扫描器,并限制日志留存。

SKILL.md:370来自说明文档打开原文件
**Always check before committing:**```bash# Check for accidentally staged secretsgit diff --cached | grep -i "password\|secret\|api_key\|token"```
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
中风险

访问控制示例把未经字段白名单过滤的请求体交给更新函数

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

示例验证了资源归属后,将整个 req.body 传给 taskService.update。归属检查并不能阻止批量赋值;如果服务层允许 ownerId、状态、权限或其他敏感字段,调用者可能修改本不应由该接口控制的属性。

为什么需要注意

攻击者可能转移资源所有权、改变受保护状态,或修改其他敏感字段。

该示例确实先验证资源所有权,但随后把整个 `req.body` 交给更新服务,没有展示字段白名单或更新专用 schema。若服务层接受 `ownerId`、权限、状态等敏感字段,已认证的资源所有者可能通过批量赋值修改接口原本不应开放的属性。风险取决于未提供的服务层实现,因此这是可信的示例级风险,而非已证实的漏洞。用户可要求作者明确只传允许更新的字段。

SKILL.md:134来自说明文档打开原文件
// Always check authorization, not just authenticationapp.patch('/api/tasks/:id', authenticate, async (req, res) => {  const task = await taskService.findById(req.params.id);  // Check that the authenticated user owns this resource  if (task.ownerId !== req.user.id) {    return res.status(403).json({      error: { code: 'FORBIDDEN', message: 'Not authorized to modify this task' }    });  }  // Proceed with update  const updated = await taskService.update(req.params.id, req.body);  return res.json(updated);
查看另外 1 个位置
SKILL.md:133来自说明文档打开原文件
```typescript// Always check authorization, not just authenticationapp.patch('/api/tasks/:id', authenticate, async (req, res) => {  const task = await taskService.findById(req.params.id);  // Check that the authenticated user owns this resource  if (task.ownerId !== req.user.id) {    return res.status(403).json({      error: { code: 'FORBIDDEN', message: 'Not authorized to modify this task' }    });  }  // Proceed with update  const updated = await taskService.update(req.params.id, req.body);  return res.json(updated);
中风险

上传验证示例主要信任 MIME 声明,内容签名检查仅被列为可选

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

示例只检查 file.mimetype 和文件大小,并称仅在“关键”情况下检查 magic bytes。上传者通常可以伪造声明的类型;若把此示例当作完整验证,非图片内容也可能以允许的图片类型通过。

为什么需要注意

伪装文件可能进入存储,并在图像解析、转码、下载或后续展示时攻击处理组件或用户。

这是建议的上传验证示例,但实际强制检查仅覆盖客户端可伪造的 `file.mimetype` 和大小;内容魔数检查被表述为“if critical”,不是默认要求。若使用者将其当作完整防护,攻击者可把非图片内容声明为允许的 MIME 类型并通过该函数,后续风险取决于文件的存储、解析和提供方式。用户可要求作者默认验证内容签名,并在安全位置重新编码图片。

SKILL.md:257来自说明文档打开原文件
```typescript// Restrict file types and sizesconst ALLOWED_TYPES = ['image/jpeg', 'image/png', 'image/webp'];const MAX_SIZE = 5 * 1024 * 1024; // 5MBfunction validateUpload(file: UploadedFile) {  if (!ALLOWED_TYPES.includes(file.mimetype)) {    throw new ValidationError('File type not allowed');  }  if (file.size > MAX_SIZE) {    throw new ValidationError('File too large (max 5MB)');  }  // Don't trust the file extension — check magic bytes if critical}```
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 是一份防御性开发指南,要求先识别信任边界、资产和滥用场景,再实施安全控制;其本身没有可执行脚本。

查看原文
SKILL.md:21来自说明文档打开原文件
## Process: Threat Model FirstControls bolted on without a threat model are guesses. Before hardening, spend five minutes thinking like an attacker:1. **Map the trust boundaries.** Where does untrusted data cross into your system? HTTP requests, form fields, file uploads, webhooks, third-party APIs, message queues, and **LLM output** — plus the local values that look internal because the OS handed them to you: another process's command line or environment, filenames on a shared volume, a path in a job payload. Trust follows who *wrote* a value, not which channel delivered it. Every boundary is attack surface.2. **Name the assets.** What's worth stealing or breaking? Credentials, PII, payment data, admin actions, money movement.3. **Run STRIDE over each boundary** — a quick lens, not a ceremony:

指南将身份验证、敏感数据、外部服务、CORS、上传、限流和提权等高影响变更列为必须先取得人工批准的事项。

查看原文
SKILL.md:55来自说明文档打开原文件
### Ask First (Requires Human Approval)- Adding new authentication flows or changing auth logic- Storing new categories of sensitive data (PII, payment info)- Adding new external service integrations- Changing CORS configuration- Adding file upload handlers- Modifying rate limiting or throttling- Granting elevated permissions or roles

指南明确把模型输出和提示上下文视为不可信,并要求限制代理工具权限及对破坏性操作进行确认。

查看原文
SKILL.md:403来自说明文档打开原文件
- **Treat all model output as untrusted input (LLM05: Improper Output Handling).** Never pass LLM output straight into `eval`, SQL, a shell, `innerHTML`, or a file path. Validate and encode it exactly as you would raw user input.- **Assume prompts can be hijacked (LLM01: Prompt Injection).** Untrusted text in the context window — a user message, a fetched web page, a PDF — can carry instructions. The system prompt is not a security boundary; enforce permissions in code, not in the prompt.- **Keep secrets and other users' data out of prompts (LLM02 / LLM07).** Anything in the context can be echoed back. Don't put API keys, cross-tenant data, or the full system prompt where the model can repeat it.- **Constrain tool and agent permissions (LLM06: Excessive Agency).** Scope tools to the minimum, require confirmation for destructive or irreversible actions, and validate every tool argument.- **Bound consumption (LLM10: Unbounded Consumption).** Cap tokens, request rate, and loop/recursion depth so a crafted input can't run up cost or hang the system.- **Isolate retrieval data (LLM08: Vector and Embedding Weaknesses).** In RAG, treat the vector store as a trust boundary: partition embeddings per tenant so one user can't retrieve another's data, and validate documents before indexing so poisoned content can't steer answers.

该指南承认其 SSRF 示例仍存在 DNS 检查与实际连接之间的竞态,并为高风险场景建议固定解析地址或使用过滤代理。

查看原文
SKILL.md:220来自说明文档打开原文件
**Caveat — this still has a TOCTOU gap.** `fetch` resolves DNS again after the check, so an attacker using a short-TTL record can rebind to an internal IP between validation and connection. For high-risk surfaces, resolve once and connect to the pinned IP, or put a filtering agent in front (`request-filtering-agent` / `ssrf-req-filter`).
从这里开始 · 工作说明SKILL.md
security-and-hardening
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。 另有 8 个章节,可在原文件中查看。
文件与检查记录1 个文件

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文

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

  • SKILL.md工作说明

代码和说明中提到的操作

读取密钥或账号配置
SKILL.md:26来自说明文档打开原文件
1. **Map the trust boundaries.** Where does untrusted data cross into your system? HTTP requests, form fields, file uploads, webhooks, third-party APIs, message queues, and **LLM output** — plus the local values that look internal because t 2. **Name the assets.** What's worth stealing or breaking? Credentials, PII, payment data, admin actions, money movement.3. **Run STRIDE over each boundary** — a quick lens, not a ceremony:
SKILL.md:104来自说明文档打开原文件
app.use(session({  secret: process.env.SESSION_SECRET,  // From environment, not code  resave: false,
SKILL.md:170来自说明文档打开原文件
app.use(cors({  origin: process.env.ALLOWED_ORIGINS?.split(',') || 'http://localhost:3000',  credentials: true,
连接外部网站
SKILL.md:170来自说明文档打开原文件
app.use(cors({  origin: process.env.ALLOWED_ORIGINS?.split(',') || 'http://localhost:3000',  credentials: true,
SKILL.md:195来自说明文档打开原文件
// BAD: fetch whatever the user gives youawait fetch(req.body.webhookUrl);
SKILL.md:215来自说明文档打开原文件
await fetch(await assertSafeUrl(req.body.webhookUrl), { redirect: 'error' });```
运行命令
SKILL.md:371来自说明文档打开原文件
**Always check before committing:**```bash# Check for accidentally staged secrets
读取了多少行
525
文件校验值(用于核对版本)
23f960d6610b50c24380b3be1ecb610eade1584fd25c3c88016eea76ff6f9f02