Repository navigation
Conversation
Per the documented safety policy, env.* expressions (e.g. ${{ env.GITHUB_TOKEN }})
are prohibited in workflow markdown. This removes env.* from the expression
allowlist so gh-aw compile rejects them with a clear error instead of propagating
them into the generated lock file.
- Remove envRegex and EnvRe from ExpressionValidationOptions
- Remove env.* from allowed expressions list in error messages
- Update tests: env.* now expects errors (was incorrectly allowed)
- Add TestEnvExpressionRejection regression test
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/2909de21-a895-4fd2-ba4a-a786ff534ce5
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR enforces compile-time rejection of env.* GitHub Actions expressions embedded in workflow markdown, preventing them from being silently accepted and propagated into the generated lock/runtime environment.
Changes:
- Removed
env.*from the expression allowlist and from validation option plumbing (EnvRe/envRegex) soenv.*is treated as unauthorized. - Updated the validation failure hint text to no longer list
env.*as permitted. - Updated and added tests to ensure
env.*(includingenv.X || 'literal') is rejected.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/workflow/expressions_benchmark_test.go | Updates benchmark validators to match the simplified expression validation options (no EnvRe). |
| pkg/workflow/expression_safety_validation.go | Removes env.* allowlisting and updates the user-facing “allowed expressions” hint accordingly. |
| pkg/workflow/expression_safety_test.go | Adjusts existing expectations to treat env.* as unauthorized and adds a regression test covering env.* rejection cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // env.* expressions were incorrectly allowed by the compile-time expression validator. | ||
| // These expressions are prohibited per the documented safety policy because they can | ||
| // expose environment variables (including secrets set as env vars) to AI agents. | ||
| // See: https://github.com/github/gh-aw/issues/XXXX |
There was a problem hiding this comment.
The test comment links to an issue placeholder (https://github.com/github/gh-aw/issues/XXXX). Please replace XXXX with the actual issue/PR number (or remove the link) so the reference doesn’t become a dead link in main.
| // See: https://github.com/github/gh-aw/issues/XXXX | |
| // See internal tracking for additional context. |
|
Hey The change is clean, focused, and the test coverage is thorough — One small housekeeping nit before merge: the new regression test contains a placeholder issue reference: // See: https://github.com/github/gh-aw/issues/XXXXIf this fix addresses a tracked issue, swapping Otherwise, this PR looks ready for maintainer review! 🎉 📋 Contribution guidelines check
Verdict: 🟢 Aligned — Quality:
|
|
🩺 Examination complete! CI Failure Doctor has delivered the diagnosis. Prescription issued! 💊 All PR checks are passing — no action needed |
|
🩺 Examination complete! CI Failure Doctor has delivered the diagnosis. Prescription issued! 💊 All PR checks are passing — no action needed |
|
/q the checks run in ci-doctor is incorrect. It claims all check are ok in https://github.com/github/gh-aw/actions/runs/23596732674/job/68715465435#step:9:1 But this one is failing https://github.com/github/gh-aw/actions/runs/23582442412/job/68667964598 Fix ci-doctor checks download |
|
🎩 Mission equipment ready! Q has optimized your workflow. Use wisely, 007! 🔫 |
The previous fix was too broad - it blocked env.GH_AW_SAFE_OUTPUTS and other internal gh-aw system variables, breaking TestOutputLabelJobGeneration tests. Restore a narrow allowlist for env.GH_AW_* (internal system variables) while keeping arbitrary env.* blocked. Also: fix dead link in TestEnvExpressionRejection comment (replace XXXX placeholder with descriptive note), and add env.GH_AW_* allowed cases to the regression test. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0728c5f9-b421-4652-b5c7-df6340b400f5 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 09dd9c0. The previous fix was too broad — it blocked The updated fix narrows the allowlist: |
Arbitrary
env.*expressions (e.g.${{ env.GITHUB_TOKEN }}) were silently accepted bygh-aw compileand wired into the agent's runtime environment via the generated lock file — despite being explicitly prohibited by the documented safety policy. Workflow authors depending on compile-time rejection for accidental secret exposure had no protection.env.GH_AW_*expressions (internal gh-aw system variables such asenv.GH_AW_SAFE_OUTPUTS) remain allowed, as they are set by the gh-aw runtime itself and do not expose user-defined secrets.Changes
env.*allowlist toenv.GH_AW_*only — replacedenvRegex/EnvRewithenvGhAwRegex/EnvGhAwRe(^env\.GH_AW_[a-zA-Z0-9_]+$) inExpressionValidationOptionsand all validation paths (property-access and comparison-extraction)env.GH_AW_* (gh-aw internal system variables only)instead of the previousenv.*authorized_env_variablerenamed tounauthorized_env_variable(now expects error);multiple_unauthorized_expressionsupdated to also assertenv.TESTis rejected;env variable with string default(env.X || 'literal') also now correctly errorsTestEnvExpressionRejectionregression test — covers blocked cases (env.GITHUB_TOKEN, plain vars, underscores, hyphens, mixed-content markdown) and allowed cases (env.GH_AW_SAFE_OUTPUTS,env.GH_AW_WORKFLOW_ID_SANITIZED)📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.