Commit dbd72dd
[gh-aw] Eliminate magic GH_AW_* secret references from lock files (#11685)
The dotnet/android secret-audit report flags every secret name that appears
in a compiled workflow, including the "magic" fallback secrets that gh-aw
emits as the tail of its token-resolution chain (`GH_AW_GITHUB_TOKEN` and
`GH_AW_GITHUB_MCP_SERVER_TOKEN`). Those names showed up in both
`*.lock.yml` files even though we never set those secrets in the
`copilot-pr-reviewer` environment, because gh-aw bakes the full fallback
expression into every safe-output handler and into the GitHub MCP server
wiring.
Set explicit `github-token: ${{ secrets.GITHUB_TOKEN }}` overrides at two
levels so the compiler short-circuits both fallback chains before they
reference the magic names:
- `safe-outputs.github-token` -> replaces the
`safe-output.github-token` -> `GH_AW_AGENT_TOKEN` ->
`GH_AW_GITHUB_TOKEN` -> `GITHUB_TOKEN` chain that safe-output handlers
(`create-issue`, `create-pull-request-review-comment`,
`submit-pull-request-review`) use.
- `tools.github.github-token` -> replaces the
`GH_AW_GITHUB_MCP_SERVER_TOKEN` -> `GH_AW_GITHUB_TOKEN` ->
`GITHUB_TOKEN` chain that the GitHub MCP server container uses.
The existing `assign-to-agent.github-token: ${{ secrets.ANDROID_TEAM_PAT }}`
override is left alone -- the Copilot assignment API requires a user-owned
fine-grained PAT and rejects `GITHUB_TOKEN`.
`GITHUB_TOKEN` is the correct choice (not `COPILOT_GITHUB_TOKEN`) for these
overrides because `COPILOT_GITHUB_TOKEN` is scoped to "Copilot Requests:
Read" only -- it has no `issues: write` / `pull-requests: write` scopes and
would 403 on every safe-output write. The safe-output processing jobs that
gh-aw generates run with their own elevated `permissions:` block, so the
default `GITHUB_TOKEN` already has the scopes they need.
After recompiling, the `# Secrets used:` block (and the machine-readable
`gh-aw-manifest:` JSON) in each lock file lists only secrets that are
actually configured:
nightly-fix-finder.lock.yml: ANDROID_TEAM_PAT, COPILOT_GITHUB_TOKEN,
GITHUB_TOKEN
android-reviewer.lock.yml: COPILOT_GITHUB_TOKEN, GITHUB_TOKEN
`gh aw compile` reports 0 errors / 0 warnings on both workflows.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 63ab087 commit dbd72dd
4 files changed
Lines changed: 31 additions & 35 deletions
File tree
- .github/workflows
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
0 commit comments