Skip to content

Group Policy + admin setting for environment variable expansion in CLI arguments #6389

Description

@denelon

Relevant area(s)

WinGet CLI

Description of the new feature / enhancement

If we decide to support environment variable expansion in user-supplied CLI arguments (see #6388 and #5551), the capability must be off by default and gated behind an admin setting with a corresponding Group Policy, so IT organizations can control the default/enforced behavior. This issue tracks creating/implementing that Group Policy (and the admin setting it backs).

Context: expanding ambient environment variables in argument values before execution has security implications — an ambient or poisoned environment could redirect an install location or inject installer arguments, which is sharper when winget runs elevated. The capability should therefore be disabled by default and centrally controlled.

This is a sub-issue of #6388 and is contingent on a go/no-go product decision on env-var expansion (tracked with #5551).

Proposed technical implementation details

  • Add an admin setting to enable environment variable expansion for CLI arguments.
  • Add a Group Policy (ADMX + registry) entry so IT can set the default/enforced behavior.
  • Apply consistently across the relevant arguments (--location, --override, --custom, log location, etc.).
  • Perform the expansion centrally during input-argument processing rather than in individual workflow tasks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureThis is a feature request for the Windows Package Manager client.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions