Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaskedDirs ¶ added in v0.107.16
func MaskedDirs() []string
MaskedDirs are the credential directories hidden from sandboxed commands.
func ProtectedPaths ¶ added in v0.107.16
ProtectedPaths are the files under a workspace that a later session trusts without asking: project instructions and prompts, and git hooks.
func RootFromEnv ¶
func RootFromEnv() string
Types ¶
type Capability ¶ added in v0.107.16
type Capability struct {
Supported bool `json:"supported"`
Mechanism string `json:"mechanism"`
Platform string `json:"platform"`
NetworkControl bool `json:"network_control"`
ReadMasking bool `json:"read_masking"`
Reason string `json:"reason,omitempty"`
}
Capability reports whether this machine can confine a run's commands.
func Probe ¶ added in v0.107.16
func Probe() Capability
Probe checks the platform mechanism once per process by running a trivial confined command, so a binary that exists but cannot start (no user namespaces in a container) reports unsupported instead of failing later.
type Policy ¶
type Policy struct {
Mode string
Backend string
Root string
Network bool
Writable []string
ReadOnly []string
// Masked directories are neither readable nor writable inside the sandbox
// (credentials, the backend's own data). A workspace root inside one of them
// stays usable; a root that encloses one is refused.
Masked []string
// Protected paths stay readable but not writable, even inside a writable
// root: project instructions and hooks that a later, unsandboxed session
// would trust.
Protected []string
}
func ForRun ¶ added in v0.107.16
func ForRun(base *Policy, req RunRequest) (*Policy, error)
ForRun builds the policy for a run that asked for the workspace sandbox. A configured policy (base) is only ever tightened: its roots stay as they are, network stays off when either side turns it off, and the masks and protected paths are added. Without a configured policy the run's roots are the grants. The result fails closed: when the machine cannot confine commands an error is returned instead of a policy.
func FromContext ¶
type RunRequest ¶ added in v0.107.16
type RunRequest struct {
Root string
// Writable lists the run's other writable workspace roots.
Writable []string
Network bool
// Masked and Protected extend the defaults (MaskedDirs, ProtectedPaths).
Masked []string
Protected []string
}
RunRequest is a run's request to confine its commands to the workspace.