Package URLs: the What and Why

Kay Herklotz
3 min readJan 16, 2024

--

How would you manage all these packages? (generated by author using ideogram.ai)

In the ever-evolving world of software development, managing dependencies can be a complex task.

With the introduction of Package URLs (PURLs), developers now have a standardized way to identify and locate software packages across various ecosystems. We’ll dive into what PURLs are, their importance, and how they are transforming software dependency management.

What are Package URLs (PURLs)?

Package URLs are a standardized format for identifying software packages in a consistent and precise manner. Unlike traditional URLs, which can be ambiguous and vary across package managers, PURLs provide a uniform way to reference software packages. This is particularly useful in environments where software dependencies are managed across different platforms and languages.

The Structure of a PURL

A typical PURL consists of several components, each serving a specific purpose:

  • Type: Indicates the package manager or ecosystem (e.g., npm, pypi, maven).
  • Namespace: Often represents the vendor or organization (e.g., apache for Apache projects).
  • Name: The name of the package.
  • Version: The version of the package (optional but recommended for specificity).
  • Qualifiers: Additional qualifiers for cases where more context is needed.
  • Subpath: Specifies a subpath within a larger package, if applicable.

PURLs can vary significantly depending on the package manager, ecosystem, and the specific characteristics of the package. To demonstrate this, here are a few examples to show how PURLs can cover at wide variety of software to uniquely identify it.

JavaScript Package (npm):

In this example, npm is the package manager, @yourorg/yourpackage is the namespace and package name, 1.0.0 is the version.

pkg:npm/@yourorg/yourpackage@1.0.0

Python Package (PyPI):

Here, pypi indicates the Python Package Index, django is the package name, and 3.2.5 is the version.

pkg:pypi/django@3.2.5

Java Library (Maven):

This PURL is for a Maven package where org.apache.commons is the namespace, commons-lang3 is the package name, and 3.12.0 is the version.

pkg:maven/org.apache.commons/commons-lang3@3.12.0

C++ Library (Generic):

Since C++ doesn’t have a centralized package manager like npm or PyPI, PURLs for C++ libraries often use the generic type and can include a download URL as a qualifier.

pkg:generic/opencv@4.5.2?download_url=https://opencv.org/releases/&arch=x64&os=win

opencv is the library name, 4.5.2 is the version, and the download_url qualifier points to the website where the library can be downloaded. The qualifiers arch=x64 and os=win provide additional context about the architecture and operating system.

Since many C++ are hosted on SourceForge, here is another example, this time for the libpng library:

pkg:generic/libpng@1.6.37?download_url=https://sourceforge.net/projects/libpng/

Here, libpng is the library name, 1.6.37 is the version, and the download_url points to the SourceForge project page.

Debian Package:

In this PURL, deb indicates a Debian package, debian is the namespace, libboost-all-dev is the package name, and 1.74.0 is the version.

pkg:deb/debian/libboost-all-dev@1.74.0

Why are PURLs Important?

With these PURLs we can now get an overview of our software project and by that I don’t siimply mean which libraries you have used for coding, but also OS used or any other components like docker containers, databases etc. Keep track of these is vital, to know which dependencies you have and to manage them accordingly. PURLs are instrumental in vulnerability management, allowing security tools to accurately identify and report on specific package versions. It will be in no distant future, where regulation will finally catch up to the world of software and demand a reliable way to document the use of software components.

Taking closer look at SBOMs

One of the most critical applications of Package URLs (PURLs) is in the creation and management of Software Bills of Materials (SBOMs). An SBOM is essentially a comprehensive inventory of all software components in a product or system. It’s becoming increasingly important for security, compliance, and supply chain management. It brings a level of detail and precision that is essential for managing the complexities of modern software systems. As the software industry continues to evolve, the use of PURLs in SBOMs will likely become a standard practice, underscoring their importance in building secure and reliable software.

Conclusion:

Package URLs are more than just a technical specification; they represent a significant step forward in the standardization of software dependency management. By adopting PURLs, developers and organizations can achieve greater clarity, security, and efficiency in their software development processes.

Reference

PURL Spec

Embrace the use of PURLs in your projects to streamline dependency management and enhance your software’s security posture.

--

--