Disrupting Supply Chain Attacks: Securing npm and GitHub Actions
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 docsDeploy any app in seconds — no infrastructure config, no DevOps overhead. Instant deployments from GitHub, built-in databases, and automatic scaling.
Start deploying free →Why Dependabot's Cooldown is a Game Changer for Version Updates
Dependabot now implements a cooldown period before issuing version updates, and this is a crucial safeguard against malicious releases. By default, it waits at least three days after a new release, giving time for potential threats to be identified. This article dives into how this mechanism works and what it means for your CI/CD pipeline.
GitHub Repository Ownership: A Game Changer for CI/CD
GitHub's durable ownership model transforms repository management by ensuring every repo has a clear owner. With ownership types like 'Service Catalog' and 'Hubber Handle,' you can maintain accountability and streamline operations.
Elevating Security: GitHub's Bug Bounty Program Redefined
GitHub's bug bounty program is evolving, and you need to know how to navigate these changes. With stricter evaluation criteria, including a working proof of concept, your submissions must demonstrate real security impact. Dive in to learn how to effectively contribute and avoid common pitfalls.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.