pathguard

package
v0.7.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathguard is the refusal every recursive delete of a derived directory passes, and the containment check every write at a manifest-named path passes. The install clears a directory named by a registry's resolve response and writes a file the same response names; neither string is covered by the archive digest or the attestation, so each is judged here before the filesystem sees it. Exported so the desktop client, which has the same two seams, can share it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectlyUnder

func DirectlyUnder(root, dir string) bool

DirectlyUnder reports whether dir is exactly one path segment below root (both cleaned): the one shape a managed install directory may have, so a destination a bad name resolved to is never cleared whatever it is.

func RefuseDangerousDir

func RefuseDangerousDir(dir, home string) error

RefuseDangerousDir refuses a directory this code must never delete recursively: one that is not absolute, a filesystem root, the home directory itself, or an ancestor of it. Anywhere else is the person's to lose — the managed roots are theirs to relocate.

func Under

func Under(dir, p string) bool

Under reports whether p is strictly inside dir (after cleaning both).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL