isolation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUserEnv

func ApplyUserEnv(cmd *exec.Cmd, root string)

ApplyUserEnv rewrites the child process environment so home, temp, and platform-specific user-data directories point into the instance root.

func Configure

func Configure(cfg *config.Config)

Configure updates the process-wide isolation state used by subsequent child process launches.

func CurrentConfig

func CurrentConfig() config.IsolationConfig

CurrentConfig returns the currently active isolation settings.

func DefaultExposePaths

func DefaultExposePaths(root string) []config.ExposePath

DefaultExposePaths returns the minimum built-in host paths required for the current platform to run isolated child processes.

func InstanceDirs

func InstanceDirs(root string) []string

InstanceDirs returns the directories that must exist under the instance root for isolation-aware child processes.

func IsSupported

func IsSupported() bool

IsSupported reports whether the current platform has an implemented isolation backend.

func MergeExposePaths

func MergeExposePaths(defaults []config.ExposePath, overrides []config.ExposePath) []config.ExposePath

MergeExposePaths merges built-in rules with user overrides. Rules are keyed by target path so later entries replace earlier ones for the same target.

func NormalizeExposePath

func NormalizeExposePath(item config.ExposePath) config.ExposePath

NormalizeExposePath fills implicit defaults and cleans path values so merge and validation logic can work with canonical paths.

func Preflight

func Preflight() error

Preflight validates the configured isolation state and prepares the instance runtime directories before any child process is launched.

func PrepareCommand

func PrepareCommand(cmd *exec.Cmd) error

PrepareCommand mutates the command in-place so it inherits the configured isolated environment before being started by the caller.

func PrepareInstanceRoot

func PrepareInstanceRoot(root string) error

PrepareInstanceRoot creates the directories required by the isolation runtime.

func ResolveInstanceRoot

func ResolveInstanceRoot() (string, error)

ResolveInstanceRoot resolves the instance root used to build the isolated filesystem and redirected user environment.

func Run

func Run(cmd *exec.Cmd) error

Run is the Start-and-Wait helper that keeps the same isolation behavior as Start while returning the command's final exit status.

func Start

func Start(cmd *exec.Cmd) error

Start prepares isolation for the command, starts it, and applies any post-start platform hooks required by the active backend.

func ValidateExposePaths

func ValidateExposePaths(items []config.ExposePath) error

ValidateExposePaths verifies the user-supplied path exposure rules before a child process is started.

Types

type AccessRule

type AccessRule struct {
	Path string
	Mode string
}

AccessRule describes the effective Windows-side access rule for a host path.

func BuildWindowsAccessRules

func BuildWindowsAccessRules(root string, overrides []config.ExposePath) []AccessRule

BuildWindowsAccessRules derives the host-path access policy used by the Windows restricted-token backend.

type MountRule

type MountRule struct {
	Source string
	Target string
	Mode   string
}

MountRule describes a source-to-target mount exposed inside the Linux isolation view.

func BuildLinuxMountPlan

func BuildLinuxMountPlan(root string, overrides []config.ExposePath) []MountRule

BuildLinuxMountPlan converts the merged expose-path configuration into the mount rules consumed by the Linux bubblewrap backend.

type UserEnv

type UserEnv struct {
	Home         string
	Tmp          string
	Config       string
	Cache        string
	State        string
	AppData      string
	LocalAppData string
}

UserEnv contains the redirected per-instance user directories injected into isolated child processes.

func ResolveUserEnv

func ResolveUserEnv(root string) UserEnv

ResolveUserEnv derives the redirected user directories rooted under the instance runtime area.

Jump to

Keyboard shortcuts

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