GitHub’s firewall screens npm packages before installation – preview for Enterprise Cloud
On 20 October, GitHub released a preview of a package firewall that checks npm packages against an enterprise’s rules before they are installed on a developer’s machine, in a coding agent’s runtime environment or in a CI run. For now, the service is free for GitHub Enterprise Cloud customers.
GitHub released a package firewall on 20 October. It checks software packages before they are installed on a developer’s machine, in a coding agent’s runtime environment or on a CI server. CI, or continuous integration, is a system that automatically builds and tests code after every change. The firewall is in public preview and is available to GitHub Enterprise Cloud customers, including those whose data is stored in a specific region. For now, it supports only npm packages.
In its changelog, GitHub points to a flood of malware attacks that strike as early as the moment a package is installed. Agents and CI runs are particularly vulnerable, the company said, because they install dependencies during a task or build without a human supervising the installation.
The firewall acts as an intermediary. A developer’s npm client or a CI run fetches packages from the firewall’s address rather than directly from the public npm registry. The firewall inspects both package metadata requests and the downloads themselves, and blocks downloads that break the enterprise’s rules. GitHub’s documentation lists five rules:
- Known malware: the firewall blocks a package if the GitHub Advisory Database holds a malware advisory for it. The rule is on by default.
- Vulnerabilities: an administrator chooses which severity level of vulnerability blocks an installation. By default, only critical vulnerabilities are blocked.
- Missing provenance: an attestation is signed evidence of where and how a package was built. If earlier versions of a package had SLSA attestations but the requested version does not, the firewall blocks the download. A missing attestation can be a sign that the publishing process has been hijacked, the documentation says.
- New install scripts: the firewall blocks a package if a script that runs during installation has recently been added to it. Such scripts can run any commands and steal credentials, the documentation warns.
- Minimum age: a new version gets through only once a set time has passed since its release, so that threats can be detected in time. The period can be 1–365 days, and the default is one day.
To set the firewall up, users add an enterprise-specific firewall address and an access token to npm’s configuration file. The token must belong to a member of the enterprise or to a bot account, and read access to public repositories is enough. The documentation advises storing the token as, for example, a secret in the CI system rather than in a repository.
A JFrog Artifactory package repository can be configured to fetch packages through the firewall, but this support is still experimental. GitHub’s instructions set up a remote repository in Artifactory that fetches through the firewall and combine it with private repositories in a virtual npm repository. Remote repositories that fetch packages directly from the public npm registry must be left out of that virtual repository, the documentation says. Otherwise, packages can bypass the firewall.
If the firewall blocks a package that is needed, npm’s output or the CI log shows a link to an exception request. An enterprise administrator or security manager approves the request. In the documentation’s example, the minimum age rule blocks a new version that contains a security fix.
The service is free during the preview. GitHub said the firewall will become a paid service when it reaches general availability, billed by usage in a similar way to GitHub Actions. In the documentation, GitHub notes that the feature may still change.