Skip to content

security: block fork PRs from running on the self-hosted runner#24

Merged
GeiserX merged 1 commit into
mainfrom
security/fork-guard-self-hosted
Jun 22, 2026
Merged

security: block fork PRs from running on the self-hosted runner#24
GeiserX merged 1 commit into
mainfrom
security/fork-guard-self-hosted

Conversation

@GeiserX

@GeiserX GeiserX commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a fork-guard if: so pull_request-triggered CI jobs run on the self-hosted runner only for same-repo events, never for PRs from forks.

Why

On a public repo, a job that triggers on pull_request and runs on a self-hosted runner lets anyone's fork PR execute attacker-controlled code on the runner host. The guard keeps runs self-hosted for trusted events (push, schedule, workflow_dispatch, same-repo branch PRs) while skipping fork PRs. Same pattern already used in tailscale-rs.

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

Files: main.yml

Jobs triggered on pull_request that run on the self-hosted runner could
execute untrusted fork PR code on the runner host. Add an if: guard so
these jobs run only for same-repo events (push, schedule, workflow_dispatch,
and PRs from branches in this repo), never for fork PRs. Runner stays
self-hosted for trusted runs.
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GeiserX, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 22 minutes and 24 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate limits work?

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

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 738676c2-b4e5-40f1-975f-d2ab68c24938

📥 Commits

Reviewing files that changed from the base of the PR and between f414e41 and ea312e6.

📒 Files selected for processing (1)
  • .github/workflows/main.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/fork-guard-self-hosted

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.

@GeiserX GeiserX merged commit fa8c734 into main Jun 22, 2026
3 of 4 checks passed
@GeiserX GeiserX deleted the security/fork-guard-self-hosted branch June 22, 2026 23:00
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