hostmount

package
v1.10.13 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package hostmount defines the fixed, allow-listed set of host bind mounts a privileged workspace may attach to a container. The host source path is owned by the server and resolved from a preset key — never supplied by the client — so the blast radius can never widen beyond these presets.

Index

Constants

View Source
const CustomHostRoot = "/mnt"

CustomHostRoot is the only host tree a privileged workspace may bind a custom path under. Deliberately narrow: /mnt is the conventional mount point for operator-managed external storage, so a bind under it can't reach system paths and stays useful for shared storage.

Variables

View Source
var ErrInvalidHostPath = errors.New("host path must be an absolute path under " + CustomHostRoot + "/ (e.g. " + CustomHostRoot + "/nas/app)")

ErrInvalidHostPath is returned when a custom host path is not a clean absolute path strictly under CustomHostRoot.

Functions

func ValidateCustomHostPath

func ValidateCustomHostPath(p string) (string, error)

ValidateCustomHostPath cleans p and verifies it is an absolute path strictly inside CustomHostRoot (a real subpath, not the root itself), with no traversal, returning the cleaned path. The source-under-/mnt rule is the trust boundary and can never widen.

Types

type Preset

type Preset struct {
	Key             string `json:"key"`
	Label           string `json:"label"`
	Description     string `json:"description"`
	Source          string `json:"source"`            // host path bound into the container
	DefaultTarget   string `json:"default_target"`    // container path used when none is given
	DefaultReadOnly bool   `json:"default_read_only"` // UI default for the read-only toggle
	AllowReadOnly   bool   `json:"allow_read_only"`   // whether read-only is meaningful/toggleable
	Danger          string `json:"danger"`            // warning shown to the operator
}

Preset is one allow-listed host bind. Source is the host path (server-owned); callers never accept a raw source from the client.

func All

func All() []Preset

All returns every preset, ordered by key (for catalog endpoints and the UI).

func Get

func Get(key string) (Preset, bool)

Get returns the preset for a key and whether it exists.

Jump to

Keyboard shortcuts

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