Skip to content

V1.1.3: 修复跨源 CSRF 与任意路径写入漏洞#3

Open
jsun2020 wants to merge 1 commit into
Backtthefuture:mainfrom
jsun2020:fix/security-csrf-path-confinement
Open

V1.1.3: 修复跨源 CSRF 与任意路径写入漏洞#3
jsun2020 wants to merge 1 commit into
Backtthefuture:mainfrom
jsun2020:fix/security-csrf-path-confinement

Conversation

@jsun2020

Copy link
Copy Markdown
  • 新增 server/security.ts:提供 registerOriginGuard 与 confinePath/confineExistingPath 工具。
  • CORS 锁定为本机绑定端口(loopback + localhost),不再反射任意 Origin。
  • 所有变更型接口(POST/PUT/DELETE/PATCH)校验 Sec-Fetch-Site 或 Origin,阻断浏览器 drive-by 攻击。
  • manage/versions/trash 中每个接收路径的接口,对用户提交路径先做 realpath 解析再做白名单校验;白名单包含 /.claude、/.skill-hub、扫描到的项目根、SKILL_HUB_EXTRA_PATHS。
  • skillName 拒绝分隔符、.. 与盘符,防止 path.join 逃逸。
  • trash id 用正则校验形状,阻止 fs.rm 时的目录穿越。
  • 重新构建 dist/ 与 release/claude-skill-hub.tgz。

- 新增 server/security.ts:提供 registerOriginGuard 与 confinePath/confineExistingPath 工具。
- CORS 锁定为本机绑定端口(loopback + localhost),不再反射任意 Origin。
- 所有变更型接口(POST/PUT/DELETE/PATCH)校验 Sec-Fetch-Site 或 Origin,阻断浏览器 drive-by 攻击。
- manage/versions/trash 中每个接收路径的接口,对用户提交路径先做 realpath 解析再做白名单校验;白名单包含 ~/.claude、~/.skill-hub、扫描到的项目根、SKILL_HUB_EXTRA_PATHS。
- skillName 拒绝分隔符、.. 与盘符,防止 path.join 逃逸。
- trash id 用正则校验形状,阻止 fs.rm 时的目录穿越。
- 重新构建 dist/ 与 release/claude-skill-hub.tgz。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant