Skip to content

Exclude fork PRs from Gemini dispatch (consistency with hardened template)#218

Open
scalvela wants to merge 1 commit into
google:mainfrom
scalvela:harden-gemini-dispatch-fork-guard
Open

Exclude fork PRs from Gemini dispatch (consistency with hardened template)#218
scalvela wants to merge 1 commit into
google:mainfrom
scalvela:harden-gemini-dispatch-fork-guard

Conversation

@scalvela

Copy link
Copy Markdown

What

Add the && github.event.pull_request.head.repo.fork == false guard to the pull_request
branch of the dispatch job's if condition in .github/workflows/gemini-dispatch.yml.

Why

The equivalent Gemini dispatch workflows in GoogleCloudPlatform/vertex-ai-creative-studio
and GoogleCloudPlatform/gemini-cloud-assist-mcp (and the google-github-actions/run-gemini-cli
reference) gate the pull_request path on head.repo.fork == false. This workflow omitted it,
so it auto-dispatches the Gemini review agent on fork PRs.

Note on impact (not a security fix)

This trigger is pull_request (not pull_request_target), so fork PRs already run without
secrets or a write token
— there is no secret-exposure issue here today. This is a
hardening / consistency change, not a security fix. It:

  1. avoids spinning up the review agent on untrusted fork PRs, and
  2. guards against a future switch to a pull_request_target trigger (which would pass secrets).

Change

       (
-        github.event_name == 'pull_request'
+        github.event_name == 'pull_request' &&
+        github.event.pull_request.head.repo.fork == false
       ) || (

…late)

gemini-dispatch.yml's dispatch `if` allowed `github.event_name == 'pull_request'`
without the `&& github.event.pull_request.head.repo.fork == false` guard used by the
equivalent workflows in GoogleCloudPlatform/vertex-ai-creative-studio and
gemini-cloud-assist-mcp (and the run-gemini-cli reference template).

Because this trigger is `pull_request` (not `pull_request_target`), fork PRs run
without secrets or a write token, so there is no secret-exposure issue today. This
is a hardening/consistency change: it avoids spinning up the review agent on
untrusted fork PRs and guards against a future switch to a `pull_request_target`
trigger.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@scalvela scalvela requested a review from prachib29 as a code owner June 26, 2026 12:53
@google-cla

google-cla Bot commented Jun 26, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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