Skip to main content

Module file_policy

Module file_policy 

Source
Expand description

Confined server file destinations shared by result sinks and blob verbs.

Constants§

EXPORT_ROOT_ENV
Environment override for the allowed save_to export root.
IMPORT_ROOT_ENV
Environment override for the confined server import directory.

Functions§

confined_file_roots
Both file verbs require disjoint canonical roots at the time of the call.
export_root
Resolve (and create) the allowed export root for save_to destinations. Defaults to ~/.khive/exports; overridable via KHIVE_SAVE_TO_ROOT.
import_root
Resolve (and create) the import root, defaulting to ~/.khive/imports.
open_import
Open the validated source and recheck the opened object’s type.
resolve_destination
validate_destination
Validate a client-supplied save_to path against the allowed export root and return the canonicalized destination. Rejects .. traversal, a resolved parent outside root, and an existing symlink at the destination. See crates/khive-mcp/docs/save-sink.md.
validate_import
Validate an existing import file without accepting symlinks within the root.