capture writes: a symlinked parent directory still escapes the output root
writeCaptureFileSync (added in #4298) closes the direct pre-planted-file case: writes go through a fresh mkdtemp staging directory and an atomic rename, so a planted symlink or hard link at the exact output path can no longer redirect the write.
A parent-directory case is still open. If a directory in the output path itself (e.g. extracted/ or assets/) is a planted symlink, both mkdtempSync(dirname(path)) and the final renameSync land inside whatever that symlink points to, not inside the intended output root. Most path segments are fixed strings the tool controls (page.html, tokens.json), but asset filenames are derived from the captured page — so a hostile page combined with a planted assets -> ~/somewhere symlink could still choose where inside that target directory the file lands.
Fix shape: a realpath containment check against the output root, run once per directory at creation, rejecting (or refusing to write into) a directory whose real path resolves outside the intended root.
Follow-up to #4298; not a regression in that PR, called out as a known remaining gap in review.
Source: heygen-com/hyperframes