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 ¶
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 ¶
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 ¶
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.