Documentation
¶
Overview ¶
Package safety provides path validation and atomic file writes used when importing bundles. The goal is to never let a malicious or malformed bundle write outside the Codex sessions directory, and to never partially overwrite a file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanRelPath ¶
CleanRelPath validates a ZIP entry name and returns it as a safe, canonical, forward-slash relative path. It rejects anything that could escape the destination: absolute paths, Windows drive/volume prefixes, backslashes, empty or "."/".." segments, and non-canonical forms.
func CopyAtomic ¶
CopyAtomic streams r into dest atomically: it creates any missing parent directories, writes to a temp file in the destination directory, fsyncs it, and renames it into place. On any failure before the rename, the temp file is removed and dest is left untouched.
func DestPath ¶
DestPath joins a cleaned relative bundle path onto the Codex home root and verifies, as defense in depth, that the result stays within root.
func IsSessionEntry ¶
IsSessionEntry reports whether a (already cleaned) relative path is a rollout file under sessions/YYYY/MM/DD/.
Types ¶
This section is empty.