HN
Today

De-fanging dangerous triggers in GitHub Actions across an organization

GitHub Actions' pull_request_target and issue_comment triggers are critical security holes, enabling attackers to run arbitrary code with your repository's secrets, a vulnerability that has already led to multiple high-profile supply-chain compromises. This deep dive details why these 'pwn requests' are dangerous, provides concrete steps to identify them in your organization, and offers a robust, allowlist-based policy to block them at scale, an essential read for anyone managing GitHub Actions security.

4
Score
0
Comments
#18
Highest Rank
5h
on Front Page
First Seen
Nov 23, 7:00 AM
Last Seen
Nov 23, 11:00 AM
Rank Over Time
1818212628

The Lowdown

This crucial post by Alpha-Omega, authored by Mike Fiedler and Seth Larson of the Python Software Foundation, dissects the significant security risks posed by certain GitHub Actions triggers, particularly pull_request_target and issue_comment. These seemingly innocuous triggers can grant external contributors, or even simple issue commenters, privileged access to an organization's secrets, leading to severe supply-chain attacks. The article serves as both a warning and a comprehensive guide for securing GitHub Actions across an entire organization.

  • Understanding the Danger: The pull_request_target trigger, despite appearing similar to the safe pull_request trigger, executes workflow code with read/write tokens and access to repository and organization secrets. This allows malicious code from a forked pull request to compromise credentials, a vulnerability dubbed a "pwn request." Similarly, the issue_comment trigger can allow attackers to execute commands via crafted comments.
  • Real-World Exploitations: The article cites numerous incidents, including compromises of Ultralytics, LiteLLM, Telnyx, and elementary-data, where these dangerous triggers were the entry point for supply-chain attacks that resulted in malicious package releases.
  • Identification and Remediation: It provides specific gh CLI and GitHub code search commands to locate vulnerable workflows using pull_request_target or issue_comment across an organization. It then strongly recommends implementing an organization-level allowlist policy for GitHub Actions events, explicitly listing safe triggers like pull_request, push, and workflow_dispatch, while blocking dangerous ones.
  • Implementation Steps: Detailed instructions are provided for setting up this policy via the GitHub UI or gh CLI, including advice for Free-tier organizations. A critical step is to first run the policy in "Evaluate" mode to identify potential breakage before full enforcement.
  • Impact and Considerations: The authors acknowledge that implementing such a policy might break existing automation (e.g., pull request labelers, slash-command bots) and emphasize the need for careful communication and migration strategies with project maintainers.
  • Registry Protections: While package registries like PyPI, npm, and crates.io have implemented their own blocks against these triggers for Trusted Publishing, the article clarifies that these measures are often incomplete and do not fully prevent all attack vectors, reinforcing the need for organizational-level policy enforcement.

Ultimately, this post is a vital security blueprint for any organization leveraging GitHub Actions, highlighting the subtle yet profound differences between superficially similar triggers and providing the tools and knowledge necessary to prevent sophisticated supply-chain compromises.