fix(workflows): harden /squad router authorization - #1868
Conversation
Closes #1730 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🟡 Impact Analysis — PR #1868Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
tests (2 files)
This report is generated automatically for every PR. See #733 for details. |
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | No source files changed — changeset not required |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ✅ | CI passing | All checks passing |
Files Changed (3 files, +265 −4)
| File | +/− |
|---|---|
test/gh-aw-command-parse.test.ts |
+130 −3 |
test/gh-aw-quality.test.ts |
+45 −0 |
workflows/squad.md |
+90 −1 |
Total: +265 −4
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
There was a problem hiding this comment.
🟢 Approval recommended
The changes match the stated authorization/concurrency policy and are backed by targeted tests that assert the new guard and concurrency configuration.
Pull request overview
This PR hardens the /squad router workflow by adding issue/PR-scoped concurrency serialization and a fail-closed actor authorization guard for mutating modes, while preserving open access for explicitly read-only modes and maintaining existing dispatch safeguards.
Changes:
- Added issue/PR-scoped
concurrencyto serialize/squadruns withcancel-in-progress: false. - Introduced an explicit “Actor Authorization Guard” that permits only
status,research, andplanwithout authorization; all other recognized modes requirewrite/maintain/admin(orworkflow_dispatch). - Added focused test coverage asserting the concurrency block,
roles: all, and the authorization guard’s classification/decision behavior.
File summaries
| File | Description |
|---|---|
| workflows/squad.md | Adds roles: all, concurrency serialization, and a documented/declared authorization guard for mutating modes with a refusal pathway. |
| test/gh-aw-quality.test.ts | Adds parsing/assertions for the new concurrency block and validates roles: all. |
| test/gh-aw-command-parse.test.ts | Adds behavioral tests for the authorization guard’s mode classification and permission decision logic. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
/squadruns by issue or pull request withcancel-in-progress: falsestatus,research, and/squad planpreview open; require authorization for every other recognized modeAuthorization policy
For issue, issue-comment, and PR-review-comment triggers, the router checks
github.actorthrough GitHub's effective collaborator-permission API and permits onlywrite,maintain, oradmin. Exactworkflow_dispatchevents rely on GitHub's native write-access requirement, which also preserves the controlledsquad-implement-workerrelay. Unknown modes and unresolved signals require authorization or refuse; there is no permissive fallback.on.roles: allis intentional: current gh-aw defaults would otherwise silently pre-skip public actors before open modes or the explicit refusal comment can run.Validation
.github/workflowslayoutnpm run buildpassed in a clean proxy-backed scratch checkouttriagemakes the authorization suite failgh-aw security review
Fresh-workspace compilation reported
SQUAD_GITHUB_APP_PRIVATE_KEYandSQUAD_GITHUB_TOKENas unapproved restricted secrets because the ephemeral compiler workspace had no prior gh-aw manifest. Both references already exist in the imported shared workflow; this PR adds, removes, or redirects no secrets or actions. The diff was reviewed for credential exposure and shell injection, and the actor/repository values remain env-bound rather than interpolated into shell source.Working as Procedures (Prompt Engineer).
Closes #1730