filesys

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

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

func TmpConfirmedDirPrefix() (string, error)

TmpConfirmedDirPrefix returns the absolute prefix path as constructed by filesys.NewTmpConfirmedDir().

Types

type ConstraintError

type ConstraintError struct {
	Op   string
	Path string
	Err  error
}

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

Jump to

Keyboard shortcuts

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