Documentation
¶
Overview ¶
Package sandbox defines the plugin interface for isolating managed CLI processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance interface {
// ID identifies this instance (provider-defined).
ID() string
// Exec returns an exec.Cmd that, when run OUTSIDE the sandbox by the agent,
// launches cmd/args inside the isolated environment.
Exec(cmd string, args []string, env map[string]string) (*exec.Cmd, error)
// Teardown releases resources associated with this instance.
Teardown(ctx context.Context) error
}
Instance is a prepared sandbox that can execute exactly one CLI invocation.
type Provider ¶
type Provider interface {
// Name identifies the provider; must be unique at the Manager level.
Name() string
// Prepare creates a new isolated environment and returns an Instance.
// The Instance is owned by the caller, which must call Teardown after use.
Prepare(ctx context.Context, spec cwtypes.SandboxSpec, scripts []Script) (Instance, error)
}
Provider prepares isolated environments in which child CLI processes can run. Implementations MUST be safe for concurrent use.
type Script ¶
type Script struct {
InnerPath string // path relative to the sandbox root
Mode os.FileMode // file mode
Contents []byte // literal bytes
}
Script is a file that a Provider copies into the sandbox before execution.
func NewEntrypointScript ¶
NewEntrypointScript builds a POSIX-sh script that exports env vars and execs cmd with args.
Directories
¶
| Path | Synopsis |
|---|---|
|
providers
|
|
|
noop
Package noop provides a pass-through sandbox provider.
|
Package noop provides a pass-through sandbox provider. |
|
scriptdir
Package scriptdir is a reference sandbox provider that writes scripts into a temp directory and runs them via /bin/sh.
|
Package scriptdir is a reference sandbox provider that writes scripts into a temp directory and runs them via /bin/sh. |
Click to show internal directories.
Click to hide internal directories.