Skip to content

Fix Copilot auth for leak scanner/fixer workflows via PAT pool - #36446

Merged
PureWeen merged 1 commit into
mainfrom
fix/leak-workflows-pat-pool
Jul 8, 2026
Merged

Fix Copilot auth for leak scanner/fixer workflows via PAT pool#36446
PureWeen merged 1 commit into
mainfrom
fix/leak-workflows-pat-pool

Conversation

@kubaflo

@kubaflo kubaflo commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

The daily-leak-hunter and leak-fixer agentic workflows (added in #36342)
were the only gh-aw workflows using `environment: gh-aw-agents` with a bare
`secrets.COPILOT_GITHUB_TOKEN`, which is empty because org-level Copilot
billing isn't configured. Every scheduled/dispatched run on main failed at
the "Execute GitHub Copilot CLI" step with "No authentication information
found".

Wire both workflows into the Copilot PAT pool exactly like every other
working workflow (ci-status-*, copilot-review-tests, etc.):
- import shared/pat_pool.md (environment: copilot-pat-pool)
- switch environment gh-aw-agents -> copilot-pat-pool
- override engine.env.COPILOT_GITHUB_TOKEN via case() over COPILOT_PAT_0..9
- add on.permissions: {} to force the no-op pre_activation job the pat_pool
  import depends on (per shared/pat_pool.README.md Known Issues)

Recompiled both .lock.yml twins with gh aw v0.80.9 (matching ci-status-fix:
setup v0.80.9, firewall 0.27.7).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 10:22
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 8, 2026 10:22 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36446

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36446"

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 fixes authentication failures in the daily-leak-hunter and leak-fixer GitHub Agentic Workflows by switching them to the repository’s established PAT-pool pattern (shared/pat_pool.md + copilot-pat-pool environment) and recompiling their generated .lock.yml artifacts.

Changes:

  • Update both workflow source .md files to import shared/pat_pool.md, run in copilot-pat-pool, and override engine.env.COPILOT_GITHUB_TOKEN via case(needs.pat_pool.outputs.pat_number, …).
  • Add on.permissions: {} to force generation of the required pre_activation job per pat_pool.README.md known issue guidance.
  • Recompile both .lock.yml workflow twins with gh aw v0.80.9, updating pinned action/container versions accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
.github/workflows/daily-leak-hunter.md Switches the hunter workflow to PAT-pool auth via shared/pat_pool.md and copilot-pat-pool, including the required on.permissions: {}.
.github/workflows/daily-leak-hunter.lock.yml Regenerated compiled workflow reflecting PAT-pool wiring and updated gh-aw pinned action/container versions.
.github/workflows/leak-fixer.md Switches the fixer workflow to PAT-pool auth via shared/pat_pool.md and copilot-pat-pool, including the required on.permissions: {}.
.github/workflows/leak-fixer.lock.yml Regenerated compiled workflow reflecting PAT-pool wiring and updated gh-aw pinned action/container versions.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 8, 2026 10:26 — with GitHub Actions Inactive
@github-actions github-actions Bot added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Jul 8, 2026
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 8, 2026 10:26 — with GitHub Actions Inactive
@kubaflo kubaflo added the area-ai-agents Copilot CLI agents, agent skills, AI-assisted development label Jul 8, 2026

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adversarial multi-model review — 3 independent reviewers + consensus.

Clean. This PR correctly conforms daily-leak-hunter and leak-fixer to the established shared/pat_pool.md contract, matching the 9 PAT-pool workflows already in production. Verified against source and the compiled locks:

  • Token case() override — all 10 slots '0'..'9' → COPILOT_PAT_0..9 with the correct 'NO COPILOT PAT AVAILABLE' default; byte-identical in both workflows and aligned with the pool's import-schema.
  • environment: gh-aw-agents → copilot-pat-pool — not a security regression. copilot-pat-pool is the isolated, protected-branches-only environment, applied to every secret-bearing job (agent, detection, pat_pool, pre_activation, safe_outputs). No cross-environment secret becomes reachable.
  • on.permissions: {} — the documented workaround (gh-aw#30790) that forces the no-op pre_activation job the pat_pool job depends on. It does not clobber the real per-job permissions: (agent stays read-only; safe_outputs keeps issues: write).
  • Lock/source integrity — recompiling both with gh aw v0.80.9 produces zero diff; both compile with 0 errors / 0 warnings. No stale gh-aw-agents references remain.
  • Secret handling — the resolved PAT is excluded from the agent sandbox (--exclude-env COPILOT_GITHUB_TOKEN), all COPILOT_PAT_* are registered for log redaction, and the pat_pool job emits only the selected index (0–9), never a secret.

ℹ️ Non-blocking FYI (pre-existing, repo-wide — not introduced by this PR): In the generated locks, the detection (threat-detection) job's COPILOT_GITHUB_TOKEN references needs.pat_pool.outputs.pat_number, but pat_pool is not in that job's needs: (only activation, agent). Since Actions exposes only direct-dependency outputs, that resolves to the 'NO COPILOT PAT AVAILABLE' literal, so the threat scan fails open. Impact is contained: the detection execute + conclude steps are continue-on-error: true, so detection.result stays success and safe_outputs (if: needs.detection.result == 'success') still runs — issues/PRs are still posted. This is a property of the gh-aw compiler + shared pat_pool.md import (which wires pat_pool into activation/agent needs only) and is identical across all 11 PAT-pool workflows here (9 already in production). It is not fixable in these two source files — raising it purely as something worth a follow-up upstream with gh-aw if reliable threat-detection auth is wanted for pooled-PAT workflows.


Test coverage: These are CI/agentic-workflow config files; the compiler (gh aw compile, clean) + schema validation are the applicable checks — both pass.
Prior reviews: Existing approval (@PureWeen) and the Copilot reviewer's no-comment overview; this review is additive (lock/source-sync verification, environment-boundary analysis, and the detection fail-open note were not previously covered).
Methodology: 3 independent reviewers with adversarial consensus. One reviewer initially flagged the detection-token behavior as blocking; on verification its blocking-impact rationale was disproven (fail-open via continue-on-error), so it is reported as a non-blocking, pre-existing note rather than a defect in this PR.

@PureWeen
PureWeen merged commit 5535b43 into main Jul 8, 2026
12 of 13 checks passed
@PureWeen
PureWeen deleted the fix/leak-workflows-pat-pool branch July 8, 2026 15:04
@github-actions github-actions Bot added this to the .NET 10 SR9 milestone Jul 8, 2026
SyedAbdulAzeemSF4852 pushed a commit to SyedAbdulAzeemSF4852/maui that referenced this pull request Jul 27, 2026
…t#36446)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai-agents Copilot CLI agents, agent skills, AI-assisted development area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants