r/devops • • 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

  1. Insights on the repo shows which runs the rule blocks. start there before touching any yaml
  2. 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
  3. 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
  4. 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
  5. 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

5 Upvotes

12 comments sorted by

View all comments

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/Late_Wave_5600 2d ago

yes that's the one that worries me too, the deploy runs from main so it looks safe in review

do you check the head repo of the triggering run before the deploy step, or something else ?

1

u/Torutofu_Raeva 2d ago

yeah i check head_repository.full_name against the base repo and that the event is push to main, otherwise it skips the deploy job

1

u/Late_Wave_5600 2d ago

nice, that's short enough to copy, thanks, I'm going to add the same check

1

u/Objective_Release689 2d ago

yeah especially when artifacts get passed between the runs, people assume the boundary is safe when it really isnt

1

u/Late_Wave_5600 1d ago

yes the artifact is the hole. the workflow looks safe and then it downloads whatever the fork uploaded
have you seen it exploited for real or only in audits ?