sandbox

package
v0.0.0-...-1952693 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package nsjail contains a local copy of nsjail.

Package sandbox provides capabilities for sandboxing subprocesses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The subprocess command line.
	Cmd          []string
	Cwd          string
	AllowNetwork bool
	Env          map[string]string
	Mounts       []Mount
	// contains filtered or unexported fields
}

Config represents the configuration for a sandboxed subprocess.

type Mount

type Mount struct {
	// Path outside the nsjail that should be mounted inside the nsjail.
	Path string
	// Dest is the optional location to mount in the nsjail. If omitted, it will
	// be assumed to be the same as Path.
	Dest string
	// Writable controls whether the mount is writable by processes within the
	// nsjail.
	Writable bool
}

Mount represents a directory or file from the filesystem to mount inside the nsjail so that processes inside the nsjail can access it.

type Sandbox

type Sandbox interface {
	Command(context.Context, *Config) *exec.Cmd
}

func New

func New(tempDir string) (Sandbox, error)

New constructs a platform-appropriate sandbox.

Jump to

Keyboard shortcuts

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