envparse

package
v0.147.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: BSD-2-Clause Imports: 1 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 envparse provides simple parsers for KEY=VALUE-style CLI inputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSensitiveKey

func IsSensitiveKey(key string) bool

IsSensitiveKey reports whether key looks like it carries a secret value. Matching is case-insensitive substring against a fixed marker list.

func KeyValuePairs

func KeyValuePairs(raw string) map[string]string

KeyValuePairs parses a comma-separated KEY1=VALUE1,KEY2=VALUE2 string into a map. Empty input returns nil. Pairs without '=' are silently skipped. Whitespace around keys and values is trimmed.

func KeysOnly added in v0.139.4

func KeysOnly(env []string) []string

KeysOnly returns a copy of env entries (each in "KEY=VALUE" form, the same shape exec.Cmd.Env uses) reduced to their key names. It exists because the denylist approach used to fail open: a secret whose key name matched no marker reached the log, which is how the GitHub App private key arrived in every agent-claude pod log before its marker was added. A key name carries no secret, so logging names only cannot leak by construction. The split is at the first '=' so a value containing '=' is still discarded. Entries without '=' pass through unchanged. The input slice is not mutated.

func RedactForLog

func RedactForLog(env []string) []string

RedactForLog returns a copy of env entries (each in "KEY=VALUE" form, the same shape exec.Cmd.Env uses) where every value is replaced with the literal "***". Keys remain visible so operators can confirm which vars are passed without exposing the values. Entries without '=' pass through unchanged. The input slice is not mutated.

Unlike KeysOnly, which drops values entirely, this keeps the KEY=*** shape for callers that want to see that a value exists. It stars every value rather than consulting IsSensitiveKey, so it is fail-safe: no key name is trusted, and a secret under an unlisted key cannot reach the log.

Types

This section is empty.

Jump to

Keyboard shortcuts

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