Semgrep Malware Firewall is in private beta. Contact your Semgrep account manager or Semgrep Support to join the beta.
Prerequisites
To use the Semgrep Malware Firewall, you must meet the following requirements:- Have an active Semgrep account
- Have access to a macOS or Linux terminal or shell
- Have the Malware firewall setting turned on for your organization. See Turn on the firewall for your organization
Turn on the firewall for your organization
When the Malware firewall setting is on, the firewall blocks packages that Semgrep flags as malicious before they install. An admin can turn it on in either of the following ways:- In Settings > General > Global, turn on Malware firewall.
- On the Dashboard, in Recommended actions, click Turn on in the Turn on malware firewall row. The row appears when Malware Firewall is available to your organization and the setting is off.
Supported package managers
The firewall monitors package-manager traffic to supported package registries, not source code in your repository. When a supported package manager fetches a package, the firewall checks that package version before the download completes.Install and verify
Semgrep Guardian and the Semgrep Malware Firewall protect different components of the development workflow.
- Guardian scans code generated by AI coding agents before it is committed.
- Semgrep Malware Firewall blocks malicious packages when developers install dependencies on their local machine.
/install-mfw skill installs and configures the firewall for you. You can also install the firewall manually.
- With Semgrep Guardian
- Manual install
Semgrep Guardian ships with an
/install-mfw skill that installs and sets up the firewall for you.1
In Claude Code or another AI coding agent that has Semgrep Guardian installed, run:
2
Follow the prompts. The skill downloads the
mfw client, adds a local certificate authority to your trust store, sets up shell integration and a background daemon, and walks you through signing in.3
Restart your terminal so it loads the
HTTP_PROXY and HTTPS_PROXY environment variables.Test the firewall
Use a known-safe demo package to confirm that the firewall blocks malicious installs without touching real malware.1
Open or create a test directory and initialize a project:
2
Attempt to install the demo malware package:
3
Expected result: the install is blocked. The firewall should intercept and reject the package.
mfw doctor output, and see Troubleshooting.
Optional: repeat the test with pip:
Check a dependency
Usemfw api to determine whether a specific version of a package is malicious.
Python example:
maven (for both Maven and Gradle projects) and the package name is the groupId:artifactId coordinate, such as com.google.guava:guava.
Request an exception for a blocked package
If you need a package version that the firewall blocks, ask an admin of your deployment for an exception:Protect private registries
By default, the firewall checks downloads from public registries, such asregistry.npmjs.org and Maven Central. To also check package downloads from your organization’s private registries, such as an internal npm or PyPI mirror, an admin can add those registries in Semgrep AppSec Platform. The firewall applies the registries you configure to every machine in your deployment.
The firewall checks downloads from the following private registries:
- Registries already connected to Semgrep. If you connected a private registry to Semgrep in Settings > Integrations, for example for Dynamic Dependency Resolution or Upgrade Guidance, the firewall monitors installs from it automatically. You don’t need to add it again.
- Firewall-only registries. If you want the firewall to check a registry but Semgrep doesn’t need to connect to it for other features, add it as a firewall-only registry. Firewall-only registries don’t require credentials.
Add a registry for the firewall only
1
Sign in to Semgrep AppSec Platform.
2
Navigate to Settings > Integrations.
3
Click Add integration, then select Registry.
4
For Use this registry for, select Malware firewall only.
5
Provide the following information:
- Optional: a Name for the registry, which Semgrep AppSec Platform displays in the list of registries.
- The registry Host, as
hostorhost:port. Don’t include a scheme or path. For example,artifactory.example.com. If you don’t include a port, the firewall matches any port. To match all subdomains of a host, prefix it with*., for example*.example.com. A wildcard matches subdomains only, not the host itself. - The Package manager that the registry serves: PyPI, npm, Maven / Gradle, Cargo, or Go modules. The firewall uses it to read the package name and version from each download URL.
- Optional: the Base path that the registry is served under on the host, for example
/artifactory/api/npm/npm-virtual. Leave it empty if the registry is served from the root of the host.
6
Click Add registry.
View firewall activity
To review firewall scan activity and blocked malicious dependencies, go to Reporting in Semgrep AppSec Platform and find the Guardian section. For more information, see Guardian reporting.How Malware Firewall integrates with your system
Installing Semgrep Malware Firewall makes the following changes to your system:- PATH shims: Installing the firewall adds a shim for each package manager to the front of your
PATH. Each shim runs the package manager with the required environment variables, such asHTTP_PROXYandNODE_EXTRA_CA_CERTS, so that traffic goes through the firewall proxy. Shims also enable communication with the firewall, allowing it to print the exact reason a package was blocked. - Trust store update: The firewall’s certificate is added to your trust store so that the firewall can identify which package version a package manager requests. Package managers send registry requests directly to the firewall proxy. The firewall terminates the connection, captures the package name and version from the request, and reissues the request to the registry. For the TLS handshake between the package manager and the firewall to succeed, the package manager must trust the certificate that the firewall presents. The firewall’s certificate is added alongside existing trusted certificates and does not remove or replace any of them.
- Background daemon: Keeps the firewall and its configuration, such as private registry locations, up to date. You don’t need to reinstall or manually reconfigure the firewall.
How the firewall works
The firewall has three parts:- A lightweight client proxy that runs on every machine. You set it up once with
mfw install. For most package managers, it setsHTTP_PROXYandHTTPS_PROXYso they use the proxy automatically. You don’t need per-tool configuration, such astool.uv.indexforuv. The proxy watches known package registry URLs such asregistry.npmjs.org(npm) andrepo.maven.apache.org(Maven Central). It identifies package-download requests, including tarballs, wheels, JARs, and similar artifacts, and waits for a Semgrep backend response before the download completes. All other traffic passes through the proxy. - The Semgrep-operated malware firewall backend, which receives requests from the local proxy containing an ecosystem, package name, and version, and replies with a verdict.
- The malware database, continuously updated from a variety of threat feeds and maintained by Semgrep’s Security Research team.
Request cycle
- On install, the firewall runs
mfw loginto sign you in. Each verdict request is then authenticated with a short-lived bearer token. - When you run a normal package install, the local proxy intercepts every package the installer tries to fetch.
- The proxy asks the Semgrep backend whether the specific version of that package is malicious.
- The backend matches the version to the malware database and returns a verdict.
- If the package is safe, the install proceeds normally. If it matches known malware, the proxy blocks the download and reports why.
Limitations and special cases
Maven and Gradle proxy behavior
Java build tools don’t readHTTP_PROXY or HTTPS_PROXY. Instead, mfw routes them through command-line shims:
- Maven: a generated
--global-settingsfile, applied automatically on each run - Gradle: JVM proxy system properties, applied automatically on each run
mvn and Gradle commands invoked from your shell are gated.
Existing Gradle dependencies aren’t re-fetched
Gradle keys its cache by checksum. Dependencies already in~/.gradle/caches aren’t re-fetched, so coverage starts at the next cache miss.
User-configured proxies bypass gating
If a build already sets its own proxy (for example,systemProp.https.proxyHost in gradle.properties, or an active <proxy> in your Maven settings.xml), mfw doesn’t override that configuration, so it doesn’t gate that run.
No built-in cooldown configuration
The firewall doesn’t currently support configuring a cooldown period before a newly published package version can be installed. Semgrep recommends configuring cooldowns in your package managers. See cooldowns.dev for a guide across ecosystems.How quickly malware data is updated
- For active, high-severity Supply Chain threats, Semgrep’s Security Research team ships advisories as soon as it identifies the threat, rather than waiting for other sources, such as the Open Source Vulnerabilities (OSV) database, to publish them.
- For all other findings, the malware database syncs from OSV every 2 hours.
Troubleshooting
Uninstall the firewall
To remove the firewall and its proxy configuration from a machine:HTTP_PROXY and HTTPS_PROXY environment variables that mfw install configured and removes the local proxy process. Restart your terminal or shell afterward to confirm that the variables are cleared.
To verify removal:
Semgrep mfw is protecting this machine ✅.