pluginenv

package
v2.3.0-unstable.8 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 4 Imported by: ? 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 pluginenv builds the environment plugin processes start with.

Plugins run as separate processes (HashiCorp go-plugin). By default go-plugin hands a plugin the host's whole environment, which includes the host's own configuration and credentials. Plugin hosts (AI Studio and the microgateway) instead start plugins with SkipHostEnv and a Command from this package, so a plugin sees only the variables on DefaultAllowlist plus any the operator names in PLUGIN_ENV_PASSTHROUGH. go-plugin adds its own handshake variables on top.

Index

Constants

View Source
const EnvPassthrough = "PLUGIN_ENV_PASSTHROUGH"

EnvPassthrough ("PLUGIN_ENV_PASSTHROUGH") is a comma-separated list of extra host variables to pass to plugins. An entry ending in '*' matches every variable with that prefix ("GITHUB_RAG_*").

Variables

View Source
var DefaultAllowlist = []string{

	"PATH", "HOME", "USER", "TMPDIR", "TZ", "LANG", "LC_*",

	"SSL_CERT_FILE", "SSL_CERT_DIR",
	"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy",

	"GOMAXPROCS", "GOMEMLIMIT", "GOGC", "GODEBUG", "GOTRACEBACK",

	"PLUGIN_RUNTIME", "GATEWAY_MODE", "MICROGATEWAY_MODE", "PLUGIN_GRPC_MAX_MSG_BYTES",

	"EDGE_ID",
}

DefaultAllowlist is what every plugin gets from the host environment: process basics, locale, TLS trust, proxies, Go runtime tuning, and the non-secret settings the plugin SDK and shipped plugins read (runtime detection, edge ID). Entries ending in '*' are prefixes.

ALLOW_INTERNAL_NETWORK_ACCESS is deliberately left out: it relaxes the host's own checks, and a plugin should not inherit that relaxation unless the operator passes it through.

Functions

func Command

func Command(path string) *exec.Cmd

Command returns an exec.Cmd for a plugin binary whose environment is Environ(). Pair it with go-plugin's ClientConfig.SkipHostEnv, or go-plugin appends the host environment anyway.

func Environ

func Environ() []string

Environ returns the host variables a plugin may see, in KEY=value form: those on DefaultAllowlist and those named by PLUGIN_ENV_PASSTHROUGH. A pass-through entry that is only "*" is ignored, since it would pass the whole host environment; a pass-through that lets a host secret through is logged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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