Resolve dev-hawk github-env highs by tightening env-file usage in generated workflow steps#37586
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
github-env highs by tightening env-file usage in generated workflow steps
There was a problem hiding this comment.
Pull request overview
This PR addresses dev-hawk static-analysis High findings (zizmor github-env) by reducing unnecessary writes to $GITHUB_ENV in generated workflow steps, and adding a scoped suppression for the remaining intentional $GITHUB_ENV usage that derives from GitHub-provided runtime context.
Changes:
- Stop persisting
GH_AW_MCP_CLI_SERVERSvia$GITHUB_ENVand keep it step-local viaexportin the MCP gateway setup generation. - Annotate the GHES
GH_HOSTconfiguration step with azizmor: ignore[github-env]suppression tied to trustedGITHUB_SERVER_URL. - Update the GHES host step unit test to assert the suppression is present, and regenerate
dev-hawk.lock.ymlaccordingly.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/mcp_setup_generator.go |
Removes the $GITHUB_ENV write for GH_AW_MCP_CLI_SERVERS, keeping only a step-local export. |
pkg/workflow/ghes_host_step.go |
Adds a zizmor suppression annotation to the generated GHES host step. |
pkg/workflow/ghes_host_step_test.go |
Adds an assertion to ensure the suppression is present in the generated step. |
.github/workflows/dev-hawk.lock.yml |
Regenerates the locked workflow to reflect the generator updates (drop env-file write; include suppression). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 2
| return ` - name: Configure GH_HOST for enterprise compatibility | ||
| id: ghes-host-config | ||
| shell: bash | ||
| run: | | ||
| run: | # zizmor: ignore[github-env] GITHUB_SERVER_URL is set by GitHub Actions, not user input. | ||
| # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct |
| - name: Configure GH_HOST for enterprise compatibility | ||
| id: ghes-host-config | ||
| shell: bash | ||
| run: | | ||
| run: | # zizmor: ignore[github-env] GITHUB_SERVER_URL is set by GitHub Actions, not user input. | ||
| # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct |
|
Please post a brief status update summarizing the env-file tightening and any remaining blockers.
|
|
@copilot review all comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…host_step Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed both review comments — moved the |
|
|
||
| export GH_AW_ENGINE="copilot" | ||
| export GH_AW_MCP_CLI_SERVERS='["safeoutputs"]' | ||
| echo GH_AW_MCP_CLI_SERVERS='["safeoutputs"]' >> "$GITHUB_ENV" |
There was a problem hiding this comment.
@copilot review that this change does not break other downstream steps.
There was a problem hiding this comment.
No downstream steps are broken. GH_AW_MCP_CLI_SERVERS is consumed exclusively within the same step that sets it:
export GH_AW_MCP_CLI_SERVERS=...makes the variable available to any subprocess spawned by that shell.cat << EOF | node start_mcp_gateway.cjsruns Node.js as a subprocess in the same step and inherits all exported shell vars.start_mcp_gateway.cjscallsconvert_gateway_config_*.cjsviaexecSync(..., { env: process.env }), passing the inherited env through.convert_gateway_config_shared.cjsreadsprocess.env.GH_AW_MCP_CLI_SERVERS— which is populated from the exported variable.
There is no subsequent step (checked across all lock files) that references $GH_AW_MCP_CLI_SERVERS or ${GH_AW_MCP_CLI_SERVERS} in a run: script or env: block. The $GITHUB_ENV write was persisting the variable well past its actual scope of use; the export alone is sufficient.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot review all comments and address the two unresolved review threads.
|
|
Please refresh the branch and rerun the CGO build-wasm check after those fixes land.
|
|
@copilot review all changes and the impact of not using github_env |
Here is a full review of both changes and their GITHUB_ENV impact: Change 1:
|
Static analysis reported persistent High
zizmor github-envfindings indev-hawk.lock.yml, with one finding tied to GHES host wiring and another to MCP gateway env propagation. This PR removes the unnecessary env-file write and scopes suppression to the remaining intentional$GITHUB_ENVwrite derived from trusted GitHub runtime context.Security finding scope
dev-hawkgithub-envhotspots called out in the daily static-analysis report.dev-hawk.lock.yml.Generator changes
pkg/workflow/ghes_host_step.go)GH_HOSTpropagation via$GITHUB_ENVfor cross-step compatibility.zizmor: ignore[github-env]annotation as a standalone comment line immediately aboverun:, matching the# zizmor: ignore[...] - <reason>pattern used elsewhere in the codebase.pkg/workflow/mcp_setup_generator.go)GH_AW_MCP_CLI_SERVERSwrite to$GITHUB_ENV.export GH_AW_MCP_CLI_SERVERS=..., which is sufficient for in-step usage (all consumers —start_mcp_gateway.cjsandconvert_gateway_config_*.cjs— run as subprocesses within the same step and inherit the exported variable). No downstream steps reference this variable.Compiled workflow impact
/.github/workflows/dev-hawk.lock.ymlecho GH_AW_MCP_CLI_SERVERS=... >> "$GITHUB_ENV"in the MCP gateway step.run:.Focused test update
pkg/workflow/ghes_host_step_test.gozizmor: ignore[github-env].