Expand description
File and directory permission hardening.
On Unix these set POSIX mode bits; on other platforms they are no-ops that succeed (Windows ACLs are not modeled here).
Functionsยง
- ensure_
file_ private - If
pathexists and is accessible to group or others, tighten it to owner-only (0o600) and returnOk(Some(previous_mode)). If it is already private, or does not exist, returnOk(None). On non-Unix platforms this always returnsOk(None). - secure_
dir_ perms - Restrict a directory to owner-only read/write/execute (
0o700on Unix; no-op elsewhere). - secure_
file_ perms - Restrict a file to owner-only read/write (
0o600on Unix; no-op elsewhere). - write_
private - Write
contentstopathsuch that it is never readable by anyone but the owner, not even briefly.