Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSandboxInfo ¶
FormatSandboxInfo returns a human-readable description of the sandbox state.
Types ¶
type BwrapSandbox ¶
type BwrapSandbox struct {
// contains filtered or unexported fields
}
BwrapSandbox implements sandbox using bubblewrap (bwrap).
func NewBwrapSandbox ¶
func NewBwrapSandbox(projectDir string, level Level) *BwrapSandbox
NewBwrapSandbox creates a new bubblewrap sandbox.
func (*BwrapSandbox) IsAvailable ¶
func (s *BwrapSandbox) IsAvailable() bool
IsAvailable checks if bwrap is available on this system.
func (*BwrapSandbox) WrapCommand ¶
WrapCommand wraps a command for execution inside bubblewrap.
type CommandCleanupProvider ¶ added in v1.1.62
CommandCleanupProvider is implemented by sandboxes that create temporary command-side resources which must remain available until the process exits.
type ExecOpts ¶
type ExecOpts struct {
WritablePaths []string // Additional writable paths
ReadOnlyPaths []string // Additional read-only paths (for standard mode)
NetworkAccess bool // Enable network access
EnvVars map[string]string // Additional environment variables
WorkDir string // Working directory
Timeout time.Duration // Command timeout
}
ExecOpts contains options for executing a command in a sandbox.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages sandbox selection based on mode and availability.
func NewManager ¶
NewManager creates a new sandbox manager.
func (*Manager) GetForLevel ¶
GetForLevel returns the sandbox for a specific level, checking availability.
type NoneSandbox ¶
type NoneSandbox struct{}
NoneSandbox executes commands without any sandbox restrictions.
func NewNoneSandbox ¶
func NewNoneSandbox() *NoneSandbox
NewNoneSandbox creates a new no-op sandbox.
func (*NoneSandbox) IsAvailable ¶
func (s *NoneSandbox) IsAvailable() bool
IsAvailable always returns true.
func (*NoneSandbox) WrapCommand ¶
WrapCommand returns a plain command without any sandbox restrictions. It inherits the full parent environment and overlays opts.EnvVars on top.
type Sandbox ¶
type Sandbox interface {
// WrapCommand wraps a command for execution inside the sandbox.
WrapCommand(ctx context.Context, shell, cmd string, opts ExecOpts) *exec.Cmd
// IsAvailable checks if the sandbox can be used on this system.
IsAvailable() bool
// Name returns the sandbox implementation name.
Name() string
// Level returns the sandbox level.
Level() Level
}
Sandbox is the interface for sandbox implementations.