mounts

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mounts validates host bind mounts and guest mount targets.

Host workspace sources use a deny-list (DenyBasenames / $HOME) unless --i-know. Guest targets use OpenShell-style reserved roots (ControlRoots) so users cannot overwrite /osg control state — not a general Linux system-path denylist.

Index

Constants

View Source
const WorkdirInContainer = "/workspace"

WorkdirInContainer is where the host workspace is mounted.

Variables

View Source
var (
	// ControlRoots are in-guest paths owned by osg (must not be user-mounted over).
	ControlRoots = []string{
		"/osg",
		"/etc/osg",
		"/run/osg",
		"/run/netns",
		"/var/run/netns",
	}
	// OCIRuntimeMountRoots must not be used as workspace or user bind targets.
	OCIRuntimeMountRoots = []string{
		"/proc", "/sys", "/dev",
	}
)

OpenShell-aligned guest reserved roots (osg control plane + OCI runtime mounts). Intentionally not a general Linux system-path denylist for host sources — host workspace secrets use DenyBasenames / ResolveWorkspace instead.

View Source
var DenyBasenames = []string{
	".ssh", ".aws", ".gnupg", ".kube", ".docker", ".config",
	".cursor", ".codex", ".claude",
}

DenyBasenames are never auto-mounted as workspace (secrets / cloud CLIs). OpenShell relies more on --upload; osg still bind-mounts workspace, so this host-side check remains as hardening.

Functions

func PathsOverlap

func PathsOverlap(a, b string) bool

PathsOverlap reports whether a and b are equal or one contains the other.

func ResolveWorkspace

func ResolveWorkspace(path string, iKnow bool) (string, error)

ResolveWorkspace returns an absolute path and checks the deny-list. iKnow skips deny-list (still requires the path to exist as a directory).

func ValidateContainerMountTarget

func ValidateContainerMountTarget(target string) error

ValidateContainerMountTarget rejects user mounts that overlap reserved guest paths.

func ValidateUploadDest

func ValidateUploadDest(dest string) error

ValidateUploadDest rejects uploads into reserved control paths. Destinations under /workspace are always allowed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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