Skip to main content

write_export_output

Function write_export_output 

Source
pub fn write_export_output(path: &Path, bytes: &[u8]) -> Result<()>
Expand description

Write one export payload to an operator-named --out path: parent chain pinned no-follow, a symlinked (or otherwise non-regular) destination REFUSED, bytes landed through a sibling temp file and a rename.

Shared by kranz export-traces --out and kranz export-corpus --out, which both used a bare std::fs::write. That truncates THROUGH a symlink, so an agent could plant corpus.jsonl~/.ssh/authorized_keys (or a git hook) in the repo root and have the operator’s own export overwrite it with partly agent-authored JSONL. Refusing the link is the point; the atomic rename is the same discipline the queue and ticket writers already use.

Lives here rather than in paths only because both exports are the callers; it is a candidate to move next to the other no-follow helpers.