Skip to content

[gh-aw] Eliminate magic GH_AW_* secret references from lock files#25765

Merged
rolfbjarne merged 4 commits into
mainfrom
dev/rolf/gh-tokens
Jun 22, 2026
Merged

[gh-aw] Eliminate magic GH_AW_* secret references from lock files#25765
rolfbjarne merged 4 commits into
mainfrom
dev/rolf/gh-tokens

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

The dotnet/macios secret-audit report flags every secret name that appears in a compiled agentic workflow, including the "magic" fallback secrets that gh-aw emits as the tail of its token-resolution chains (GH_AW_GITHUB_TOKEN and GH_AW_GITHUB_MCP_SERVER_TOKEN). Those names showed up in all three *.lock.yml files even though we never configure them, because gh-aw bakes the full fallback expression into every safe-output handler, into the GitHub MCP server wiring, and into the checkout "Fetch additional refs" step.

Set explicit github-token: ${{ secrets.GITHUB_TOKEN }} overrides so the compiler short-circuits each fallback chain before it references the magic names:

  • tools.github.github-token → replaces the GH_AW_GITHUB_MCP_SERVER_TOKENGH_AW_GITHUB_TOKENGITHUB_TOKEN chain used by the GitHub MCP server container.
  • safe-outputs.github-token → replaces the GH_AW_GITHUB_TOKENGITHUB_TOKEN chain used by the safe-output handlers.
  • checkout.github-token (code-radiator only) → replaces the GH_AW_GITHUB_MCP_SERVER_TOKENGH_AW_GITHUB_TOKENGITHUB_TOKEN chain used by the "Fetch additional refs" step that checkout.fetch: ["*"] generates. GITHUB_TOKEN is sufficient to fetch refs from the same repository, so there is no functional change.

GH_AW_CI_TRIGGER_TOKEN is intentionally left in place in code-radiator. Unlike the chains above it is not a magic fallback: it is the documented secret gh-aw uses to push an empty commit after create-pull-request / push-to-pull-request-branch so that CI runs on the auto-created merge PRs (pushes made with GITHUB_TOKEN do not trigger workflow runs — a GitHub Actions security feature). Overriding it with GITHUB_TOKEN would silently stop CI from triggering on those PRs.

This branch also recompiles all three workflows with the locally installed gh-aw compiler (v0.79.8), which refreshes the generated lock files, the agentics-maintenance.yml maintenance workflow, actions-lock.json, and the gh-aw dependabot ignore entry.

After recompiling, the # Secrets used: block in each lock file lists only secrets that are actually configured:

Workflow Secrets
ci-postmortem.lock.yml COPILOT_GITHUB_TOKEN, GITHUB_TOKEN
code-radiator.lock.yml COPILOT_GITHUB_TOKEN, GH_AW_CI_TRIGGER_TOKEN, GITHUB_TOKEN
macios-reviewer.lock.yml COPILOT_GITHUB_TOKEN, GITHUB_TOKEN

gh aw compile reports 0 errors on all three workflows.

Inspired by dotnet/android#11685 (commit dbd72dd).

🤖 Pull request created by Copilot

rolfbjarne and others added 3 commits June 22, 2026 17:13
…ken chain

The secret-audit report flags every secret name that appears in the
compiled lock file, including the "magic" fallback secrets gh-aw emits as
the tail of its token-resolution chains (GH_AW_GITHUB_MCP_SERVER_TOKEN and
GH_AW_GITHUB_TOKEN). These leaked into code-radiator.lock.yml via the
"Fetch additional refs" step generated by `checkout.fetch: ["*"]`, whose
token defaults to the full magic fallback chain.

Set an explicit `checkout.github-token: ${{ secrets.GITHUB_TOKEN }}` so the
compiler short-circuits that chain. GITHUB_TOKEN is sufficient to fetch
refs from the same repository, so there is no functional change.

After recompiling, the `# Secrets used:` block lists only COPILOT_GITHUB_TOKEN,
GH_AW_CI_TRIGGER_TOKEN and GITHUB_TOKEN.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread .github/workflows/agentics-maintenance.yml Fixed
Comment thread .github/workflows/agentics-maintenance.yml Fixed
@rolfbjarne rolfbjarne marked this pull request as ready for review June 22, 2026 15:36
Copilot AI review requested due to automatic review settings June 22, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the repository’s gh-aw (GitHub Agentic Workflows) configurations to prevent “magic” GH_AW_* secret names from being embedded in compiled *.lock.yml workflows by explicitly setting github-token: ${{ secrets.GITHUB_TOKEN }} in workflow frontmatter, and then recompiling the lock files with a newer gh-aw compiler.

Changes:

  • Add explicit github-token overrides in the gh-aw frontmatter for tools.github, safe-outputs, and checkout (where used) to short-circuit gh-aw’s token fallback chains.
  • Recompile the affected workflows’ *.lock.yml outputs (and refresh generated maintenance/lock artifacts) using gh-aw v0.79.8.
  • Update Dependabot ignore configuration for gh-aw-actions entries.

Reviewed changes

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

Show a summary per file
File Description
.github/workflows/macios-reviewer.md Adds explicit github-token overrides for GitHub tool + safe-outputs.
.github/workflows/macios-reviewer.lock.yml Recompiled lock workflow; removes GH_AW_* secret fallback references and updates generated content to gh-aw v0.79.8.
.github/workflows/code-radiator.md Adds explicit github-token overrides for GitHub tool + checkout + safe-outputs.
.github/workflows/code-radiator.lock.yml Recompiled lock workflow; removes GH_AW_* secret fallback references and updates generated content to gh-aw v0.79.8.
.github/workflows/ci-postmortem.md Adds explicit github-token overrides for GitHub tool + safe-outputs.
.github/workflows/ci-postmortem.lock.yml Recompiled lock workflow; removes GH_AW_* secret fallback references and updates generated content to gh-aw v0.79.8.
.github/workflows/agentics-maintenance.yml Adds the generated gh-aw maintenance workflow (v0.79.8).
.github/dependabot.yml Adjusts ignore entries for gh-aw-actions dependencies.
.github/aw/actions-lock.json Updates gh-aw-actions entries (but see review comment about remaining drift).

Comment thread .github/aw/actions-lock.json
.github/workflows/agentics-maintenance.yml is auto-generated by the gh-aw
compiler (marked "DO NOT EDIT"), so any zizmor findings against it are not
actionable. Exclude it from the zizmor file discovery the same way the
generated *.lock.yml files are already excluded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rolfbjarne rolfbjarne enabled auto-merge (squash) June 22, 2026 15:43
@rolfbjarne rolfbjarne merged commit 931eb83 into main Jun 22, 2026
11 checks passed
@rolfbjarne rolfbjarne deleted the dev/rolf/gh-tokens branch June 22, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants