libsandbox

package
v1.0.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 31 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

Index

Constants

View Source
const (
	ScrubOff         = "off"
	ScrubDenySecrets = "deny-secrets"
	ScrubStrict      = "strict"
)
View Source
const (
	ModeRO = "ro"
	ModeRW = "rw"
)

Variables

View Source
var ErrInvalidCarveout = errors.New("libsandbox: invalid carve-out")
View Source
var ErrInvalidSpec = errors.New("libsandbox: invalid spec")
View Source
var ErrIsolation = errors.New("libsandbox: isolation failure")
View Source
var ErrLandlockUnsupported = errors.New("libsandbox: landlock unsupported by kernel")

Functions

func Command

func Command(ctx context.Context, spec Spec, name string, args ...string) (*exec.Cmd, error)

func ControlPlaneEnvDeny

func ControlPlaneEnvDeny() []string

func DefaultEnvAllow

func DefaultEnvAllow() []string

func DefaultEnvDeny

func DefaultEnvDeny() []string

func EnvScrub

func EnvScrub(mode string, extraAllow, extraDeny []string) func(parent []string) []string

func LoadCarveouts

func LoadCarveouts(r io.Reader) (fs []FSCarveout, net []NetCarveout, err error)

func OverlayEnv

func OverlayEnv(env []string, set map[string]string) []string

func ParseEnvList

func ParseEnvList(s string) []string

func Preflight

func Preflight() error

func PreflightSyscallTap

func PreflightSyscallTap() error

PreflightSyscallTap reports whether SyscallTap can be built on this host. It returns nil when it can, and an ErrIsolation error naming the missing capability otherwise. Two things are required: a kernel with seccomp user-notify (5.0+), and a free listener slot, because a filter chain can hold only one user-notify listener. A process that already runs under a filter with a listener (a container runtime, WSL2's init, another sandbox) cannot install a second one: the kernel answers EBUSY.

func ScrubModeValid

func ScrubModeValid(mode string) bool

func SecretEnvDeny

func SecretEnvDeny() []string

func ShimMain

func ShimMain() (handled bool, err error)

func SystemExecDirs

func SystemExecDirs() []string

Types

type EnvPolicy

type EnvPolicy struct {
	Allow []string
	Deny  []string
}

func DefaultEnvPolicy

func DefaultEnvPolicy() EnvPolicy

func EnvPolicyForMode

func EnvPolicyForMode(mode string, extraAllow, extraDeny []string) (policy EnvPolicy, active bool)

func (EnvPolicy) Allowing

func (p EnvPolicy) Allowing(names ...string) EnvPolicy

func (EnvPolicy) Apply

func (p EnvPolicy) Apply(parentEnv []string) []string

func (EnvPolicy) Denying

func (p EnvPolicy) Denying(names ...string) EnvPolicy

func (EnvPolicy) Resolve

func (p EnvPolicy) Resolve(parentEnv []string) []string

type FSCarveout

type FSCarveout struct {
	Path  string `json:"path"`
	Mode  string `json:"mode"`
	Needs string `json:"needs"`
}

type NetCarveout

type NetCarveout struct {
	Host  string `json:"host"`
	Ports []int  `json:"ports,omitempty"`
	Needs string `json:"needs"`
}

type Spec

type Spec struct {
	WorkspaceRoot string

	Home string

	EnvAllow []string

	EnvSet map[string]string

	FS []FSCarveout

	Net []NetCarveout

	AllowPrivateEgress bool

	NetworkWall bool

	Tracker libtracker.ActivityTracker

	SyscallTap bool
}

Jump to

Keyboard shortcuts

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