Skip to content

fix(gh-aw): enforce maintainer authorization for direct Squad commands - #2187

Merged
bradygaster merged 3 commits into
devfrom
bradygaster-maintainer-command-authorization
Oct 8, 2026
Merged

bradygaster merged 3 commits into
devfrom
bradygaster-maintainer-command-authorization

Conversation

@bradygaster

@bradygaster bradygaster commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

What

Enforces deterministic authorization for direct /squad commands and restricts open-mode outputs across the dispatcher, command router, custom safe-output jobs, and gh-aw conclusion handlers. Ships a coherent regenerated workflow package and integrity manifest, with no consumer hand-edits or release publication.

Why

Closes #2185. Direct slash commands previously bypassed the router's permission check and relied on agent instructions. An unprivileged invocation must not gain issue/PR creation, worker dispatch, acceptance artifacts, or unrelated tracking-issue writes through emitted agent output. This revision also includes the already-merged bootstrap cleanup fix from #2158 through its base ancestry, for the subsequent bradygaster/eShop update.

How

  • Share fail-closed actor/original-author authorization between direct and router paths, including changed-text edit evidence and live write/maintain/admin permission checks.
  • Preserve authenticated platform workflow_dispatch continuations; never derive that authorization from issue text or aw_context claims. Open-mode output restrictions remain in force for dispatched commands.
  • Restrict public status/review/research/plan outputs to the originating issue and permitted draft/nonterminal artifacts. Validate the complete batch before built-in handlers. Gate research/lifecycle custom jobs on successful safe-output enforcement.
  • Disable issue-writing failure/detection/noop conclusion paths and raw-noop activation/completion comments. Keep failure status, detection enforcement, logs and summaries. Conclusion tokens still have write permissions; pinned-runtime tests verify the configuration-controlled early exits.
  • Test the actual pinned gh-aw sanitizer, downstream lifecycle interpreter and diagnostic handlers, including positive mutation controls, failed-guard conclusion execution, and strict-compiled configuration mutations. Independent specialists revised both discovered bypasses; final bounded security re-review: APPROVE, no findings.
  • Addressed Copilot's test-maintenance findings: updated stale activation-capacity runtime documentation and reused the shared diagnostic runtime pin for sanitizer validation. Copilot re-review of f8563c7 reports 0 open findings; all inline threads are resolved. Its general recommendation for human review is advisory, not an approving human review.

Validation evidence

  • node workflows/shared/squad-install-verifier.mjs --write-source — passed; canonical/package sources and integrity manifest regenerated with gh-aw v0.89.22.
  • node workflows/shared/squad-install-verifier.mjs --check-source — passed, including strict compilation and normalized lock digest checks.
  • npm test -- --run test/gh-aw-command-authorization.test.ts test/gh-aw-command-parse.test.ts test/gh-aw-command-router-relay.test.ts test/gh-aw-quality.test.ts test/gh-aw-bootstrap-workflow.test.ts test/gh-aw-lifecycle-upsert.test.ts test/gh-aw-install-staging.test.ts test/gh-aw-improvement-worker.test.ts test/gh-aw-implement-workflow.test.ts — 894 passed across 9 suites, including complete consumer-installation fixtures and legitimate continuation cases.
  • npm test -- --run test/gh-aw-activation-capacity.test.ts test/gh-aw-command-authorization.test.ts — 62 passed after both Copilot corrections.
  • SKIP_BUILD_BUMP=1 npm run build — passed.
  • npm run lint — passed locally and in final CI.
  • npm run lint:eslint — passed locally and in final CI, 0 errors; repository-wide existing warnings remain.
  • node_modules/.bin/eslint test/gh-aw-command-authorization.test.ts test/gh-aw-command-parse.test.ts test/gh-aw-command-router-relay.test.ts test/gh-aw-quality.test.ts test/helpers/gh-aw-diagnostic-runtime.ts — passed on the security-approved revision.
  • node_modules/.bin/eslint test/gh-aw-activation-capacity.test.ts test/gh-aw-command-authorization.test.ts — passed after both Copilot corrections.
  • node_modules/.bin/markdownlint-cli2 docs/src/content/docs/guide/gh-aw.md — passed.
  • git diff --cached --check and git diff --check — passed; final PR scope is 17 intended files, no deletions.
  • Final required Squad CI run 37838884119 on f8563c7: gh-aw strict compile passed; test passed. Its full npm test completed with 10,642 passed, 2 skipped, 47 todo across 331 passed files.
  • Full local npm test -- --maxWorkers=4 was interrupted to honor the independent-revision worktree freeze; full-suite success above is the completed GitHub CI result, not that interrupted local run.

Local restore note: the corporate proxy lacked locked @types/node@26.6.4; local validation used available 26.6.3 with lockfile writes disabled. All tracked dependency manifests and the lockfile were restored unchanged. No dependency upgrade is included.


⚠️ Quick Check

  • If SDK/CLI source files changed: completed the applicable Changeset step below (npx changeset add / .changeset/*.md, direct CHANGELOG.md entry for maintainers, or skip-changelog label for no user-facing changes)

N/A: no SDK/CLI product source changed; this is workflow infrastructure, tests, and directly related documentation.

PR Readiness Checklist

The PR readiness bot will validate these automatically after push.
Check each item before requesting review. See CONTRIBUTING.md for full details.

Branch & Commit

  • Branch created from dev (not main)
  • Branch is up to date with dev (git fetch upstream && git rebase upstream/dev)
  • Verified diff contains only intended changes (git diff --cached --stat)
  • PR is not in draft mode (mark ready when checks pass)
  • Commit history is clean (squash fixups before review)

The focused implementation and test follow-ups will be squash-merged.

Build & Test

  • npm run build passes
  • npm test passes (all tests green)
  • npm run lint passes (type check clean)
  • npm run lint:eslint passes
  • For migration PRs (>20 files): include test output summary in PR description

Full-suite evidence is the successful final GitHub CI run above. Migration item is N/A: 17 files.

Changeset

  • Changeset added via npx changeset add (if packages/squad-sdk/src/ or packages/squad-cli/src/ changed)
  • Or direct CHANGELOG.md entry (maintainers only — write-protected for external contributors)
  • Or skip-changelog label applied (if no user-facing changes)

N/A under repository workflow-infrastructure requirements; no product source or release files changed.

Docs

  • README section updated (if new feature/module)
  • Docs feature page (if new user-facing capability)

The gh-aw guide documents authorization, public output limits, diagnostic behavior, and complete-package upgrades. No new README module.

Exports

  • package.json subpath exports updated (if new module)

N/A: no SDK module or export changes.


Breaking Changes

No public SDK/CLI API changes. Intentional security hardening rejects commands lacking trusted identities and unrelated public-mode outputs. Dispatcher/router diagnostics no longer create tracking issues or forward raw noop text into status comments. Install/update the complete native package at one reviewed immutable SHA; do not patch integrity-pinned files individually.

Waivers

None requested. Required tests/compile and current-head Copilot review are complete. No required check or review policy is bypassed. The existing default-branch Changeset Drift failure (68 pending fragments; run 37751291755) is unrelated; this PR's Changeset Drift check passed.

Closes #2185

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83321e5d-2358-40a2-9307-bf37b077165b
Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:06
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2187

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 17
Files added 2
Files modified 15
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 17 files changed (6-20 → MEDIUM)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

docs (1 file)
  • docs/src/content/docs/guide/gh-aw.md
root (10 files)
  • workflows/package/squad-command-router.md
  • workflows/package/squad-deps-worker.md
  • workflows/package/squad-implement-worker.md
  • workflows/package/squad-retro.md
  • workflows/package/squad.md
  • workflows/shared/squad-command-contract.mjs
  • workflows/shared/squad.md
  • workflows/squad-command-router.md
  • workflows/squad-workflows.manifest.json
  • workflows/squad.md
tests (6 files)
  • test/gh-aw-activation-capacity.test.ts
  • test/gh-aw-command-authorization.test.ts
  • test/gh-aw-command-parse.test.ts
  • test/gh-aw-command-router-relay.test.ts
  • test/gh-aw-quality.test.ts
  • test/helpers/gh-aw-diagnostic-runtime.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit f8563c7

PR Scope: 🔧 Infrastructure

⚠️ 2 item(s) to address before review

Status Check Details
❌ Single commit 3 commits — consider squashing before review
✅ 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 All 1 Copilot thread(s) resolved
✅ CI passing All checks passing

Files Changed (17 files, +1111 −243)

File +/−
docs/src/content/docs/guide/gh-aw.md +64 −9
test/gh-aw-activation-capacity.test.ts +21 −34
test/gh-aw-command-authorization.test.ts +553 −0
test/gh-aw-command-parse.test.ts +5 −5
test/gh-aw-command-router-relay.test.ts +45 −44
test/gh-aw-quality.test.ts +10 −12
test/helpers/gh-aw-diagnostic-runtime.ts +164 −0
workflows/package/squad-command-router.md +26 −50
workflows/package/squad-deps-worker.md +2 −0
workflows/package/squad-implement-worker.md +2 −0
workflows/package/squad-retro.md +2 −0
workflows/package/squad.md +26 −10
workflows/shared/squad-command-contract.mjs +119 −2
workflows/shared/squad.md +2 −0
workflows/squad-command-router.md +27 −50
workflows/squad-workflows.manifest.json +17 −17
workflows/squad.md +26 −10

Total: +1111 −243


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

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.

🔵 Needs a closer look

The security-sensitive workflow boundary requires final human review and successful required CI checks.

0 open findings

What changed in this PR

Hardens gh-aw command authorization and safe-output handling across direct and routed /squad commands.

Changes:

  • Adds shared fail-closed authorization and open-mode output restrictions.
  • Prevents diagnostic/conclusion paths from bypassing output guards.
  • Regenerates package artifacts, integrity metadata, tests, and documentation.
File Description
workflows/​squad.md Enforces authorization and disables unsafe diagnostics.
workflows/​squad-workflows.manifest.json Updates generated integrity digests.
workflows/​squad-command-router.md Uses shared authorization and output enforcement.
workflows/​shared/​squad.md Gates custom writers on safe-output success.
workflows/​shared/​squad-command-contract.mjs Implements authorization and open-mode validation.
workflows/​package/​squad.md Regenerates the packaged dispatcher.
workflows/​package/​squad-retro.md Regenerates shared job guards.
workflows/​package/​squad-implement-worker.md Regenerates shared job guards.
workflows/​package/​squad-deps-worker.md Regenerates shared job guards.
workflows/​package/​squad-command-router.md Regenerates the packaged router.
test/​helpers/​gh-aw-diagnostic-runtime.ts Adds a pinned diagnostic-runtime harness.
test/​gh-aw-quality.test.ts Updates compiled-workflow and integrity assertions.
test/​gh-aw-command-router-relay.test.ts Tests shared router authorization behavior.
test/​gh-aw-command-parse.test.ts Updates fail-closed contract expectations.
test/​gh-aw-command-authorization.test.ts Adds authorization, mutation, and bypass regressions.
docs/​src/​content/​docs/​guide/​gh-aw.md Documents authorization and diagnostic restrictions.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Closes #2185

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83321e5d-2358-40a2-9307-bf37b077165b

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.

🟡 Changes recommended

The tests retain contradictory runtime documentation and duplicate the pinned runtime SHA, allowing future mixed-version validation.

1 open finding
Previously missed (1)

In code that hasn't changed since last review

Medium severity Reuse shared diagnostic runtime SHA instead of hard-coding it

test/​gh-aw-command-authorization.test.ts:55

This independently hard-codes the runtime SHA even though fetchDiagnosticRuntime uses the separately exported DIAGNOSTIC_RUNTIME_SHA. A future pin bump could therefore test the sanitizer from one revision and diagnostic handlers from another while the compiled-lock assertion still passes. Import and reuse the helper's shared SHA (or derive one pin from the compiled lock) for both fetch paths.

🧠 Review effort: Balanced

Comment thread test/gh-aw-activation-capacity.test.ts Resolved
…n pin

Closes #2185

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83321e5d-2358-40a2-9307-bf37b077165b

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.

🔵 Needs a closer look

Security-critical workflow authorization and conclusion behavior warrant final human review after required CI completes.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@bradygaster
bradygaster merged commit 31afa0e into dev Oct 8, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce maintainer authorization deterministically for direct /squad commands

2 participants