Skip to content

Sandbox env scrub misses custom apiKeyEnv and dynamic OAuth client secrets #676

Description

@PierrunoYT

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

  1. Configure a custom provider with "apiKeyEnv": "COMPANY_LLM_SECRET".
  2. Start Zero with COMPANY_LLM_SECRET=example-secret.
  3. Run a sandboxed command that prints it.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions