file-upload-security

仓库创建 2026年7月1日最近提交 23 天前SkillHot 收录 22 天前
▸ 精选理由

覆盖常见绕过手法与防护链,适合后端上传接口加固。

这个 Skill 做什么

对用户上传文件做魔数校验、名称清洗、大小限制与隔离存储等防护。

帮你把用户上传文件从源头堵住危险:服务器端校验魔数(magic bytes),清理文件名、限制大小、做隔离域名存储并加 AV 扫描,能发现 polyglot 和伪装格式。适合所有接收用户文件的接口,用来防止远程代码执行、XSS、恶意文件传播等事故。特别在于不信任 Content-Type/扩展名,用二进制指纹和专门库做最终判定并隔离对外访问。

▸ 展开 SKILL.md 英文原文

Validate user uploads: MIME magic bytes, filename sanitization, size limits, separate serving domain, AV scanning, polyglot detection

开发编程文件上传魔数检测隔离存储通用
2
Stars
0
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/ShieldNet-360/secure-vibe/main/skills/file-upload-security/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/ShieldNet-360/secure-vibe/main/skills/file-upload-security/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# File Upload Security

## Rules (for AI agents)

### ALWAYS
- Verify **magic bytes** of every upload server-side. `Content-Type`
  and file extension are attacker-controlled and never sufficient.
  Use libmagic, `file-type` (Node), `mimetypes-magic` (Python),
  or Tika.
- Maintain an **allowlist** of accepted types per endpoint
  (`image/png`, `image/jpeg`, `application/pdf`, …). Deny everything
  else, including `text/html`, `image/svg+xml` (carries `<script>`),
  `text/xml`, and `application/octet-stream`.
- Sanitize filenames: strip directory components, normalize Unicode,
  reject `..`, NUL byte, control chars, reserved Windows names
  (`CON`, `PRN`, `AUX`, `NUL`, `COM1-9`, `LPT1-9`), a
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有