How to Block Dangerous GitHub Actions Triggers at Org Scale

· Alpha Omega

11 min read Original article ↗

By Mike Fiedler and Seth Larson

On December 2, 2026, GitHub will start blocking the pull_request_target trigger by default in public repositories. If that sentence means nothing to you, this post is for you. If it fills you with dread, it is also for you.

The short version: a handful of GitHub Actions triggers let a stranger on the internet start a workflow that may have access to your secrets. On a GitHub Team or Enterprise plan, you can turn them off for every repository in your organization with one policy. On a Free plan, you can do it one repository at a time. Set the policy up, check what it would block, then enforce it.

Alpha-Omega supports both of our roles at the Python Software Foundation (PSF). This post comes out of that work: responding to incidents on PyPI, then locking down the pypi and python GitHub organizations so we are not the next one.

Why are these triggers dangerous?

They run with access to your secrets, and a stranger can start them.

When someone opens a pull request from a fork, the pull_request trigger runs their code with a read-only token and no secrets. That’s the safe one.

pull_request_target looks almost the same in a workflow file and behaves very differently. It runs with a read/write token and access to your repository and organization secrets. GitHub built it for chores like labeling pull requests from forks, where the workflow never touches the contributor’s code. The trouble starts when a workflow checks out the pull request and runs it anyway:

None

on: pull_request_target
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ github.event.pull_request.head.sha }}  # a stranger's code
      - run: make test                                    # running with your secrets

Anyone with a GitHub account can open that pull request. Their code now runs with your credentials. This is called a “pwn request”, and GitHub’s docs describe it as the root cause of multiple supply-chain compromises.

issue_comment carries the same risk. This trigger fires when anyone comments on an issue or pull request, and the workflow runs with the repository’s token and secrets. Sometimes the victim is a “comment /test to run CI” bot that checks out the pull request and runs their code. Sometimes the workflow pastes the comment text into a templated shell command, and the comment turns out to inject different instructions into the workflow shell.

Have dangerous triggers caused real incidents?

Yes, repeatedly. A few that have affected projects hosted on PyPI directly:

  • Ultralytics, December 2024. The project’s GitHub Actions workflows were compromised and the build cache was poisoned, which put malicious releases on PyPI. Seth wrote PyPI’s analysis. William Woodruff’s write-up traces the entry point to a pull_request_target workflow.
  • LiteLLM and Telnyx, March 2026. Malicious releases of both packages were published after an API token was exposed through an exploited Trivy dependency. StepSecurity traced the Trivy compromise back to a pull_request_target workflow exploited three weeks earlier. We worked with both maintainer teams on token rotation, release removals, and moving to Trusted Publishers, which both projects have since adopted.
  • elementary-data, April 2026. A workflow triggered by comments puts the comment text straight into a shell script. One crafted comment on a pull request ran with a token that could be written to the repository. The attacker used it to commit a malicious file and push a release tag, and the project’s own release pipeline published the result to PyPI.

The number of affected projects outside of Python is longer still: AsyncAPI, TanStack, Nx, Grafana, tj-actions.

The maintainers behind these projects weren’t careless. These triggers look harmless in a workflow file, and the unsafe version is one line away from the safe one.

How do I find these triggers in my repositories?

Search your workflow files, then check which ones have run recently.

In GitHub code search, for an organization or a single repository:

None

org:YOUR-ORG path:.github/workflows /pull_request_target|issue_comment/

repo:YOUR-ORG/YOUR-REPO path:.github/workflows /pull_request_target|issue_comment/

The same from the terminal:

Shell

gh search code pull_request_target path:.github/workflows --owner YOUR-ORG

gh search code issue_comment path:.github/workflows --owner YOUR-ORG

Code search only covers default branches, which is fine here: both triggers run the workflow file from the default branch.

A workflow file that exists is one thing. A workflow that ran last Tuesday is more interesting:

Shell

gh run list --repo YOUR-ORG/YOUR-REPO --event pull_request_target --limit 10

gh run list --repo YOUR-ORG/YOUR-REPO --event issue_comment --limit 10

And across an organization:

Shell

gh repo list YOUR-ORG --no-archived --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' |
while read -r repo; do
  for event in pull_request_target issue_comment; do
    gh run list --repo "$repo" --event "$event" --limit 1 \
      --json workflowName,createdAt \
      --jq ".[] | \"$repo $event \(.workflowName) \(.createdAt)\""
  done
done

If you’re using GitHub Actions, we highly recommend adopting zizmor, a tool for scanning GitHub Actions workflows for common security issues. Zizmor finds these insecure triggers too, along with a long list of other workflow problems. Zizmor works one repository at a time and each repository has to opt in. Applying a policy to reject insecure triggers across an organization covers the repositories nobody remembers creating and from future contributors accidentally opening projects up to supply-chain attacks.

What should an organization policy allow?

Only the triggers you use on purpose. GitHub’s default policy only blocks pull_request_target, only in public repositories, and steps aside as soon as you define an event policy of your own. So define one, and make it an allowlist. This is the list we recommend starting from:

  • pull_request
  • push
  • release
  • repository_dispatch
  • schedule
  • workflow_dispatch
  • workflow_run

The quick fix is to allow every event except pull_request_target and issue_comment. It is better than nothing, but a short list is better still. Adnan Khan’s Clinejection research showed an attack that started with nothing more than opening an issue, and the quick fix still allows the issues trigger.

One caveat on workflow_run: it also runs with privileges, after another workflow finishes. Treat any artifact it downloads from a pull request run as untrusted input. crates.io refuses Trusted Publishing from this trigger, so you shouldn’t use this trigger for sensitive operations like publishing a package.

In the UI

  1. Go to your organization, then Settings.
  2. In the sidebar under Actions, click Policies. The direct link is https://github.com/organizations/YOUR-ORG/settings/actions/rules.
  3. Create a new policy and give it a name.
  4. Pick an enforcement status. Start with Evaluate (see the next section).
  5. Target all repositories.
  6. Under Restrict events, select only the events listed above.
  7. Save.

With the gh CLI

Save this as policy.json:

JSON

{
  "name": "Allow only expected workflow triggers",
  "enforcement": "evaluate",
  "conditions": {
    "repository_name": { "include": ["~ALL"], "exclude": [] }
  },
  "rules": [
    {
      "type": "restrict_action_events",
      "parameters": {
        "allowed_events": [
          "pull_request",
          "push",
          "release",
          "repository_dispatch",
          "schedule",
          "workflow_dispatch",
          "workflow_run"
        ]
      }
    }
  ]
}

Create it, then list policies to get its ID:

Shell

gh api --method POST /orgs/YOUR-ORG/actions/policies --input policy.json
gh api /orgs/YOUR-ORG/actions/policies --jq '.policies[] | "\(.id)  \(.enforcement)  \(.name)"'

Note that you need to be an organization owner to complete this operation.

On a Free plan

Organization-level policies need a paid plan. On a Free organization, GitHub let me create one, then showed this banner: “Organization rulesets won’t be enforced until you upgrade this organization account to GitHub Team.” Repository-level policies on the same organization are saved without that warning.

So on a Free organization, apply the policy to each public repository. The repository endpoint takes the same JSON without the conditions block:

Shell

jq 'del(.conditions)' policy.json > repo-policy.json

gh repo list YOUR-ORG --no-archived --visibility public --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' |

while read -r repo; do

  gh api --method POST "/repos/$repo/actions/policies" --input repo-policy.json

done

The tradeoff: a new repository starts with no policy of yours, so someone has to remember to add one.

How do I audit action triggers before blocking?

Run the policy in Evaluate mode first. A policy in Evaluate mode blocks nothing. It records what it would have blocked on the Policy insights page, which sits next to Policies in the settings sidebar. Leave it there long enough to cover a release and your least frequent scheduled job. Then enforce:

Shell

gh api --method PUT /orgs/YOUR-ORG/actions/policies/POLICY_ID -f enforcement=active

GitHub’s how-to guide labels Evaluate as GitHub Enterprise Cloud only. That did not match what I saw: on a Free organization I could select Evaluate and save the policy, at both the repository and organization level. If the option is missing for you, roll out in stages instead. Set enforcement to active on a few low-traffic repositories and widen the list as you gain confidence..

GitHub’s default pull_request_target policy is also running in evaluate mode on public repositories that have no event policy of their own, until enforcement on December 2. GitHub’s announcement says you can see the affected runs in Policy Insights. Look there before you replace the default.

What will this break?

Automation that depends on the triggers you removed. Expect to find some of these:

  • Pull request labelers and welcome bots that use pull_request_target. Check whether pull_request is enough. The ones that write to the pull request can be split into an unprivileged pull_request job and a privileged workflow_run follow-up, or replaced with a GitHub App.
  • Slash-command bots on issue_comment. A maintainer clicking “Run workflow” (workflow_dispatch) does the same job with a permission check built in.
  • Issue triage automation on issues.
  • Merge queues, which need merge_group.
  • Reusable workflows. Check Policy insights for workflow_call before you enforce.

Somebody set those bots up to save maintainers time or to provide a welcoming experience to new contributors. Don’t make this decision unilaterally and without warning, start conversations with the project maintainers that would be affected by a new policy and give plenty of time to preserve functionality while migrating away from insecure triggers.

Add events back when you have a reason. The point of an allowlist is that each entry was a decision, not the default which can change upstream at any time.

Don’t package registries already block these triggers?

Some do, and it only covers part of the problem.

If you use Trusted Publishing on another registry, check with them to see what triggers they disallow.

These checks stop the direct route from a hijacked workflow to a published package. They do not stop the elementary-data route, where a stolen token pushes a tag and the legitimate release workflow does the publishing. AsyncAPI went the same way in July 2026. The registry sees a normal release. Blocking the trigger in your organization closes that gap at the source.

GitHub’s Security Lab has more patterns and mitigations if you want to keep going.

How did Alpha-Omega support this work?

Alpha-Omega is a fund and catalyst for sustainable open source security improvements. It supports Mike’s role as PyPI Safety & Security Engineer and Seth’s role as Security Developer-in-Residence at the PSF.

That support is what gives us the time for the work behind this post:

  • Seth wrote PyPI’s analysis of the Ultralytics attack
  • Mike and Seth worked with the LiteLLM and Telnyx maintainers during their incident, and wrote up the guidance for everyone else
  • Mike set up the event policy for the pypi GitHub organization
  • Mike and Seth wrote this guide so other organizations can do the same

Appendix of incidents

pull_request_target:

issue_comment:

issues::

About the authors

Mike Fiedler is the PyPI Safety & Security Engineer at the PSF, a PyPI admin, and open source contributor at large. He works mostly on Warehouse, the codebase behind PyPI, and is a volunteer roller derby referee. Find Mike at https://miketheman.dev/.

Seth Larson is the Security Developer-in-Residence at the PSF, Python core developer, and Python Security Response Team member. Seth’s home on the web is https://sethmlarson.dev where he blogs about Python, security, and retro video-games.

Join the conversation

Discuss this post on LinkedIn.