envfilter

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package envfilter selects which environment variables are forwarded to remote commands. It receives environment slices and keep/remove patterns from broker and agent configuration, consumes MPROXY_CHANGED_ENVS from the exec interception layer when present, and feeds sanitized env slices to remoteexec and mproxy-agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter(env []string, keep []string, remove []string) []string

Filter returns a filtered copy of env suitable for sending to the remote.

Rules (applied in order):

  1. MPROXY_CHANGED_ENVS is always stripped from the output.
  2. If a var name matches any remove pattern → drop.
  3. If a var name is in the exec-interception changed set → keep.
  4. If a var name matches any keep pattern → keep.
  5. Otherwise → drop.

func Remove

func Remove(env []string, remove []string) []string

Remove returns a copy of env with variables matching any remove pattern stripped. Unlike Filter, there is no keep list — all non-matching vars are preserved.

func StripPathSegment added in v1.1.0

func StripPathSegment(env []string, dir string) []string

StripPathSegment returns a copy of env with `dir` removed from any PATH= entry. Useful when forwarding env to a remote process that has no use for a local-only directory (e.g. the path-stub mount). If the segment isn't present, env is returned unchanged. If removing it empties PATH, the PATH entry is dropped entirely.

Types

This section is empty.

Jump to

Keyboard shortcuts

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