ci: install safe-paths auto-merge - #5
Conversation
Adds the safe-paths auto-merge caller from topcoder1/ci-workflows. PRs whose diff touches only docs/**, tests/**, test_*.py, *_test.*, *.test.*, *.spec.*, or **/__tests__/** get gh pr merge --auto --squash called automatically — any author. All-or-nothing: any one unsafe path defers to claude-author-automerge.yml or manual click. Branch protection's required-status-checks still apply. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Risk class: This PR touches one of the blocked path categories from Auto-merge is refused by (This is a policy notice, not a code-quality failure. The classify job itself does not fail — required CI checks remain authoritative for "is the code green.") |
|
Auto-merge blocked — risk-tier paths touched. This Claude-authored PR modifies files matching the risk-tier patterns Matched files: |
Codex reviewno regressions found |
|
|
||
| jobs: | ||
| automerge: | ||
| uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@main |
There was a problem hiding this comment.
Supply chain risk: unpinned external ref + secrets: inherit
@main means this workflow will execute whatever code topcoder1/ci-workflows contains at the moment a PR event fires — with no review gate, and with all repository secrets inherited. A single compromised push to topcoder1/ci-workflows (account takeover, rogue maintainer, etc.) immediately exfiltrates every secret in this repo.
GitHub's own security hardening guide requires pinning reusable workflows to a full-length commit SHA:
| uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@main | |
| uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@<COMMIT_SHA> |
Replace <COMMIT_SHA> with the current HEAD of that workflow file and re-pin on each intentional upgrade. This is equally true for the existing claude-author-automerge.yml.
| # file in the diff and this workflow no-ops, deferring to | ||
| # claude-author-automerge.yml (or manual click). |
There was a problem hiding this comment.
Logic bug: test files are not a safe auto-merge path for any author
The safety argument in the PR description ("failing tests do not ship; passing tests do not change behavior") is wrong for two reasons:
-
Tests execute in CI with access to secrets. A PR that adds only
tests/evil_test.pycan exfiltratesecrets.GITHUB_TOKENor any other inherited secret during the required-status-check run, before the merge. The test just needs its assertions to pass (the malicious side-effect is orthogonal to pass/fail). -
Once merged, the test persists. Even if no secrets were leaked pre-merge, the malicious test now runs on every future PR's CI, including PRs from branches that do have elevated permissions or that trigger differently scoped workflows.
Safe auto-merge without author restriction should be limited to paths with zero execution in CI — docs/**, *.md, *.txt, etc. Test file changes warrant human review regardless of author. Consider requiring either a trusted-author check (like claude-author-automerge.yml does) or removing tests/** / test_*.py / *.spec.* / **/__tests__/** from the safe-path list.
|
Flagged 2 issues inline — see comments. |
Adds the safe-paths auto-merge caller from
topcoder1/ci-workflows.What this enables:
docs/**,tests/**,test_*.py,*_test.*,*.test.*,*.spec.*,**/__tests__/**) getgh pr merge --auto --squashcalled automatically — any author.claude-author-automerge.ymlor manual click.Why this is safe:
Auto-merge rationale: workflow file → manual click-merge per CLAUDE.md. The whole point of the workflow being installed is to handle future docs/tests-only PRs — not this one.
🤖 Auto-installed via install-safe-paths-automerge.sh
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com