Skip to main content

safe_write

Function safe_write 

Source
pub fn safe_write(path: &Path, content: impl AsRef<[u8]>) -> Result<()>
Expand description

Write content to path, refusing to follow a symlink. On platforms that support symlink detection, returns an error if path is already a symlink so malicious workspace symlinks cannot redirect writes to arbitrary files. Falls back to a plain fs::write on platforms or edge cases where symlink detection is unavailable.