Skip to main content

Module sanitize

Module sanitize 

Source
Expand description

Input sanitisation for branch components and worktree root paths.

Every value that ends up in a git invocation passes through one of the functions here before being used. This module is the enforcement point for the NEVER invariants in the spec:

  • branch components are validated before use
  • root paths are canonicalised and confined to the repository tree

Functionsยง

canonicalize_root
Canonicalises root relative to repo_root, rejecting paths that escape the repository.
validate_branch_component
Validates that s is safe to use as a git branch component.