runner

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package runner executes `specd verify` task commands under a pluggable isolation backend. The Runner interface separates policy (env scrubbing, shell selection, timeout — owned by the cmd/verify caller) from mechanism (how the process is actually isolated and observed). The default shRunner reproduces specd's historical, non-sandboxed `shell -c command` execution exactly; other backends (e.g. bwrap, container) implement the same interface for stronger isolation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunResult

type RunResult struct {
	ExitCode   int
	TimedOut   bool
	Stdout     string
	Stderr     string
	DurationMs int64
}

RunResult is the raw outcome of an execution, before it is folded into a VerificationRecord. It is presentation- and persistence-free.

type RunSpec

type RunSpec struct {
	Root    string        // working directory
	Shell   string        // shell binary, e.g. "sh"
	Command string        // command passed to `shell -c`
	Env     []string      // exact environment (already scrubbed)
	Timeout time.Duration // hard wall-clock budget
	Stdin   []byte        // optional bytes fed to the process's stdin (nil = none)
}

RunSpec is the fully-resolved description of one verify execution. The caller (cmd/verify) owns policy — env scrubbing, NUL rejection, shell selection — and hands the Runner a ready-to-execute spec. Runners must not re-derive policy; they only decide *how* the process is isolated.

type Runner

type Runner interface {
	Name() string
	Run(ctx context.Context, spec RunSpec) RunResult
}

Runner executes a verify command under some isolation backend. Name reports the sandbox identity recorded as evidence ("none" for the default shell runner; "bwrap"/"container" for the isolating backends added in a later wave). A Runner performs no state IO and renders nothing.

func NewShRunner

func NewShRunner() Runner

NewShRunner returns the default, non-isolating runner.

func SelectRunner

func SelectRunner(name string) (Runner, error)

SelectRunner resolves a sandbox name to a Runner, failing closed. The default ("none"/"") returns the historical shell runner. Any isolating backend whose underlying tool is absent from PATH is a hard error rather than a silent fallback — a verify run that asked for isolation must never quietly execute unisolated. The verify command surfaces the error and refuses to run.

Jump to

Keyboard shortcuts

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