Skip to content

Classify GitHub context wildcard projections consistently in workflow env validation #76979

Closed

Description

@lpcox

Bug

Workflow environment validation recognizes the whole github context and github.token as credential-bearing, but not a wildcard projection of the same context. This leaves an inconsistent classification for expressions such as ${{ github.* }} and ${{ toJSON(github.*) }}.

This is a residual case after #76633, not a request to repeat that fix: the current implementation already recognizes all secrets-rooted paths, including wildcard paths. Ordinary vars references should not be classified as credentials merely because they use a wildcard.

Current source behavior

Verified against main revision f9f49d837a9bc5feec59a29e71ee77bc7545905c:

An earlier CLI v1.2.2 compilation accepted env: { SNAPSHOT: '${{ github.* }}' }. The current-main evidence here is source tracing, not a fresh full-CLI reproduction. No live Actions evaluation was performed; this issue does not claim that assigning an array directly to env is accepted at runtime or demonstrate any runtime value disclosure.

Suggested correction

Extend the shared credential-reference classifier to conservatively recognize wildcard projections that can select the credential-bearing members of the github context. Keep the distinction between that context-wide projection and named non-credential fields such as github.repository or projections over unrelated non-credential objects.

Use the existing strict-mode rejection/non-strict warning paths rather than changing the AST resolver's general handling of wildcards, which is also needed for valid expressions such as needs.*.result. Preserve supported engine-specific credential bindings and the existing handling of secrets.*.

Regression coverage

  • Assert credential classification for github.*, grouped/case-equivalent forms supported by the parser, and toJSON(github.*).
  • Exercise top-level workflow env and non-exempt engine.env: strict mode rejects these expressions without creating or overwriting a lock file; non-strict mode emits the existing warning.
  • Preserve rejection of direct github.token, whole-context github, and secrets.*/secrets.*.value references.
  • Preserve acceptance of safe named GitHub fields, quoted expression-like text, ordinary vars values, and unrelated wildcard expressions.
  • Separately document or test Actions evaluation semantics with synthetic values before making runtime claims.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions