Summary
scrubSensitiveEnv removes a static secret list plus AuthEnvVars from the built-in provider catalog. Zero also supports secret environment-variable names outside that catalog:
- arbitrary provider-profile
apiKeyEnv values, such as COMPANY_LLM_SECRET
- dynamic
ZERO_OAUTH_<NAME>_CLIENT_SECRET variables
Those values remain inherited by sandboxed commands.
Relevant code
internal/sandbox/runner.go: scrubSensitiveEnv derives keys only from a fixed list and providercatalog.All().
internal/config/types.go: ProviderProfile.APIKeyEnv accepts a configured variable name.
internal/config/resolver.go: the configured APIKeyEnv is read from the process environment.
internal/oauth/providers.go: envKey(name, "CLIENT_SECRET") constructs secret names dynamically.
Observed at commit 6fc1220.
Reproduction
- Configure a custom provider with
"apiKeyEnv": "COMPANY_LLM_SECRET".
- Start Zero with
COMPANY_LLM_SECRET=example-secret.
- Run a sandboxed command that prints it.
- The value is present because it is absent from the catalog-derived scrub list.
Suggested fix
Pass resolved sensitive env names from configuration into sandbox construction and scrub dynamic secret namespaces such as ZERO_OAUTH_*_CLIENT_SECRET. Add tests with a non-catalog apiKeyEnv and custom OAuth provider name.
Summary
scrubSensitiveEnvremoves a static secret list plusAuthEnvVarsfrom the built-in provider catalog. Zero also supports secret environment-variable names outside that catalog:apiKeyEnvvalues, such asCOMPANY_LLM_SECRETZERO_OAUTH_<NAME>_CLIENT_SECRETvariablesThose values remain inherited by sandboxed commands.
Relevant code
internal/sandbox/runner.go:scrubSensitiveEnvderives keys only from a fixed list andprovidercatalog.All().internal/config/types.go:ProviderProfile.APIKeyEnvaccepts a configured variable name.internal/config/resolver.go: the configuredAPIKeyEnvis read from the process environment.internal/oauth/providers.go:envKey(name, "CLIENT_SECRET")constructs secret names dynamically.Observed at commit
6fc1220.Reproduction
"apiKeyEnv": "COMPANY_LLM_SECRET".COMPANY_LLM_SECRET=example-secret.Suggested fix
Pass resolved sensitive env names from configuration into sandbox construction and scrub dynamic secret namespaces such as
ZERO_OAUTH_*_CLIENT_SECRET. Add tests with a non-catalogapiKeyEnvand custom OAuth provider name.