{"record":{"id":"467483a6bd7dfb23","repo":"denoland/deno","slug":"is-writable-or-readable-by-other-users","errorCode":null,"errorMessage":"'{}' is writable or readable by other users","messagePattern":"'(.+?)' is writable or readable by other users","errorType":"exception","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"cli/util/temp.rs","lineNumber":212,"sourceCode":"    );\n  }\n\n  let mode = metadata.permissions().mode();\n  if mode & 0o077 != 0 {\n    dir.set_permissions(std::fs::Permissions::from_mode(0o700))?;\n  }\n\n  let metadata = dir.metadata()?;\n  if metadata.uid() != current_uid {\n    bail!(\n      \"'{}' is owned by uid {}, not current uid {}\",\n      path.display(),\n      metadata.uid(),\n      current_uid\n    );\n  }\n  if metadata.permissions().mode() & 0o077 != 0 {\n    bail!(\n      \"'{}' is writable or readable by other users\",\n      path.display()\n    );\n  }\n\n  Ok(())\n}\n\n#[cfg(not(unix))]\nfn ensure_secure_temp_dir(path: &Path) -> Result<(), AnyError> {\n  let metadata = std::fs::symlink_metadata(path)?;\n  if metadata.file_type().is_symlink() || !metadata.is_dir() {\n    bail!(\"'{}' is not a directory\", path.display());\n  }\n  Ok(())\n}\n\nfn attempt_temp_dir_garbage_collection(","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/util/temp.rs#L194-L230","documentation":"Final check in `ensure_secure_temp_dir`: after chmod'ing the directory to 0700, Deno re-reads metadata and refuses to continue if any group/other permission bits (mode & 0o077) are still set. If the filesystem ignored or silently reverted the chmod, the directory could be readable or writable by others, which is unacceptable for temp node_modules.","triggerScenarios":"TMPDIR on a filesystem that does not faithfully apply Unix mode bits: Windows-mounted drvfs (9p) paths inside WSL, NFS with squashing/id mapping, some fuse filesystems, or ACL/DLP layers that re-expose permission bits after a chmod.","commonSituations":"WSL2 with TEMP pointing at /mnt/c (Windows NTFS through drvfs); NFS home directories exported with root_squash; enterprise endpoint-protection rewriting permissions; Docker volumes on network storage with unusual mount options.","solutions":["Move TMPDIR onto a native local filesystem — inside WSL use the ext4 VM's /tmp, not /mnt/c.","Unset the custom TMPDIR and fall back to the system default /tmp.","For NFS/fuse mounts, fix export/mount options so an owner's chmod actually applies.","Or set `export TMPDIR=$HOME/tmp` on a local disk (mkdir -p first)."],"exampleFix":"# before: WSL drvfs temp ignores chmod 0700\nexport TMPDIR=/mnt/c/Users/me/AppData/Local/Temp\ndeno install   # error: '<dir>' is writable or readable by other users\n\n# after: use the Linux-native temp inside WSL\nunset TMPDIR TMP\ndeno install","handlingStrategy":"validation","validationCode":"# probe whether TMPDIR's filesystem honors unix mode changes\nprobe=\"$(mktemp -d \"${TMPDIR:-/tmp}/permprobe.XXXX\")\"\nchmod 700 \"$probe\"\n[ \"$(stat -c %a \"$probe\")\" = \"700\" ] || echo \"TMPDIR does not enforce unix modes: ${TMPDIR:-/tmp}\"\nrm -rf \"$probe\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In WSL, use the Linux VM's /tmp — not /mnt/c (drvfs) — for temp.","Avoid NFS/fuse mounts for temp unless chmod-by-owner provably applies.","Watch for endpoint-protection/ACL tooling that rewrites permissions under temp."],"tags":["security","temp-dir","filesystem","wsl","nfs","permissions"],"backgroundTag":"insecure-temp-directory","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}