Documentation
¶
Index ¶
- func MakeFsInMemory(disk filesys.FileSystem) filesys.FileSystem
- func MakeFsOnDiskSecure(root string, allowPrefixes ...string) (filesys.FileSystem, error)
- func MakeFsOnDiskSecureBuild(root string, allowPrefixes ...string) (filesys.FileSystem, error)
- func TmpConfirmedDirPrefix() (string, error)
- type ConstraintError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeFsInMemory ¶ added in v1.29.0
func MakeFsInMemory(disk filesys.FileSystem) filesys.FileSystem
MakeFsInMemory returns a filesystem that reads from disk and writes to memory. Read operations check the memory layer first, then fall back to the disk layer. Write operations only go to the memory layer, so the on-disk files are never modified.
The disk layer can be any filesys.FileSystem (e.g., an fsSecure instance to constrain reads to a root directory).
func MakeFsOnDiskSecure ¶
func MakeFsOnDiskSecure(root string, allowPrefixes ...string) (filesys.FileSystem, error)
MakeFsOnDiskSecure returns a secure file system which asserts any paths it handles to be inside root. When allowed prefixes are provided, followed absolute links are allowed to traverse into these directories. The root is not allowed to match an allowed prefix, this to ensure an FS instance can not reach into another FS when the allowed prefix configuration is static.
func MakeFsOnDiskSecureBuild ¶ added in v0.3.0
func MakeFsOnDiskSecureBuild(root string, allowPrefixes ...string) (filesys.FileSystem, error)
MakeFsOnDiskSecureBuild calls MakeFsOnDiskSecure, but configures the TmpConfirmedDirPrefix as an allowed prefix. NOTE: When e.g. being able to load remote bases is not a concern, opt to use MakeFsOnDiskSecure instead, unless running into specific traversal issues.
func TmpConfirmedDirPrefix ¶ added in v0.3.0
TmpConfirmedDirPrefix returns the absolute prefix path as constructed by filesys.NewTmpConfirmedDir().
Types ¶
type ConstraintError ¶
ConstraintError records an error and the operation and file that violated it.
func (*ConstraintError) Error ¶
func (e *ConstraintError) Error() string
func (*ConstraintError) Unwrap ¶
func (e *ConstraintError) Unwrap() error