Documentation
¶
Overview ¶
Package safepath constrains filesystem paths for user-controlled inputs (cache roots, config discovery, recipe files) and performs reads/writes via os.Root where appropriate.
Index ¶
- func JoinUnder(root string, parts ...string) (string, error)
- func OpenReadWriteProbe(path string) (err error)
- func ReadFile(path string) (data []byte, err error)
- func Stat(path string) (info os.FileInfo, err error)
- func Under(root, path string) error
- func WriteFile(path string, data []byte, perm os.FileMode) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenReadWriteProbe ¶
OpenReadWriteProbe returns nil if path is a regular file that can be opened read-write via os.Root on the parent directory (used to detect user-writable known_hosts files).
func ReadFile ¶
ReadFile reads path using os.Root on the parent directory so the basename cannot traverse.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.