Skip to content

Env var allowlist (include) for Codex IDE (VS Code) + Codex app (+ CLI) when inheriting “core” or “none” #22023

@normancates

Description

@normancates

What variant of Codex are you using?

App, IDE Extension

What feature would you like to see?

Currently, the allowed keys for [shell_environment_policy] do not allow including an env variable that was not included with, say, inherit="core"

Please add a new include / allowlist capability to shell_environment_policy so Codex can inherit only a minimal base environment plus explicitly permitted variables. Variable names are custom and will vary, so this must support prefix/glob and/or regex patterns.

Examples:

[shell_environment_policy]
inherit = "core"
include = ["MYAPP_*", "CI_*"]          # prefix/glob
# or:
include_regex = ["^MYAPP_", "^CI_"]    # regex

Also helpful:

[shell_environment_policy]
inherit = "none"
include = ["MYAPP_*", "CI_*"]
# (or include_regex = [...])

Meaning: with inherit="none", only the allow listed vars are passed.

Additional information

Acceptance criteria:

Only base (core or none) + matched vars are visible to Codex and spawned tools (VS Code extension + Codex app, and ideally CLI for consistency).

Deterministic and auditable; supports empty include (pure core-only / none-only).

Clear precedence if an exclude option is also present.

Business impact:
Without this, users must choose between “too locked down to work” and “full inherit that risks leaking unrelated secrets,” which blocks compliant environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIappIssues related to the Codex desktop appconfigIssues involving config.toml, config keys, config merging, or config updatesenhancementNew feature or requestextensionIssues related to the VS Code extension

    Type

    No type
    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