Have dangerous triggers caused real incidents? Yes, repeatedly... 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...
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... 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.
The issue_comment trigger 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 workflow pastes the comment text into a templated shell command, and the comment turns out to inject different instructions into the workflow shell.
Python's official security developer in residence Seth Larson joined PyPI safety/security engineer Mike Fiedler
to remove these dangerous trigger, also applying the policies Python Software Foundation-stewarded GitHub organizations (psf, python, and pypi). "They also wrote up technical documentation on how to roll these policies out to your own projects and organizations.
"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."
Read more of this story at Slashdot.




