Skip to content

security: add same-repo PR guard (P1 — fork PR protection)#85

Open
hummbl-dev wants to merge 3 commits into
mainfrom
security/p1-same-repo-guard
Open

security: add same-repo PR guard (P1 — fork PR protection)#85
hummbl-dev wants to merge 3 commits into
mainfrom
security/p1-same-repo-guard

Conversation

@hummbl-dev

Copy link
Copy Markdown
Owner

Summary

P1 mitigation from the runner fleet wargame (2026-07-23). Prevents fork PR code execution on persistent self-hosted runners.

Changes

Added a same-repo PR guard to 4 job(s) across 3 workflow(s):

if: |
  github.event_name != 'pull_request' ||
  github.event.pull_request.head.repo.full_name == github.repository

How it works

  • Same-repo PRs (operator's own branches): CI runs on self-hosted runners as before. The operator controls the code, so this is safe.
  • Fork PRs: CI is skipped. The operator reviews the fork PR code manually, then merges it. Post-merge CI (push: [main]) validates the merged code.

Why

The original wargame plan was to move PR-triggered workflows to ubuntu-latest (GitHub-hosted runners). This was blocked by the operator constraint: no GitHub-hosted Actions minutes. The same-repo guard achieves the same security goal — preventing external attackers from running code on persistent self-hosted runners — without using any hosted minutes.

Operator notes

  • Fork PRs will no longer get automatic CI. Review code manually before merging.
  • Post-merge CI (push: [main]) will validate all merged code, including fork PRs.
  • Once ARC (ephemeral runners) is deployed, this guard can be relaxed for repos that switch to ephemeral runners.

See _internal/wargame/runner-fleet_2026-07-23/p1-redesign-matrix.md for the full design document.

Test plan

  • Same-repo PR triggers CI on self-hosted runner (unchanged behavior)
  • Fork PR does NOT trigger CI on self-hosted runner
  • Push to main still triggers CI (unchanged behavior)
  • Scheduled workflows still run (unchanged behavior)

Generated with Devin

P1 mitigation from runner fleet wargame (2026-07-23).

Adds `if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository` to 2 job(s) running on self-hosted runners.

This blocks fork PRs from triggering CI on persistent self-hosted runners while preserving CI for same-repo branches. Fork PRs will rely on post-merge validation (push to main) instead.
P1 mitigation from runner fleet wargame (2026-07-23).

Adds `if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository` to 1 job(s) running on self-hosted runners.

This blocks fork PRs from triggering CI on persistent self-hosted runners while preserving CI for same-repo branches. Fork PRs will rely on post-merge validation (push to main) instead.
P1 mitigation from runner fleet wargame (2026-07-23).

Adds `if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository` to 1 job(s) running on self-hosted runners.

This blocks fork PRs from triggering CI on persistent self-hosted runners while preserving CI for same-repo branches. Fork PRs will rely on post-merge validation (push to main) instead.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hummbl-dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 131f3d4b-1731-4f26-b0c4-d81abc0877cf

📥 Commits

Reviewing files that changed from the base of the PR and between 412c8f9 and 1af6621.

📒 Files selected for processing (3)
  • .github/workflows/base120.yml
  • .github/workflows/ci.yml
  • .github/workflows/guardrails.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/p1-same-repo-guard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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