Skip to content

fix: emit GH_HOST: github.com on Install GitHub Copilot CLI step to prevent GHES host leakage#20992

Merged
pelikhan merged 5 commits intomainfrom
copilot/fix-gh-host-leak-in-cli-install
Mar 15, 2026
Merged

fix: emit GH_HOST: github.com on Install GitHub Copilot CLI step to prevent GHES host leakage#20992
pelikhan merged 5 commits intomainfrom
copilot/fix-gh-host-leak-in-cli-install

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

Summary

When a workflow sets env: GH_HOST: <ghes-host> (required for GHES), that value leaked into the Install GitHub Copilot CLI step. Because the Copilot CLI binary is always downloaded from github.com, explicitly pinning GH_HOST: github.com at the step level ensures the step is isolated from any workflow-level override, providing a defensive guard regardless of how the install script evolves.

Changes

  • pkg/workflow/copilot_installer.go: Explicitly emit env: GH_HOST: github.com on the Install GitHub Copilot CLI step. This step-level override isolates the install from any workflow-level GH_HOST value and only affects install_copilot_cli.sh; it has no impact on other workflow steps.
  • pkg/workflow/copilot_installer_test.go: Added GH_HOST: github.com assertions to all existing test cases plus TestCopilotInstallerCustomVersion.
  • pkg/workflow/testdata/wasm_golden/**: Regenerated golden files to reflect the new env: block.
  • .github/workflows/*.lock.yml: Recompiled all 173 workflow lock files to include the new env: block on the install step.

Testing

All existing unit tests pass. Golden files updated via go test -update. All 173 lock files recompiled via make recompile.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.



✨ PR Review Safe Output Test - Run 23098313105

💥 [THE END] — Illustrated by Smoke Claude ·

Copilot AI and others added 2 commits March 14, 2026 21:45
…revent GHES host leakage

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review March 14, 2026 22:11
Copilot AI review requested due to automatic review settings March 14, 2026 22:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent a workflow-level GH_HOST (e.g., a GHES hostname) from leaking into the “Install GitHub Copilot CLI” step by explicitly setting GH_HOST: github.com at the step level.

Changes:

  • Add a step-level env: GH_HOST: github.com override to the Copilot CLI install step generation.
  • Update unit tests to assert the presence of GH_HOST: github.com.
  • Regenerate wasm golden outputs to include the new env: block.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/copilot_installer.go Adds step-level GH_HOST override and documents the rationale.
pkg/workflow/copilot_installer_test.go Asserts GH_HOST: github.com is present in generated install steps.
pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/basic-copilot.golden Updates expected YAML output with the new env: block.
pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden Updates expected YAML output with the new env: block.
pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/with-imports.golden Updates expected YAML output with the new env: block.
Comments suppressed due to low confidence (1)

pkg/workflow/copilot_installer.go:26

  • The new comment says the Copilot CLI download "requires github.com authentication", but the current installer script downloads release artifacts via unauthenticated curl from github.com (actions/setup/sh/install_copilot_cli.sh). Consider rewording this comment to avoid implying authentication is required for the download step, or explicitly note what operation actually requires auth.
	// (e.g. a GHES hostname) does not leak into this step. The Copilot CLI binary is always
	// downloaded from github.com and requires github.com authentication. This step-level
	// env override only affects the install_copilot_cli.sh execution and has no impact on

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 29 to 33
" - name: " + stepName,
" run: /opt/gh-aw/actions/install_copilot_cli.sh " + version,
" env:",
" GH_HOST: github.com",
}
@pelikhan
Copy link
Contributor

@copilot recompile

… install step

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 14, 2026

@copilot recompile

Done — all 173 lock files recompiled in 950edff.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .visibility (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from pelikhan March 14, 2026 22:57
@pelikhan pelikhan added the smoke label Mar 14, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

Smoke test (Codex) complete.
Merged PRs: #20991 feat: update action-tag to use action pins mode (gh-aw-actions) with v0; #20989 Improve run details step summary: bullet points, aw version, and full aw_info rendering.
GitHub MCP: ✅
Serena MCP (activate + find_symbol>=3): ✅
Playwright title contains "GitHub": ✅
Web-fetch contains "GitHub": ✅
File write + cat verify: ✅
Build (GOCACHE=/tmp/go-cache GOMODCACHE=/tmp/go-mod make build): ✅
Overall status: PASS

🔮 The oracle has spoken through Smoke Codex ·

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

@github-actions
Copy link
Contributor

Smoke Test Results — Run §23098313105

Core Tests PR Review Tests
1 GitHub MCP ✅ 11 Update PR ✅
2 GH CLI MCP ✅ 12 Review Comments ✅
3 Serena MCP ✅ 13 Submit Review ✅
4 Make Build ✅ 14 Resolve Thread ⚠️
5 Playwright ✅ 15 Add Reviewer ✅
6 Tavily Search ✅ 16 Push to Branch ✅
7 File Writing ✅ 17 Close PR ⚠️
8 Bash Tool ✅
9 Discussion ✅
10 AW MCP ✅

Overall: PARTIAL (2 skipped, 0 failed)

💥 [THE END] — Illustrated by Smoke Claude ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude

- name: Install GitHub Copilot CLI
run: /opt/gh-aw/actions/install_copilot_cli.sh latest
env:
GH_HOST: github.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix — setting GH_HOST: github.com explicitly prevents GHES host leakage when the CLI install runs in enterprise environments.

- name: Install GitHub Copilot CLI
run: /opt/gh-aw/actions/install_copilot_cli.sh latest
env:
GH_HOST: github.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistent env override applied across all workflow lock files — this pattern ensures the Copilot CLI always authenticates against github.com regardless of the runner's GH_HOST context.

@github-actions
Copy link
Contributor

Commit pushed: 746d1f0

Generated by Changeset Generator

@pelikhan
Copy link
Contributor

…ses to fix TypeScript error

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 14, 2026

@copilot fix https://github.com/github/gh-aw/actions/runs/23098181708/job/67094490942

Fixed in 1918606. The CI js job was failing because json_object_to_markdown.cjs (added to main after our branch was cut) had invalid JSDoc type casts — /** @type {Record<string, unknown>} */ expr needs parentheses around the target: /** @type {Record<string, unknown>} */ (expr). Added both the source file and its test file to our branch with the fix applied.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js -success k/gh-aw/gh-aw/ac--is-ancestor git show�� --verify --quiet ndor/bin/git h-cleanup-succesgit --quiet 0/x64/bin/git git (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan pelikhan merged commit 5a8a60a into main Mar 15, 2026
@pelikhan pelikhan deleted the copilot/fix-gh-host-leak-in-cli-install branch March 15, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow-level GH_HOST leaks into Copilot CLI install step

3 participants