Documentation ¶
Overview ¶
Package helper runs external helpers with optional sandboxing and manages their status/args pipes.
Index ¶
Constants ¶
const ( // FortifyHelper is set for the process launched by Helper. FortifyHelper = "FORTIFY_HELPER" // FortifyStatus is 1 when sync fd is enabled and 0 otherwise. FortifyStatus = "FORTIFY_STATUS" )
Variables ¶
var ( ErrStatusFault = errors.New("generic status pipe fault") ErrStatusRead = errors.New("unexpected status response") )
var BubblewrapName = "bwrap"
BubblewrapName is the file name or path to bubblewrap.
var (
ErrContainsNull = errors.New("argument contains null character")
)
Functions ¶
func InternalChildStub ¶
func InternalChildStub()
InternalChildStub is an internal function but exported because it is cross-package; it is part of the implementation of the helper stub.
func InternalReplaceExecCommand ¶
InternalReplaceExecCommand is an internal function but exported because it is cross-package; it is part of the implementation of the helper stub.
func MustNewCheckedArgs ¶
MustNewCheckedArgs returns a checked argument writer for args and panics if check fails. Callers must not retain any references to args.
Types ¶
type Helper ¶
type Helper interface { // StartNotify starts the helper process. // A status pipe is passed to the helper if ready is not nil. StartNotify(ready chan error) error // Start starts the helper process. Start() error // Close closes the status pipe. // If helper is started without the status pipe, Close panics. Close() error // Wait calls wait on the child process and cleans up pipes. Wait() error // Unwrap returns the underlying exec.Cmd instance. Unwrap() *exec.Cmd }
func MustNewBwrap ¶
func MustNewBwrap(conf *bwrap.Config, wt io.WriterTo, name string, argF func(argsFD, statFD int) []string) Helper
MustNewBwrap initialises a new Bwrap instance with wt as the null-terminated argument writer. If wt is nil, the child process spawned by bwrap will not get an argument pipe. Function argF returns an array of arguments passed directly to the child process.
func New ¶
New initialises a new direct Helper instance with wt as the null-terminated argument writer. Function argF returns an array of arguments passed directly to the child process.
func NewBwrap ¶
func NewBwrap(conf *bwrap.Config, wt io.WriterTo, name string, argF func(argsFD, statFD int) []string) (Helper, error)
NewBwrap initialises a new Bwrap instance with wt as the null-terminated argument writer. If wt is nil, the child process spawned by bwrap will not get an argument pipe. Function argF returns an array of arguments passed directly to the child process.