Public-repository organization gate is bypassed for push webhooks
Summary
When PUBLIC_REPO_ORG_GATE is configured, the GitHub push webhook path bypasses the public-repository organization membership check.
Code reference
- agent/webhooks/github_routes.py:83-88
- agent/webhooks/common.py:630-650
The push branch checks only _is_repo_auto_review_enabled() and schedules process_github_push_event(). It returns before calling _enforce_public_repo_org_gate().
Reproduction
- Configure PUBLIC_REPO_ORG_GATE=trusted-org.
- Enable automatic reviews for a public repository.
- Send a valid signed push payload for that repository with sender.login set to a user who is not an active member of trusted-org.
- Observe that the endpoint returns status=accepted and schedules reviewer-watch evaluation.
Equivalent pull_request, issue, and comment paths invoke the gate and reject the same sender.
Expected behavior
All agent-triggering public-repository webhook paths, including push, enforce PUBLIC_REPO_ORG_GATE consistently.
Actual behavior
A non-member can trigger the push-driven reviewer evaluation for an opted-in public repository.
Why it matters
This bypasses an explicitly configured access-control policy and can cause unauthorized reviewer runs, GitHub API usage, and review comments.
Suggested fix
Call _enforce_public_repo_org_gate(payload, event_type) before scheduling process_github_push_event, and add accepted/rejected route tests for public, private, member, and non-member senders.
Source: langchain-ai/open-swe