//! Scratchpad containment: whether a command token provably stays inside the
//! session scratchpad.
use Path;
/// Whether one token of a command run inside the scratchpad provably stays
/// there. Rules, all fail-closed:
/// - `..` anywhere: rejected (can climb out of the scratch cwd).
/// - `:/` anywhere: rejected (URL / remote-host / list-of-paths shapes).
/// - Drive-designator shape (`C:x`, `c:\x`): rejected on every platform —
/// on Windows it targets a drive root or a per-drive cwd, never scratch.
/// - No path separator: fine — a bare word, flag, or PATH-resolved argv0.
/// - Rooted: must sit lexically inside the scratchpad. `has_root`, not
/// `is_absolute` — on Windows `/etc/passwd` is rooted but not "absolute"
/// (no drive prefix), yet still escapes the scratch cwd via the drive
/// root, so every rooted token gets the containment check.
/// - Relative with a separator: accepted only as a PLAIN path (no leading
/// `-`, no `=`) so flag-embedded paths (`-C/etc`, `--directory=/etc`,
/// `VAR=/etc`) can't smuggle a target past the rooted check.