Skip to content

fix: don't auto-approve PRs that change the bot's own guardrails - #758

Merged
sudsali merged 1 commit into
masterfrom
harden-auto-approve-guard
Jul 6, 2026
Merged

fix: don't auto-approve PRs that change the bot's own guardrails#758
sudsali merged 1 commit into
masterfrom
harden-auto-approve-guard

Conversation

@sudsali

@sudsali sudsali commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Hardens auto-approve.yml so the bot never auto-approves a PR that modifies its own guardrails.

The gap

auto-approve.yml approves any PR where the bot posted a clean review + CI passed. It has no check on what the PR changes — so a PR that edits auto-approve.yml itself (weakening the gate), or .shadow.yml / a workflow (e.g. repointing the bot at a different engine SHA), gets auto-approved by the very gate it modifies. GitHub branch protection still requires a human to merge, but auto-approval of self-modifying PRs shouldn't happen.

The fix

A "Condition 0" check runs before the CI/marker conditions: it lists the PR's changed files (paginated, so a large PR can't slip a guarded file past a single page) and skips auto-approval if any path is under .github/ or is .shadow.yml. Those PRs require a human approval. Normal source/test PRs are unaffected.

Rollback

Revert this PR — the Condition 0 block is removed and behavior returns to CI + clean-marker only.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Add a check that skips auto-approval when a PR modifies .github/** or
.shadow.yml. Without it, a PR that weakens the approval gate (or repoints the
bot at a different engine) is approved by the very gate it edits. Paginates
listFiles so a large PR cannot slip a guarded file past a 30-item page.

@github-actions github-actions Bot 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.

No issues found.


Generated by AI (model: us.anthropic.claude-opus-4-8, prompt: 4d2f5d73) — may not be fully accurate. Reply if this doesn't help.
Reviewed by Shadow · github.com/sudsali/shadow

@sudsali
sudsali marked this pull request as ready for review July 6, 2026 19:39

@github-actions github-actions Bot 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.

No issues found and CI is passing. Auto-approved.


Generated by AI — human merge required.

@sudsali
sudsali merged commit 38ba5bb into master Jul 6, 2026
6 checks passed
@sudsali
sudsali deleted the harden-auto-approve-guard branch July 6, 2026 19:46
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.

1 participant