跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

macos_attachments.go

30 行 · 719 B历史下载
1package workbench
2
3import (
4 "path"
5 "strings"
6
7 "github.com/google/uuid"
8)
9
10func (s *Server) validMacOSAttachmentPath(value, name string) bool {
11 if s.macosGuest == nil || strings.ContainsAny(value, "\\\x00\r\n") || path.Clean(value) != value {
12 return false
13 }
14 root := path.Join("/Users", s.macosGuest.User, ".local/share/cage/attachments/files") + "/"
15 relative, ok := strings.CutPrefix(value, root)
16 if !ok {
17 return false
18 }
19 parts := strings.Split(relative, "/")
20 if len(parts) != 3 || parts[2] != name || !browserFileName(name) {
21 return false
22 }
23 for _, part := range parts[:2] {
24 id, err := uuid.Parse(part)
25 if err != nil || id == uuid.Nil || id.String() != part {
26 return false
27 }
28 }
29 return true
30}