allowedroots

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccessDenied = syscall.ENOENT

ErrAccessDenied is returned when access to a file or directory is denied by AllowedRootsFS policy. We use syscall.ENOENT (No such file or directory) instead of syscall.EACCES so that CopyOnWriteFs will correctly fall back to the base filesystem when paths are outside allowed roots.

Functions

func NewAllowedRootsFS

func NewAllowedRootsFS(source afero.Fs, allowedRoots []string) afero.Fs

NewAllowedRootsFS creates a new AllowedRootsFS that restricts access to files within the specified root directories.

Types

type AllowedRootsFS

type AllowedRootsFS struct {
	// contains filtered or unexported fields
}

AllowedRootsFS filters files and directories by checking if they are within allowed root directories. Only files within the specified root directories will be allowed, all others get an access denied error.

Note: This filesystem is intended to be a best-effort check and cannot provide any security guarantees.

func (*AllowedRootsFS) Chmod

func (s *AllowedRootsFS) Chmod(name string, mode os.FileMode) error

func (*AllowedRootsFS) Chown

func (s *AllowedRootsFS) Chown(name string, uid, gid int) error

func (*AllowedRootsFS) Chtimes

func (s *AllowedRootsFS) Chtimes(name string, atime, mtime time.Time) error

func (*AllowedRootsFS) Create

func (s *AllowedRootsFS) Create(name string) (afero.File, error)

func (*AllowedRootsFS) Mkdir

func (s *AllowedRootsFS) Mkdir(name string, perm os.FileMode) error

func (*AllowedRootsFS) MkdirAll

func (s *AllowedRootsFS) MkdirAll(name string, perm os.FileMode) error

func (*AllowedRootsFS) Name

func (s *AllowedRootsFS) Name() string

func (*AllowedRootsFS) Open

func (s *AllowedRootsFS) Open(name string) (afero.File, error)

func (*AllowedRootsFS) OpenFile

func (s *AllowedRootsFS) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

func (*AllowedRootsFS) Remove

func (s *AllowedRootsFS) Remove(name string) error

func (*AllowedRootsFS) RemoveAll

func (s *AllowedRootsFS) RemoveAll(path string) error

func (*AllowedRootsFS) Rename

func (s *AllowedRootsFS) Rename(oldname, newname string) error

func (*AllowedRootsFS) Stat

func (s *AllowedRootsFS) Stat(name string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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