{"record":{"id":"368b25b599d33bc6","repo":"zed-industries/zed","slug":"sandbox-grant-path-is-not-absolute","errorCode":null,"errorMessage":"sandbox grant path {} is not absolute","messagePattern":"sandbox grant path (.+?) is not absolute","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/sandbox/src/util/canonical_path.rs","lineNumber":221,"sourceCode":"    /// Linux: an independent `O_PATH` descriptor to the same pinned inode,\n    /// duplicated (with `O_CLOEXEC`) so a validation server can own and send it\n    /// over `SCM_RIGHTS` without affecting this value's descriptor.\n    #[cfg(target_os = \"linux\")]\n    pub(crate) fn dup_fd(&self) -> io::Result<OwnedFd> {\n        self.fd.as_fd().try_clone_to_owned()\n    }\n}\n\n/// Reject a non-absolute grant path. Gated to the platforms whose constructors\n/// resolve paths against the process working directory; on WSL/other the path is\n/// a namespace-specific form that `Path::is_absolute` would misjudge, and its\n/// real resolution happens WSL-side (see `crate::windows_wsl`).\n#[cfg(any(target_os = \"linux\", target_os = \"macos\"))]\nfn require_absolute(path: &Path) -> io::Result<()> {\n    if path.is_absolute() {\n        Ok(())\n    } else {\n        Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\"sandbox grant path {} is not absolute\", path.display()),\n        ))\n    }\n}\n\n/// Windows: enforce that a stored grant path is one of the two shapes a\n/// sandboxed WSL command can name — a Windows drive path (`C:\\...` or `\\\\?\\C:\\...`,\n/// on NTFS) or a Linux-absolute path (`/...`, inside the WSL distro). Everything\n/// else (notably `\\\\wsl.localhost\\...` and other UNC paths, and relative paths)\n/// is rejected, so an invalid grant shape can't be represented as a\n/// [`CanonicalPathBuf`]. `Path::is_absolute` isn't used: it would reject a\n/// perfectly valid Linux-absolute grant like `/home/me` on Windows.\n#[cfg(target_os = \"windows\")]\nfn require_windows_grant_shape(path: &Path) -> io::Result<()> {\n    let text = path.to_string_lossy();\n    // Linux-absolute (WSL): exactly one leading '/'.\n    let is_wsl = text.starts_with('/') && !text.starts_with(\"//\");","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/sandbox/src/util/canonical_path.rs#L203-L239","documentation":"Validation helper in canonical_path.rs rejecting a sandbox grant path that is not absolute. It fires when a caller passes a relative path to resolve or from_canonical on platforms whose constructors resolve paths against the process working directory, which would make the grant depend on the CWD.","triggerScenarios":"Thrown at crates/sandbox/src/util/canonical_path.rs:221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the grant path to an absolute path before configuring the sandbox","Resolve the path against the intended base directory explicitly","Check configuration files for relative write-grant paths"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}