Fix Copilot auth for leak scanner/fixer workflows via PAT pool - #36446
Conversation
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>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36446Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36446" |
There was a problem hiding this comment.
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
.mdfiles to importshared/pat_pool.md, run incopilot-pat-pool, and overrideengine.env.COPILOT_GITHUB_TOKENviacase(needs.pat_pool.outputs.pat_number, …). - Add
on.permissions: {}to force generation of the requiredpre_activationjob perpat_pool.README.mdknown issue guidance. - Recompile both
.lock.ymlworkflow twins withgh 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. |
PureWeen
left a comment
There was a problem hiding this comment.
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..9with the correct'NO COPILOT PAT AVAILABLE'default; byte-identical in both workflows and aligned with the pool'simport-schema. environment: gh-aw-agents → copilot-pat-pool— not a security regression.copilot-pat-poolis 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-oppre_activationjob thepat_pooljob depends on. It does not clobber the real per-jobpermissions:(agent stays read-only;safe_outputskeepsissues: write).- Lock/source integrity — recompiling both with
gh aw v0.80.9produces zero diff; both compile with 0 errors / 0 warnings. No stalegh-aw-agentsreferences remain. - Secret handling — the resolved PAT is excluded from the agent sandbox (
--exclude-env COPILOT_GITHUB_TOKEN), allCOPILOT_PAT_*are registered for log redaction, and thepat_pooljob 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.
…t#36446) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
No description provided.