r/devops • u/Late_Wave_5600 • 2d ago
Ops / Incidents GitHub blocks pull_request_target by default since yesterday. The default leaves issue_comment and workflow_run alone, here is what I went through on our repos
since yesterday (Dec 2) GitHub blocks pull_request_target by default in public repos, unless an Actions event policy explicitly allows it. private and internal repos are not affected
if a labeler, a welcome bot or a preview deploy went quiet on your open source repo this morning, that's probably it. during the brownouts in November the blocked runs showed up as failed runs with an error annotation and the workflow never executed
what I went through on ours, in this order
- Insights on the repo shows which runs the rule blocks. start there before touching any yaml
- for each blocked workflow, ask if it really needs the base repo's secrets. the ones that only label or comment work fine on plain pull_request with a read-only token
- the ones that do need pull_request_target go into an event policy that targets the workflow file by name. don't allow the event for the whole repo, that puts you back where you were on Monday
- in the ones you allow, look for a checkout of the PR head (ref: github.event.pull_request.head.sha or head.ref) followed by anything that runs code, npm install, make, a test script. that's the pwn request pattern
- set permissions at the top of every workflow, contents: read, and add only what each job needs
reading the details, the default only covers pull_request_target. issue_comment still runs with secrets, and so do workflow_run chains. so a /deploy or /test comment command that checks out the PR is as exposed as last week. same for anything that puts a comment body or a PR title inside a run step
and if your org already has its own event policy, the default steps aside and your policy decides
did anything break on your side yesterday ? and are you allowing it back per workflow or dropping the trigger
2
u/Torutofu_Raeva 2d ago
workflow_run is the sneaky one, tons of repos chain deploys off it and nobody remembers it still gets secrets even when the triggering PR is from a fork
1
u/Neat_Basket8230 2d ago
In my experience, that first step is the one people skip and then regret. I went straight to the yaml the first time a workflow went quiet and wasted an afternoon. Starting in Insights and seeing exactly which runs the rule blocks is the fix I actually kept, because it tells you whether you're dealing with one workflow or a whole pattern. Setting contents: read at the top of every workflow was the other habit that stuck.
2
u/axiomatix 2d ago
clanker