Expand description
Read-only files opened beneath a trusted root without following links.
Functionsยง
- copy_
file_ beneath - Copy a regular file between two trusted roots without resolving a path after its parent has been validated. The destination must not already exist.
- create_
symlink_ beneath - Create a symlink below a trusted root without following or replacing any parent component. The target is stored verbatim and is never resolved.
- ensure_
directory_ beneath - Ensure a directory exists beneath a trusted root without following symlinks in any component.
- open_
directory_ handle - Open an absolute directory as a live handle for operations that must keep using the same directory even if an attacker renames a path component.
- open_
file_ beneath - Open a regular, single-link file through bound directory handles.
rootmust be an absolute, previously resolved trusted root. - open_
lock_ file_ beneath - Open an advisory lock file beneath a trusted root without following
symlinks. The caller owns the returned file and can hold an exclusive lock
with
fs2::FileExtfor the duration of a compound filesystem operation. - set_
command_ working_ directory - Make a child process start with its working directory bound to
directory. The descriptor remains open throughexec, so thefchdirruns before the close-on-exec flag can take effect and avoids a path-based cwd race. - validate_
directory_ beneath - Validate an existing directory beneath a trusted root without following symlinks in any component.
- write_
file_ beneath - Write a new file beneath a trusted root while directory and file handles remain bound to that root. Existing files (including symlinks) are never replaced.