sandbox

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	R = Registry{
		// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type Env added in v0.0.8

type Env map[string]string

type Filesystem

type Filesystem struct {
	FullDiskReadAccess bool `toml:"fullDiskReadAccess"`
	NoCache            bool `toml:"noCache"`

	// Home control access to $HOME dir
	// if set - home available
	Home *Home `toml:"home"`

	ROPaths   []string `toml:"roPaths"`
	RWPaths   []string `toml:"rwPaths"`
	DenyPaths []string `toml:"denyPaths"`
}

type Home added in v0.0.9

type Home struct {
	// AllPaths allows access to any subpath under Home dir
	AllPaths bool `toml:"allPaths"`
	// SkipDefaultDenyList do not use default deny list
	SkipDefaultDenyList bool `toml:"skipDefaultDenyList"`
	// DenyList under home dir where access is forbidden
	DenyList []string `toml:"denyList"`
	// RW makes access to $HOME rw
	RW bool `toml:"rw"`
}

type Network

type Network struct {
	Deny bool `toml:"deny"`
}

type Policy

type Policy struct {
	Env        Env        `toml:"env"`
	Filesystem Filesystem `toml:"fs"`
	Network    Network    `toml:"net"`
}

func MergePolicies added in v0.0.5

func MergePolicies(p1, p2 Policy) (Policy, error)

func (*Policy) UnmarshalTOML added in v0.0.9

func (p *Policy) UnmarshalTOML(a any) error

type Registry

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

func (Registry) Lookup

func (r Registry) Lookup(id string) (Sandbox, bool)

func (Registry) Register

func (r Registry) Register(id string, s Sandbox)

type Sandbox

type Sandbox interface {
	Exec(ctx context.Context, cmd []string, policy Policy, logger *slog.Logger) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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