Documentation
¶
Overview ¶
Package pathguard creates private directory trees without traversing aliases. It validates every existing ancestor before the first filesystem mutation and anchors each subsequent single-component create to a pinned parent directory.
Index ¶
- func InspectDirectory(path string) (os.FileInfo, string, error)
- func ValidateDirectoryPath(path string) (os.FileInfo, string, error)
- type CreateHook
- type Directory
- type OpenPin
- type Pin
- func EnsureChild(parent Directory, canonicalParent, name string, create bool, perm os.FileMode, ...) (string, os.FileInfo, Pin, bool, error)
- func EnsureDirectory(requested string, perm os.FileMode, open OpenPin, hook CreateHook) (string, os.FileInfo, Pin, error)
- func NewPin(canonicalPath, operationPath string, identity os.FileInfo, labels PinLabels) (Pin, error)
- type PinLabels
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InspectDirectory ¶
InspectDirectory rejects a symlink, junction, or other reparse point at path and returns the directory's identity and resolved path.
Types ¶
type CreateHook ¶
type CreateHook func() error
CreateHook runs after the pinned parent has been checked and immediately before it is checked again for a single-component create. It exists so platform race tests can deterministically exercise this boundary.
type OpenPin ¶
OpenPin opens and validates a directory handle. canonicalPath is the stable path used for full-chain validation; operationPath may be handle-relative.
type Pin ¶
Pin is an owned Directory capability.
func EnsureChild ¶
func EnsureChild(parent Directory, canonicalParent, name string, create bool, perm os.FileMode, open OpenPin, hook CreateHook) (string, os.FileInfo, Pin, bool, error)
EnsureChild validates or creates exactly one child through parent. It never recursively creates paths and rejects final-component aliases and reparse points before returning an owned pin.