Skip to content
Write-up Intermediate

Poisoned Pipeline in Google’s Gemini-CLI: workflow_run PPE

The gemini-cli repository used a workflow_run trigger to run a privileged workflow that downloaded an artifact from an unprivileged fork pull request workflow and passed its contents directly into actions/checkout, causing fork code to execute with repository secrets. An attacker could fork the repository, modify a test script to exfiltrate the GEMINI_API_KEY environment variable, and open a pull request to have that script run in the privileged context.

medium.com

Published on medium.com

How attacker-controlled artifact data flows into a privileged GitHub Actions context and exposes GEMINIAPIKEY — found via Google OSS VRP.

Rajat shukla, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The privileged workflow_run workflow used artifact contents (repository name and SHA) from an unprivileged fork pull request workflow as parameters to actions/checkout without validating the repository origin.

Impact

An attacker could exfiltrate the GEMINI_API_KEY secret during a normal CI run without any repository permissions or maintainer approval.

What the attacker needed

A GitHub account; ability to fork the repository; ability to open a pull request

The fix

The standard fix is to validate the artifact's repository origin before checkout, pin the ref to the base repository, and restrict secret exposure to steps that do not run fork-controlled code.

How it was found

  1. Fork the gemini-cli repository.
  2. Modify a test script to exfiltrate environment variables.
  3. Open a pull request from the fork.
  4. Wait for trigger_e2e.yml to complete.
  5. Observe chained_e2e.yml automatically check out the fork code and run it with secrets.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

GitHub Actions is a system that runs automated tasks when code changes. A workflow can be triggered after another workflow finishes, and the second one may have access to secret keys. Here, the second workflow trusted a file produced by the first workflow, which came from an outside contributor, so the contributor's code ran with the secret key.

Similar reports

Same bug class and techniques, clearest first.