envscrub

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package envscrub strips infrastructure credentials from the environment handed to agent subprocesses.

The daemon needs DATABASE_URL to reach its own Postgres. Every spawner builds its child's environment from os.Environ() verbatim, so that DSN reached the AI CLI, the shell it runs, and every program that shell started. A `go test` in an unrelated repo read it through os.Getenv("DATABASE_URL"), ran GORM AutoMigrate against it, and altered the live `users` table: five foreign columns, eighteen foreign tables, three rows written into the production auth table. Logins then failed with SQLSTATE 0A000 ("cached plan must not change result type") because the schema moved under connections that had already planned against it.

Nothing about that required a mistake by the operator. The DSN was correctly configured on the unit; inheritance did the rest, silently. So the fix belongs at the spawn boundary, not in any one repo's tests.

Scope: this covers what an agent inherits. It deliberately does NOT touch opt.ExtraEnv or a provider's own credentials — those are chosen per spawn and are how the AI CLI authenticates.

Index

Constants

View Source
const DenyEnvVar = "WICK_AGENT_ENV_DENY"

DenyEnvVar names the environment variable that overrides the default deny list. Comma-separated. A trailing "*" makes an entry a prefix glob; a leading "*" makes it a suffix glob. Set it to "-" to disable scrubbing entirely — an escape hatch for debugging, not for normal use.

Variables

This section is empty.

Functions

func Scrub

func Scrub(env []string) []string

Scrub returns a copy of env with denied keys removed. Entries that are not "KEY=VALUE" are passed through untouched — that shape is what os/exec expects, and reshaping it is not this function's job.

func ScrubOSEnv

func ScrubOSEnv() []string

ScrubOSEnv is the common case: os.Environ() with the deny list applied.

Types

This section is empty.

Jump to

Keyboard shortcuts

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