sidecar

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sidecar starts an extension's sidecar (extension version 1.1, docs/reference/extensions.md in the console repository) in its sandbox: the agent runs `edgeweir-node sidecar-exec` (ChildCommand) with a Spec in the environment; the child moves itself into the sidecar's cgroup, sets the resource limits, switches to the sidecar user, sets no_new_privs and a seccomp filter, and executes the binary with only the Spec's environment.

Index

Constants

View Source
const CapabilityHandoff = "edgeweir-node:sidecar-capabilities-v1"

CapabilityHandoff is the local version query's promise that every entry point clears inherited sidecar capabilities before it can start other processes.

View Source
const ChildCommand = "sidecar-exec"

ChildCommand is the hidden subcommand of the sandbox helper.

View Source
const SpecEnv = "EDGEWEIR_SIDECAR_EXEC_SPEC"

SpecEnv carries the Spec (JSON) from the agent to the helper.

Variables

View Source
var ErrUnsupported = errors.New("sidecars need Linux")

ErrUnsupported: this platform cannot isolate a sidecar.

Functions

func CapabilityHandoffSupported added in v1.8.0

func CapabilityHandoffSupported() (supported bool)

CapabilityHandoffSupported excludes cgo builds, whose non-Go threads cannot participate in the process-wide removal of the temporary inheritable bits.

func ClearInheritedCapabilities added in v1.8.0

func ClearInheritedCapabilities() error

ClearInheritedCapabilities keeps the agent's effective/permitted privileges but removes the sidecar exec bridge before nginx or other helpers can inherit it.

func InheritCapabilities added in v1.8.0

func InheritCapabilities(cmd *exec.Cmd) error

InheritCapabilities carries only the caller's existing sidecar privileges across an internal agent or sandbox-helper exec without file capabilities. The target must call ClearInheritedCapabilities before starting any children.

func RunChild

func RunChild(_ []string, stderr io.Writer) int

RunChild is the helper's main: it only returns on failure.

func Supported

func Supported() bool

Supported reports whether this platform can isolate sidecars.

Types

type Spec

type Spec struct {
	Binary string   `json:"binary"`
	Args   []string `json:"args"`
	Env    []string `json:"env"`
	Dir    string   `json:"dir"`
	UID    int      `json:"uid"`
	GID    int      `json:"gid"`
	// Cgroup is the sidecar's cgroup v2 directory ("": none; the limits
	// then come from rlimits only).
	Cgroup string `json:"cgroup,omitempty"`
	// MemoryBytes and Tasks become RLIMIT_DATA and RLIMIT_NPROC without a
	// cgroup (RLIMIT_NPROC counts the sidecar user's tasks).
	MemoryBytes uint64 `json:"memory_bytes"`
	Tasks       uint64 `json:"tasks"`
}

Spec is how the helper starts one sidecar.

Jump to

Keyboard shortcuts

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