Skip to content

fix(gh-aw): harden bootstrap provenance - #2145

Merged
bradygaster merged 2 commits into
devfrom
bradygaster-harden-bootstrap-provenance
Oct 2, 2026
Merged

bradygaster merged 2 commits into
devfrom
bradygaster-harden-bootstrap-provenance

Conversation

@bradygaster

@bradygaster bradygaster commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

What

Hardens Squad Bootstrap provenance in two places: the bootstrap workflow now requires the exact default branch ref instead of a matching ref name, and the review guard accepts recorded install provenance across legitimate default-branch fast-forwards only when GitHub's compare response proves the recorded install SHA is the base and merge base of the live PR base.

Why

A workflow_dispatch on a tag named like the default branch could pass the old gate, while a valid bot-authored Cast PR became permanently unverifiable whenever the live default branch advanced after its trusted install run. Confirmed against octodemo/zava-social-queue-worker-20261002092250#1 at source SHA 98afdbec6809b23495054020768dfb377c487da8.

How

  • Uses github.ref == format('refs/heads/{0}', github.event.repository.default_branch) in the canonical bootstrap source and regenerated package/manifest artifacts.
  • Keeps the trusted Actions run exactly bound to provenance.install_sha.
  • Calls the repository-bound compare endpoint for provenance.install_sha...pr.base.sha, accepting only identical or ahead and requiring both base_commit.sha and merge_base_commit.sha to equal the recorded install SHA.
  • Adds realistic event, compiled-lock, regression, API-error, and mutation coverage.

⚠️ 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)

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)

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

Validation evidence:

  • vitest run test/gh-aw-*.test.ts --maxWorkers=2: 28 files, 1,968 tests passed.
  • Targeted bootstrap/review/quality suites: 4 files, 576 tests passed.
  • npm run build: passed.
  • TypeScript checks and ESLint: passed (existing warnings only).
  • Canonical integrity and clean-consumer install verification: passed.
  • gh aw compile --strict: 8 workflows succeeded with exactly the two documented warnings.
  • GitHub Actions test: passed on final head 190ac6ec (6m25s). Local full-suite attempts exposed workspace-state interference, so the clean CI run is the authoritative complete-suite result.

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)

Docs

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

N/A - trust-boundary bug fix with no user-facing workflow syntax change.

Exports

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

N/A - no SDK exports changed.


Breaking Changes

None.

Waivers

None. The complete monorepo suite is not waived; required CI checks must pass before merge.

Reject same-named tag dispatches and preserve trusted install provenance across default-branch fast-forwards.\n\nSource: octodemo/zava-social-queue-worker-20261002092250#1\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 11:13
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2145

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 7
Files added 1
Files modified 6
Files deleted 0
Modules touched 2

🎯 Risk Factors

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

📦 Modules Affected

root (5 files)
  • .changeset/harden-bootstrap-provenance.md
  • workflows/package/squad-bootstrap.md
  • workflows/shared/squad-review-guard.mjs
  • workflows/squad-bootstrap.md
  • workflows/squad-workflows.manifest.json
tests (2 files)
  • test/gh-aw-bootstrap-workflow.test.ts
  • test/gh-aw-review-guard.test.ts

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

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

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

PR Scope: 🔧 Infrastructure

⚠️ 2 item(s) to address before review

Status Check Details
❌ Single commit 2 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 Changeset file found
✅ 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 (7 files, +175 −25)

File +/−
.changeset/harden-bootstrap-provenance.md +8 −0
test/gh-aw-bootstrap-workflow.test.ts +57 −4
test/gh-aw-review-guard.test.ts +72 −1
workflows/package/squad-bootstrap.md +2 −2
workflows/shared/squad-review-guard.mjs +30 −12
workflows/squad-bootstrap.md +2 −2
workflows/squad-workflows.manifest.json +4 −4

Total: +175 −25


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.

Copilot review overview

🟢 Approval recommended

The implementation fails closed and has strong mutation coverage; only a minor stale explanatory comment remains.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Hardens bootstrap provenance against same-named tags while permitting verified default-branch fast-forwards.

Changes:

  • Requires the exact default-branch ref.
  • Validates recorded install ancestry using GitHub compare evidence.
  • Adds regression, mutation, and failure-path coverage.
File Description
workflows/​squad-bootstrap.md Strengthens the canonical ref gate.
workflows/​package/​squad-bootstrap.md Updates the generated package artifact.
workflows/​shared/​squad-review-guard.mjs Adds ancestry verification.
workflows/​squad-workflows.manifest.json Refreshes integrity digests.
test/​gh-aw-bootstrap-workflow.test.ts Tests exact-ref and mutation behavior.
test/​gh-aw-review-guard.test.ts Tests compare evidence and API failures.
.changeset/​harden-bootstrap-provenance.md Records package patch releases.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread workflows/shared/squad-review-guard.mjs Resolved
Address Copilot review on bradygaster/squad#2145.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🟢 Approval recommended

The security invariants, generated artifacts, and regression coverage are consistent and fail closed.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@bradygaster
bradygaster merged commit 8f9e049 into dev Oct 2, 2026
28 of 30 checks passed
@bradygaster
bradygaster deleted the bradygaster-harden-bootstrap-provenance branch October 3, 2026 00:11
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.

2 participants