mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-18 15:02:11 +00:00
Note: this PR does not change any behaviour of zed itself. The old sandbox implementation is still in use. The code in this PR is not considered secure. I'll need more time to torture it before I'm confident :) The old sandbox used `bwrap` to set up mounts to restrict FS access, and an in-sandbox network proxy to forward HTTP requests. It has significant limitations however: - it cannot restrict FS access to paths that don't exist at sandbox creation time. This means that files that become available while a command is running are unprotected - it cannot restrict FS access based on a glob - each individual mount must be specified explicitly - it cannot restrict network access that is not HTTP (i.e. SSH traffic). - it cannot change permissions while a sandboxed command is running - the grants given at the start of the execution are fixed. Agents can request to re-run the app with broader permissions, which is fine, but not great UX - it cannot detect whether a command failed because it hit the sandbox boundary or not. Again, agents can guess, but we'd like something more robust - it cannot dynamically prompt the user to escalate privileges The new sandbox has a different different design which solves these problems: - all restrictions go through seccomp user notifications - this allows us to register a supervisor process with the kernel to validate the syscalls of another program. This supervisor can run arbitrary userspace code to inspect syscalls before allowing/denying/modifying them - we create and upload a policy object to this supervisor which checks syscalls against this policy - if the policy says that the operation requires "ask"-ing, the supervisor will ask zed to show a prompt to the user and report a decision This design is a lot more unified, and since it is much more flexible, is also potentially suitable for sandboxing more parts of zed (user terminals, LSP servers, etc.). Release Notes: - N/A |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||