OpsCanary
cicdgithub actionsPractitioner

Disrupting Supply Chain Attacks: Securing npm and GitHub Actions

5 min read GitHub BlogJul 28, 2026Reviewed for accuracy
Share
PractitionerHands-on experience recommended

Supply chain attacks are increasingly common, often starting with the compromise of a single project. Attackers may gain access by targeting a maintainer's account or exploiting vulnerabilities in the project's actions workflows. Recent improvements in npm and GitHub Actions are designed to cut off these common attack vectors and provide mechanisms for identifying and responding to such threats.

One key vulnerability is known as pwn requests, where workflows trigger on pull requests from forks, executing untrusted code. To combat this, trusted publishing allows you to authorize publishes to your package repository without relying on long-lived credentials. Additionally, staged publishing ensures that new packages on npm require further approval and 2FA authentication before they are published. The Actions network firewall logs all outbound network traffic from your Action workflow runs, helping you detect unusual behavior, such as pulling down malicious code or exfiltrating credentials.

In production, be aware that npm v12 will introduce a breaking change that disables install scripts by default, which can impact your workflows. Understanding these features and their configurations is essential to secure your CI/CD pipelines effectively.

Key takeaways

  • Understand pwn requests to avoid executing untrusted code from forked pull requests.
  • Implement trusted publishing to authorize publishes without long-lived credentials.
  • Utilize staged publishing for npm packages to require additional approval and 2FA.
  • Leverage the Actions network firewall to monitor outbound traffic for unusual behavior.
  • Prepare for npm v12's breaking change that disables install scripts by default.

Why it matters

In production, securing your CI/CD pipelines against supply chain attacks can prevent significant breaches and protect sensitive data. Implementing these strategies can safeguard your projects and maintain trust in your development processes.

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
RailwaySponsor

Deploy any app in seconds — no infrastructure config, no DevOps overhead. Instant deployments from GitHub, built-in databases, and automatic scaling.

Start deploying free →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.