fsroot

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fsroot decides which host directories the gateway may hand to an agent.

The operator lists allowed roots once at startup (NATIVE_AGENT_ALLOWED_ROOTS). A path is accepted when its real location (after resolving symbolic links) is a directory at or below one of the roots, so a link inside a root cannot point the agent elsewhere.

Index

Constants

This section is empty.

Variables

View Source
var ErrOutside = errors.New("path is not inside an allowed root")

ErrOutside is returned for paths that are not inside an allowed root.

Functions

func Within

func Within(base, path string) bool

Within reports whether path is base or below it (both must be clean absolute paths).

Types

type Set

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

Set is an immutable list of allowed roots.

func New

func New(roots []string) (*Set, error)

New resolves roots to real directories. Every root must exist.

func (*Set) Empty

func (s *Set) Empty() bool

Empty reports whether no roots are configured.

func (*Set) Resolve

func (s *Set) Resolve(dir string, extra ...string) (string, error)

Resolve returns the real path of dir if it is a directory inside an allowed root or inside one of the extra base directories (e.g. the run's workspace).

func (*Set) Roots

func (s *Set) Roots() []string

Roots returns the resolved roots.

Jump to

Keyboard shortcuts

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