The post has been translated automatically. Original language: Russian
Starting from December 2, 2026, GitHub Actions does not run workflow in public repositories by default, which are triggered by the pull_request_target event. Such launches now take place only if they are explicitly allowed by the Actions event policy. The change affects the GitHub Free, Team, and Enterprise Cloud tariffs, but GitHub Enterprise Server is not affected this time. Private and internal repositories also work the same way.
Why pull_request_target?
The pull_request_target event executes workflow in the context of the repository's base branch: the task has access to secrets and a GITHUB_TOKEN token with write permissions, even if the pull request came from someone else's fork. If such a workflow pumps the code out of the fork and runs it (build, tests, install dependencies), the unauthorized author receives the execution of his code with the secrets of the project. The GitHub documentation explicitly states: the code from the pull request at this event can only be read as data and in no case executed.
The usual pull_request event for forks works without secrets and with reduced rights, so GitHub advises switching to it wherever possible.
How the change was introduced
- On November 2, GitHub announced a new rule. At first, it was supposed to start working on the same day, but the introduction was postponed to December 2.
- Before that, the rule worked in Evaluate mode: launches went on as usual, and on the Policy insights page you could see which ones would be stopped after activation.
- On November 9 and 16, from 16:00 to 18:00 UTC, trial inclusions took place. The launches that the rule did not skip ended with an error with an annotation, and workflow itself was not executed.
- On December 2, the rule became permanent.
The default rule does not replace the event policy that the owner has already configured himself.: if there is such a policy, it applies.
How to resolve the necessary workflows
The settings are located in the Settings section, then Actions and Policies — at the repository or organization level. The company has its own Policies section. The policy defines the name, mode (Evaluate or Active), and goals: organizations, repositories, and individual workflows. The rules for events specify which events are allowed: push, pull_request, pull_request_target, workflow_dispatch. GitHub recommends that you do not open the event to the entire repository, but address specific workflow files. Policies can also be configured via the REST API.
Enterprise owners set general mandatory restrictions, and organizations and repositories can add their own to them, but not weaken them.
What does this mean in practice?
First, you should find all mentions of pull_request_target in your repositories. Typical users of this event are bots that tag and comment on pull requests from forks, as well as checks that require a token with write permissions. If workflow quietly stopped working after December 2, look for an error annotation among the dropped launches.
For every workflow found, it's worth answering a simple question: does it need secrets and recording rights? If not, it is enough to replace the event with a pull_request — this is the cheapest and safest way. If necessary, allow only this file to be addressed and at the same time check that it does not contain code pumping and running from the fork, and the GITHUB_TOKEN rights are reduced to a minimum. Separately, go through workflow_run and issue_comment: the documentation warns that they are also vulnerable if they execute code from a pull request, and artifacts from other workflows should be considered untrusted data.
Those who have a GitHub Enterprise Server don't need to do anything yet, but the pull_request_target audit is useful there as well: the attack class is the same.
The draft text was prepared with the participation of AI, the facts were checked against the original source — the official GitHub changelog and the GitHub Actions documentation
Со 2 декабря 2026 года GitHub Actions по умолчанию не запускает в публичных репозиториях workflow, которые срабатывают на событие pull_request_target. Такие запуски теперь проходят, только если их явно разрешает политика событий Actions. Изменение затрагивает тарифы GitHub Free, Team и Enterprise Cloud, а GitHub Enterprise Server в этот раз не касается. Приватные и внутренние репозитории тоже работают по-старому.
Почему именно pull_request_target
Событие pull_request_target выполняет workflow в контексте базовой ветки репозитория: у задания есть доступ к секретам и токен GITHUB_TOKEN с правами записи, даже если pull request пришёл из чужого форка. Если такой workflow выкачивает код из форка и запускает его (сборка, тесты, установка зависимостей), посторонний автор получает исполнение своего кода с секретами проекта. В документации GitHub прямо сказано: код из pull request при этом событии можно только читать как данные и ни в коем случае не исполнять.
Обычное событие pull_request для форков работает без секретов и с урезанными правами, поэтому GitHub советует переходить на него везде, где это возможно.
Как вводили изменение
- 2 ноября GitHub объявил о новом правиле. Сначала оно должно было заработать в тот же день, но введение перенесли на 2 декабря.
- До этого правило работало в режиме Evaluate: запуски шли как обычно, а на странице Policy insights было видно, какие из них остановят после включения.
- 9 и 16 ноября с 16:00 до 18:00 по UTC прошли пробные включения. Запуски, которые не пропускало правило, завершались ошибкой с аннотацией, сам workflow не выполнялся.
- 2 декабря правило начало действовать постоянно.
Правило по умолчанию не заменяет политику событий, которую владелец уже настроил сам: если такая политика есть, действует она.
Как разрешить нужные workflow
Настройка находится в разделе Settings, далее Actions и Policies — на уровне репозитория или организации. У предприятия есть свой раздел Policies. В политике задают имя, режим (Evaluate или активный) и цели: организации, репозитории и отдельные workflow. Правила для событий указывают, какие события разрешены: push, pull_request, pull_request_target, workflow_dispatch. GitHub рекомендует не открывать событие на весь репозиторий, а адресно разрешить конкретные файлы workflow. Политики можно настраивать и через REST API.
Владельцы предприятия задают общие обязательные ограничения, а организации и репозитории могут добавлять к ним свои, но не ослаблять их.
Что это значит на практике
Сначала стоит найти по своим репозиториям все упоминания pull_request_target. Типичные пользователи этого события — боты, которые ставят метки и комментарии на pull request из форков, а также проверки, которым нужен токен с правами записи. Если workflow после 2 декабря тихо перестал работать, ищите среди упавших запусков аннотацию об ошибке.
Для каждого найденного workflow стоит ответить на простой вопрос: нужны ли ему секреты и права записи. Если нет, достаточно заменить событие на pull_request — это самый дешёвый и безопасный путь. Если нужны, разрешите адресно только этот файл и заодно проверьте, что в нём нет выкачивания и запуска кода из форка, а права GITHUB_TOKEN урезаны до минимума. Отдельно пройдитесь по workflow_run и issue_comment: документация предупреждает, что они тоже уязвимы, если исполняют код из pull request, а артефакты из других workflow надо считать недоверенными данными.
Тем, у кого GitHub Enterprise Server, пока ничего делать не нужно, но аудит pull_request_target полезен и там: класс атак тот же самый.
Черновик текста подготовлен с участием ИИ, факты сверены с первоисточником — официальный журнал изменений GitHub (changelog) и документация GitHub Actions
Comments 1
Newest Popular