envfilter

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package envfilter implements environment variable filtering for remote exec.

The C hook library sets MPROXY_CHANGED_ENVS with the names of variables that were added or modified after the hook was loaded. These are always forwarded. Other variables are filtered through configurable keep/remove patterns (similar to sudo's env_keep).

Patterns are either globs (filepath.Match syntax) or regexes delimited by slashes (e.g. /^AWS_/).

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 changed set (from MPROXY_CHANGED_ENVS) → 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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