Skip to main content
Configure Sonatype Nexus Repository to use the Package Firewall URL as the remote storage for a proxy repository instead of the public package registries. Every package installation request flows through Endor Labs, so the Package Firewall can block known malicious packages before they reach your environment. The Package Firewall evaluates each package request based on the malware check and the configured Package Firewall policy conditions, and handles each request in one of the following methods:
  • Block the installation if the package is found in the Endor Labs malware database, or if a policy condition matches with Block. Nexus Repository returns HTTP 404 response. The Package Firewall records a log with the package, version, and reason.
  • Allow the installation if a policy condition matches with Warn. The Package Firewall records a warning log with the package, version, and reason.
  • Allow the installation if the package passes all checks. No log is recorded.
A Package Firewall policy change doesn’t take effect immediately for packages Nexus Repository has already cached. Nexus Repository serves cached content without contacting the Package Firewall, so a cached package keeps its earlier outcome until the entry expires or you invalidate it. A package cached before Endor Labs flagged it as malware continues to install, and a package blocked before you added an exception remains blocked. Configure a shorter cache lifetime in your repository settings to make policy changes take effect sooner and send more requests to the Package Firewall. For more information, refer to Configurable repository fields. Nexus Repository returns a generic HTTP 404 response when it blocks a request without surfacing the specific reason. To see why a package was blocked, review the Package Firewall logs.
Sonatype Nexus Repository requirementYou must have a Sonatype Nexus Repository instance with permission to create proxy repositories and configure credentials.

Configure the Package Firewall

Complete the following steps to integrate Sonatype Nexus Repository with the Endor Labs Package Firewall:
  1. Create an API key for the Package Firewall.
  2. Configure Sonatype Nexus Repository.
  3. Set up local package managers.
  4. Verify your setup.

Create an API key for the Package Firewall

Create an API key dedicated to the Package Firewall so that can authenticate to it. You can create it through one of the following methods:
  • Using the Endor Labs user interface, with the Package Firewall User role. See API keys to learn more.
  • Using endorctl, with the SYSTEM_ROLE_PACKAGE_FIREWALL role. Make sure to install and configure endorctl before you create the key.
To create the key using endorctl, run the following command and replace:
  • <namespace> with your namespace.
  • <API key name> with the name of the API key for the Package Firewall use case.
  • <YYYY-MM-DDTHH:MM:SSZ> with the API key expiration in ISO 8601 UTC format, for example 2026-12-31T23:59:59Z.
From the response, save the following values in a secure location. Use them as your Package Firewall credentials when you configure the Nexus Repository proxy repository.
  • API key: spec.key
  • API secret: spec.secret

Configure Sonatype Nexus Repository

Configure a proxy repository in Nexus Repository for each package type you want to route through the Package Firewall. A proxy repository fetches artifacts from an upstream source, so you set the Package Firewall URL as the remote storage. The remaining repository settings, such as blob store and cleanup policies, are specific to Nexus Repository. Configure them based on your requirements.
  1. Sign in to Sonatype Nexus Repository.
  2. Select Settings > Repository > Repositories.
  3. Click Create repository.
  4. Select npm (proxy) as the recipe.
  5. Enter the repository name, such as endor-firewall-npm.
  6. In Remote Storage, enter https://factory.endorlabs.com/v1/namespaces/<namespace>/firewall/npm/. Replace <namespace> with your Endor Labs namespace.
  7. Select Authentication under HTTP Authentication.
  8. In Authentication type, choose Username.
  9. Enter the API key as the Username and the API secret as the Password.
  10. Click Create repository.
  1. Sign in to Sonatype Nexus Repository.
  2. Select Settings > Repository > Repositories.
  3. Click Create repository.
  4. Select pypi (proxy) as the recipe.
  5. Enter the repository name, such as endor-firewall-pypi.
  6. In Remote Storage, enter https://factory.endorlabs.com/v1/namespaces/<namespace>/firewall/pypi/. Replace <namespace> with your Endor Labs namespace.
  7. Select Authentication under HTTP Authentication.
  8. In Authentication type, choose Username.
  9. Enter the API key as the Username and the API secret as the Password.
  10. Click Create repository.
  1. Sign in to Sonatype Nexus Repository.
  2. Select Settings > Repository > Repositories.
  3. Click Create repository.
  4. Select go (proxy) as the recipe.
  5. Enter the repository name, such as endor-firewall-go.
  6. In Remote Storage, enter https://factory.endorlabs.com/v1/namespaces/<namespace>/firewall/go/. Replace <namespace> with your Endor Labs namespace.
  7. Select Authentication under HTTP Authentication.
  8. In Authentication type, choose Username.
  9. Enter the API key as the Username and the API secret as the Password.
  10. Click Create repository.
To give clients a single endpoint that resolves across multiple Go proxy repositories, create a go (group) repository and add endor-firewall-go as a member. For more information, refer to Repository types.
  1. Sign in to Sonatype Nexus Repository.
  2. Select Settings > Repository > Repositories.
  3. Click Create repository.
  4. Select maven2 (proxy) as the recipe.
  5. Enter the repository name, such as endor-firewall-maven.
  6. In Remote Storage, enter https://factory.endorlabs.com/v1/namespaces/<namespace>/firewall/maven/. Replace <namespace> with your Endor Labs namespace.
  7. Select Authentication under HTTP Authentication.
  8. In Authentication type, choose Username.
  9. Enter the API key as the Username and the API secret as the Password.
  10. Click Create repository.
If you have a Maven group repository that combines several repositories, make sure no other member proxies Maven Central directly. Nexus Repository returns the first member that has the component, so a member with its own path to the public registry serves packages the Package Firewall blocked.

Set up local package managers

Update your package manager to use the Nexus Repository proxy repository as its source, routing all package installations through the Package Firewall instead of the public registry. Nexus Repository serves each repository at https://<nexus-host>/repository/<repository-name>/. Replace <nexus-host> with your Nexus Repository host, and the port if your instance uses one, such as nexus.example.com:8081. Replace <repository-name> with the repository you created. Each example includes the credentials to add when your proxy repository requires authentication. Omit them if your proxy repository allows anonymous read access. Replace <nexus-username> and <nexus-password> with your Nexus Repository credentials, not the Endor Labs API key and secret stored on the proxy repository.
Run the following command to point npm at the proxy repository.
If your proxy repository requires authentication, encode your credentials as a Base64 string.
Add the following lines to your .npmrc file at the project level, or in the user-level file at ~/.npmrc. Replace <base64-credentials> with the string you generated.
Run npm config get registry to confirm the registry matches the repository URL.For more information, refer to npm registry documentation.
Add the following lines to your pip.conf file.
If your proxy repository requires authentication, include your credentials in the index URL.
Run pip3 config list | grep index-url to confirm the index URL matches the repository URL.For more information, refer to Configure PyPI with Nexus.
Run the following command to point the Go module proxy at the repository.
If your proxy repository requires authentication, Go reads your credentials from a .netrc file rather than from the proxy URL.Run go env GOPROXY to confirm the proxy matches the repository URL.For more information, refer to Configure Go with Nexus.
Add a mirror to your ~/.m2/settings.xml file that points at the proxy repository. If your proxy repository requires authentication, add a server with the same <id> as the mirror.
Run mvn dependency:resolve to confirm Maven resolves through the mirror.For more information, refer to Maven repository documentation.

Verify your setup

To verify your setup, install a package that Endor Labs has classified as malware. The Package Firewall should block the installation and return an HTTP 404. The following are examples of packages classified as malware by Endor Labs.
Run the following command to test the Package Firewall with npm.
When the Package Firewall blocks the package, the output looks similar to the following. The E404 error code and 404 Not Found response confirm that the firewall blocked the package.
Run the following command to test the Package Firewall with pip.
When the Package Firewall blocks the package, the output looks similar to the following. The 404 response confirms that the firewall blocked the package.
Run the following command to test the Package Firewall with Go.
When the Package Firewall blocks the package, the output looks similar to the following. The 404 response confirms that the firewall blocked the package.
Add io.github.endorlabs:endor-java-webapp-demo:4.1 as a dependency in your pom.xml, then run the following command to test the Package Firewall with Maven.
When the Package Firewall blocks the package, the output looks similar to the following. Nexus Repository doesn’t serve the artifact, so resolution fails with a missing POM warning and a Could not find artifact error.
After you confirm that the Package Firewall blocks malware, you can view the recorded events. See View Package Firewall logs to learn more.

Troubleshooting and FAQ

If Endor Labs flags a package as malware after Nexus Repository cached it, Nexus Repository continues to serve it until the cache expires. Reduce the component and metadata maximum age on the proxy repository to shorten that window.
Nexus Repository caches negative responses in its not found cache. After the Package Firewall starts allowing a package, Nexus Repository can keep returning HTTP 404 until that entry expires. Invalidate the cache on the proxy repository to pick up the change immediately.
  • Verify that the Package Firewall URL in the proxy repository remote storage is correct.
  • Ensure network connectivity from Nexus Repository to the Package Firewall.
  • Ensure your network firewall rules allow outbound connections from Nexus Repository.
  • Verify the API key and secret are correct and that the key has the Package Firewall User role.
  • Confirm that Authentication is selected on the proxy repository and that the credentials are saved.
  • Check the Nexus Repository logs for authentication errors.