Full Byte Developer.

Check public repos before pull_request_target is blocked on December 2

GitHub will block pull_request_target workflows by default in public repos. Here is the check and two fixes.

Published here · 3 sources

Some pull request checks in your public repo could stop running on December 2. Here is the whole check.

Search for affected workflows

Find any workflow that uses pull_request_target [1].

bash
grep -rn "pull_request_target" .github/workflows

No output means nothing to do. Each file it prints has a workflow GitHub could block by default.

You can also check Settings > Actions > Policy insights, which lists runs the default rule would block [3].

Switch to pull_request if you do not need secrets

Change the trigger in your workflow file [2].

yaml
on: pull_request

Warning: on pull requests from forks, pull_request gets a read-only token and no secrets. A job that writes labels or comments may still need the old trigger.

You should see your workflow run successfully on the next pull request.

Allow pull_request_target for one workflow

If your workflow needs secrets on fork PRs, create a policy instead of switching triggers [3].

Go to Settings > Actions > Policies, create a policy, and restrict events. Allow pull_request_target and target only that workflow file. Event rules are an allowlist: check the policy still allows every other event that file uses.

Warning: make sure that workflow never checks out and runs the fork's code [2]. A malicious fork could exfiltrate your secrets.

You should see the workflow in Policy insights move from "would be blocked" to "allowed".

Timeline

Dates are UTC [1]:

  • Nov 9, 16:00 to 18:00: brownout, blocked runs fail
  • Nov 16, 16:00 to 18:00: brownout, blocked runs fail
  • Dec 2: blocked for good

This applies to public repos on GitHub Free, Team, and Enterprise Cloud. Private and internal repos are not affected, and neither is GitHub Enterprise Server.

Run the grep command on every public repo you own before December 2.

Send this to the friend maintaining a public repo that uses pull_request_target before December 2.

Keep this guide

By Full Byte Developer

Filed under Security

Questions about this guide

Are private repos affected?

No. This applies to public repos on GitHub Free, Team, and Enterprise Cloud. Private, internal, and GitHub Enterprise Server repos keep their current behavior.

What happens during the brownout windows?

Blocked runs fail during the brownout. Runs that complete before or after the window succeed. Brownouts are Nov 9 and Nov 16, 16:00 to 18:00 UTC.

Sources

Next in this stack