std’s run time refuses a name that leaves its fs::Root::Dir through a symlink raceOpen and answer this issue on GitHub.
tools, compiler, ready, future · opened 2026-11-21 · updated 2026-11-21 · 0 comments
Part of #1433
A file permission file(Dir(…)) (#1433) is only worth what Outside holds: a name under Dir must not escape the root through a symlink swapped in between check and open. std’s run time today resolves a name under Dir with std::fs::canonicalize and then opens it (crates/nikaia-std/src/fs.rs, the functions around lines 202 and 285 that canonicalise the root and the name and compare them). If it canonicalises and then opens, it must instead resolve beneath the root (openat2 with RESOLVE_BENEATH on Linux, the platform’s counterpart elsewhere). Early WASI run times failed here.
Outside checked against symlink races: confirm how std’s run time resolves a name under Dir; where it canonicalises and then opens, resolve beneath the root instead. The defect is fixed as its own commit, with a test that puts a symlink out of the root (.stdout/.stderr: the open is refused with io::IoError::Outside).A name under fs::Root::Dir that reaches outside the root through a symlink is refused with io::IoError::Outside by a resolution beneath the root, not by canonicalise-then-open, shown by a test; that commit carries Fixes with this issue’s number, and the report has a Found: line per finding.
The file system part of std’s run time (crates/nikaia-std/src/fs.rs).
Split from #1433 by Claude Code