Let me share my pain with you. I maintain libraries for Package URLs and VERS version ranges in Ruby (purl, vers) and Go (purl, vers), and ecosyste.ms and git-pkgs use them anywhere manifests, lockfiles, SBOMs, registry metadata and advisories have to be joined up. In theory the two specs make that kind of cross-ecosystem tooling easy. In practice there are more than forty package types, every one of them has its own rules for names, case, versions and ranges, and the specs cover some of those rules and leave the rest to me. Both specs are also still changing, so I’m chasing them as well as the ecosystems.

Pretty much every fix gets made twice, once per language, then checked against whatever the ecosystem’s own tool does, and then checked again a few months later when the spec text or its test suite has moved. Everything in this post caught me out at least once, and I’ve linked the bug or spec thread where it happened. Hardly any of it failed loudly, either: most of these bugs returned a successful response with wrong or missing data in it, like an empty advisory list for a package that has advisories or a cache entry for a different package, and a scanner reads an empty list as clean.

A Package URL, or purl, is a short string that identifies a package: pkg:npm/%40babel/[email protected] is version 7.24.0 of @babel/core on npm, and pkg:deb/debian/[email protected]?arch=amd64 is a Debian build of curl. VERS is the same project’s notation for version ranges, where vers:npm/>=1.2.0|<2.0.0 means every npm version from 1.2.0 up to but excluding 2.0.0. Purl is now an Ecma standard, ECMA-427. CycloneDX and SPDX documents both include purls, the OSV API accepts them as queries. Syft and Trivy emit one for each package they detect.

Encoding

Percent-encoding is the first thing to break in a new implementation, partly because the spec text changed. For seven years it contained both “may need to be encoded” and “is unambiguous unencoded everywhere” for a colon, and a 2025 survey in that thread found ten implementations writing : and four writing %3A. The current text leaves a colon unencoded everywhere and encodes every other separator when it appears as data, which makes a registry qualifier come out as repository_url=https:%2F%2Fnpm.example.com. My Go library writes that form, and my Ruby one writes https://npm.example.com, which the spec’s grammar notes describe as “not canonical, but usable”, so that older stored strings match. The spec’s OCI examples use both sha256%3A and sha256:.

Version 1.x of the Ruby gem decoded a literal + as a space the way HTML forms do, so pkg:golang/github.com/docker/[email protected]+incompatible was looked up as v28.3.3 incompatible and packages.ecosyste.ms reported it missing, along with Debian versions like 15.3-0+deb12u1 and the package gtk+3.0. The same release wrote qualifier values back raw. A stored repository_url=git%2Bssh%3A%2F%2F... was parsed correctly and re-serialized as git+ssh://, so the next read produced git ssh://, at which point a reindex in another service failed on a uniqueness constraint. The fix was a major version, and of 5,650 real purls I checked it against, ten changed.

The @ sign separates name from version and also starts every npm scope, where the type definition requires it “always percent encoded” as %40. Plenty of real input has pkg:npm/@babel/core, the spec’s test suite contains passing cases written that way, and the reference parsing steps split on the last @, so pkg:npm/@babel/core#lib reads babel/core as the version. In Homebrew the formula openssl@3 has to be written pkg:brew/openssl%403, because pkg:brew/openssl@3 is version 3 of a formula called openssl. A strict parser rejects purls like pkg:npm/@babel/core, so both of my libraries accept those forms and write back the canonical one.

Names

Each purl type has its own rules for what counts as the same name, written as free text in the type definition, and a parser that skips them produces well-formed strings that fail every lookup. PyPI names are compared after lowercasing and collapsing runs of -, _ and . into a single dash. packages.ecosyste.ms stored typing_extensions as published while generating pkg:pypi/typing-extensions for it, so a lookup of the service’s own purl missed the package. My Ruby library folds zope.interface into zope-interface as the type definition requires, and my Go one returns zope.interface from the parser because the upstream packageurl-go does.

NuGet names are case-insensitive, which the type definition records as case_sensitive: true next to the note “case-preserving, but case-insensitive”. ecosyste.ms ended up with four rows for Newtonsoft.Json before moving to lowercase storage.

Go module paths are case-sensitive, and the golang definition has case_sensitive: true and, one line down, “The namespace shall be lowercased”, which is what packageurl-go does. github.com/Sirupsen/logrus and github.com/sirupsen/logrus are different zips with different checksums on the module proxy, so when the git-pkgs proxy keyed its cache on the lowercased purl it served whichever was fetched first and go failed the checksum on the other.

The boundary between namespace and name varies by type too: Maven joins group and artifact with a colon in its own tools and a slash in a purl. ecosyste.ms stores the colon form, and a client of mine that built lookup names by joining namespace and name with / for every type got an empty result for every Maven package, advisory lists included. packages.ecosyste.ms built GitHub Actions purls from the first and last path segments of the name, which turned the nested actions github/gh-aw/actions/setup and github/gh-aw-actions/setup into one purl. Docker Hub’s official images have an implicit library/ prefix, so pkg:docker/python and pkg:docker/library/python are the same image, and the lookup found only the second.

advisories.ecosyste.ms builds a purl from a stored name by passing the whole name through as the purl name, and its API currently returns pkg:go/github.com%2Fgorilla%2Fmux where the correct purl is pkg:golang/github.com/gorilla/mux, and the SBOM export on repos.ecosyste.ms interpolates a string to get pkg:maven/org.hamcrest:hamcrest in place of pkg:maven/org.hamcrest/hamcrest. My Ruby gem converts https://pkg.go.dev/github.com/gorilla/mux to a golang purl with the whole path as its name, when the namespace should be github.com/gorilla and the name mux. For the advisories and repos cases I’ve proposed a helper in the gem that takes an ecosystem and a package name and splits it per type.

The swift type has two naming schemes in use: scanners and advisory databases write the source location, pkg:swift/github.com/apple/swift-argument-parser, while SwiftPM’s own SBOM output for registry packages writes the registry identity, pkg:swift/apple/swift-argument-parser. OSV returns an empty list for the second form, and a vulnerability scanner reports that as clean. The Go library now distinguishes them by checking the namespace for a dot, and the spec issue has been open since July 2026.

Types

Every database already has its own name for each ecosystem, and the purl type adds another:

purl type OSV GitHub Advisories packages.ecosyste.ms
gem RubyGems rubygems rubygems
pypi PyPI pip pypi
cargo crates.io rust cargo
golang Go go go
composer Packagist composer packagist
hex Hex erlang hex
swift SwiftURL swift swiftpm
githubactions GitHub Actions actions actions

Every project of mine that handles purls contains a copy of this table, and the copies have diverged. The git-pkgs proxy stored one package under both gem and rubygems because two code paths used different tables. A wrong entry usually produces an empty result and a success status: the Grype database uses Syft’s names (go-module, rust-crate, java-archive), so seven ecosystems return empty results through a table written with other names. An error can fail more than the one entry, as with OSV’s batch endpoint, which returned a 400 for the whole batch when one ecosystem name was unrecognised. advisories.ecosyste.ms stores advisories under packagist, hex, pub, actions and swift (GitHub’s name, where packages.ecosyste.ms uses swiftpm). Its table of eleven purl types omits all five, and a lookup by pkg:composer/symfony/http-kernel currently returns a 400.

People writing purls by hand use the registry’s name, and pkg:rubygems/[email protected], pkg:crates/serde and pkg:go/... all parse as valid purls with unregistered types. Denylist entries written like that in the proxy config failed to match and the proxy served the blocked version, so it now refuses them at startup. ecosyste.ms defaults the type to the registry’s class name, which shipped pkg:openvsx/... for Open VSX when the registered type is vscode-extension with a repository_url. Both my libraries used pkg:homebrew before brew was registered, and both accept it as an alias. Chef and Vagrant are unregistered, Helm’s type has been an open pull request since 2023, and for those my manifest parser returns an empty purl.

Registries

A purl names a package within a type, and the type implies a default registry, so pkg:npm/lodash is lodash on registry.npmjs.org. Anything else is meant to carry a repository_url qualifier, which works only if both sides write the URL identically, and the spec’s examples put gcr.io, with no scheme, in that qualifier. Maven Central is served from both repo1.maven.org and repo.maven.apache.org, and whether the qualifier is needed for the one the spec lists as non-default is an open issue. Cargo’s lockfile records the default index as a git URL, which my manifest parser passed through as a qualifier, and the ecosyste.ms registry lookup for that URL came back empty. Scanners routinely omit the qualifier, so a Trivy purl for an artifact hosted on a project’s own Maven repository gets looked up on Central and returns 404.

Containers have two types: pkg:docker allows the registry host in the namespace, and pkg:oci forbids a namespace and puts the whole location in repository_url. Implementations parse the overlap differently, and in the proxy a pull checked as pkg:oci passes a denylist entry written for the same image as pkg:docker.

Distro packages put the distribution in the namespace (pkg:deb/debian/openssl) and the release in a distro qualifier that appears only in the examples of the deb and rpm definitions. Trivy and syft write debian-12 or ubuntu-22.04, package archives use codenames, and the translation is a hand-maintained table. A consumer that skips the qualifier gets every release’s advisories for the package at once. The epoch is part of the version for deb and a separate qualifier for rpm, and real purls have it in the version, in the qualifier, or absent.

Scanners report binary packages (libssl3) while most indexes and advisories are keyed by source package (openssl). Syft bridges the two with an upstream qualifier, and a lookup that skips it searches for libssl3 in an index keyed by openssl. A package installed from a third-party apt repository such as PGDG gets the same pkg:deb/debian/... purl as Debian’s own build, so PGDG’s build is matched against Debian’s advisories.

Manifests

Lockfiles are full of entries that come from local paths, URLs and git checkouts, and a parser that mints a purl for each one sends them all to registry and advisory lookups. Before I added a flag marking an entry as having no purl, deno.json imports of local paths and URLs became pkg:deno/.%2Fsrc%2Futils%2F and pkg:deno/node:fs. Git submodules were named by their checkout path, and every package in an renv.lock, Bioconductor and GitHub sources included, was given a pkg:cran purl.

The same parser currently gives a package.json dependency on file:../local-lib the purl pkg:npm/local-lib, which identifies whatever package has that name on npmjs.org, and a package-lock entry for lodash installed under the alias my-lodash comes out as pkg:npm/my-lodash. A Gemfile.lock git remote is written into repository_url, the qualifier for an alternative gem server. A Cargo [patch] section or an npm overrides block (or replace in go.mod) swaps the code that gets installed while the lockfile records the registry’s name and version.

A manifest declares a range where a purl has a version, and the version component is an opaque string, so pkg:npm/lodash@^4.17.21 is a valid purl. One git-pkgs command built that purl and then derived the tarball URL lodash-^4.17.21.tgz from it. The SBOM export on repos.ecosyste.ms puts ^7.19.6 in the CycloneDX version field. The spec provides a vers qualifier on a versionless purl for this, though what a versionless purl means on its own (the package in general, or all its versions) was debated and moved to a discussion board, where it is open. Dropping the version to get a map key collapsed a lockfile with [email protected] and [email protected] to one entry.

A versioned purl maps to several files in some ecosystems, since pkg:gem/[email protected] covers a source gem and a precompiled gem per platform, and a resolver that drops the platform qualifier turns pkg:gem/[email protected]?platform=java into the URL of the ruby-platform gem, which returns 403. My Gemfile.lock parser currently strips the platform from nokogiri (1.16.5-arm64-darwin) and reports the purl of the source gem.

Equality

The standard requires that “equivalent PURLs are consistently resolved to the same canonical representation”, and the definition of equivalent is an open issue. Qualifier order is only recommended, and whether unknown qualifiers count is also open. Several of the per-type rules (NuGet case, Docker’s library/, conda’s channel appearing as namespace or qualifier) change stored data when applied to the canonical string. String comparison reports two NuGet names that differ only in case as different packages, and two Go paths that differ only in case as the same package once lowercased.

A pull request from simonchrz gave the Go library a second form: the stored purl is the canonical string it already produced, and a comparison form applies additional per-type folding rules and is used only as a key. ComparisonForm returns a copy of the purl with six per-type rules applied:

  • PyPI names are lowercased and folded
  • NuGet names and versions are lowercased
  • a leading v is stripped from a Composer version, since Packagist stores the tag v6.1.7 and Composer resolves it as 6.1.7
  • a conda channel written as a namespace or as channel/name moves into the channel qualifier
  • an OCI namespace is joined onto the name
  • a Swift registry identity is lowercased, while a source location such as github.com/apple is copied as written

Docker’s library/ prefix is absent from the six. The rules are applied in ComparisonForm alone, which equality checks and deduplication call, because callers have already stored the output of Parse and String as keys and a change there would orphan those rows.

The proxy had four separate implementations of “same package” in its denylist, cache, cooldown and mirror before they were consolidated onto it, and earlier it had written two rows for Django and django. In a database the comparison form needs its own column and index. A bulk lookup on packages.ecosyste.ms that OR-ed a normalised-name predicate for a hundred PyPI purls took 84 seconds, and 25 milliseconds once it was grouped by ecosystem.

The newer ecosyste.ms purl lookup returns one result per input, in order, marked matched, missing or ambiguous, because a bulk response keyed by the server’s canonical purl omits every input that was spelled differently. On the advisories side, an empty list for a Debian build missing from the service’s data reads as a clean result, and that issue is open.

Versions

A purl version is an opaque string, and VERS has to order versions, because a range is defined by ordering. The VERS type index registers two schemes, npm and pypi. The types document describes fifteen ecosystems in a sentence each, the type definition schema has no field for comparison rules, and the generic type uses an algorithm that “will be specified later”, so each scheme’s ordering has to be ported from the native tool.

Falling back to a semver-shaped comparator for everything is the mistake I made in both libraries, and it returns a wrong answer instead of an error. In the Go library 5.2b1 parsed as 5.0.0 because the integer conversion of 2b1 failed and the error was discarded, so vers:pypi/<5.2b1|>=5.1 contained 6.0.3. The same comparator read a RubyGems fourth segment as a prerelease (1.0.0 > 1.0.0.1) and put Maven’s 1.0-sp1 below 1.0 when sp sorts above the release. It also parsed Debian’s 1:2.3.4-1 as 0.3.4-1 and 1.0~rc1 as 1.0.0 (all in one issue). Alpine had been delegated to the Gentoo comparator, which made 1.0_git equal 1.0, until I ported the apk-tools tokenizer, and Bazel’s ordering is covered in a separate post.

Go module versions include a leading v, and OSV and GitHub advisories for Go omit it, which is an open purl spec issue, so a version copied from an advisory into a config file fails to match the v-prefixed version the module proxy serves. The Go vers library strips the v for other schemes, and a user converting distro advisories reported rpm versions like openEuler’s v1.11.1-8.oe1, where the v is part of the version and stripping it makes an exact range fail to contain its own version. In opam, v0.17.0 is valid and sorts after every version that starts with a digit.

Ranges

A vers string is a flat list of constraints separated by pipes, and the spec text is that the pipes “do not mean ‘and’ or ‘or’”. The list is sorted by version, and containment iterates over it, pairing each lower bound with the next upper bound, so >=1.0.0|<2.0.0|>=3.0.0|<4.0.0 is two intervals, which readers and implementers both get wrong. Since 2026 only the canonical form is valid, so unsorted or duplicated constraints must be rejected, and vers:npm/=1.2.3 is an error because equality is written as a bare version. One required case in the spec’s test vectors repeats a version, which the same rule rejects.

VERS has no way to write an empty range or a prerelease policy, and native ranges use both. npm’s 1.1.2 1.2.2 (a space means AND, so its match set is empty) appears in advisory data. The upstream npm tests parsed a space as a union until a fix in October 2026, and my Go library matched those tests and emitted vers:npm/1.1.2|1.2.2, which matches two versions the original excludes; it now returns a sentinel and the Ruby one raises. In npm and Composer a range like <2.0.0 excludes 2.0.0-rc1 under rules that depend on how the range was written, and Elixir’s ~> 0.1.5 excludes 0.2.0-alpha.7 while the interval it converts to, >=0.1.5|<0.2.0, includes it.

Operators that look alike mean different things across ecosystems, and the Ruby library first rejected Cargo’s comma form while both libraries computed the wrong bounds for npm’s tilde on versions containing a zero:

  • ^0.0.3 is exactly 0.0.3 in npm and >=0.0.3 <0.1.0 in Dart’s pub
  • a bare 1.2.3 is an exact version in npm and ^1.2.3 in Cargo
  • a comma is AND in Cargo, PyPI and RubyGems, and a space is AND in npm
  • PyPI’s ~=1.4.5 and RubyGems’ ~> 1.4.5 match the same versions until an epoch or a .dev segment is involved
  • PyPI’s <2.0 excludes 2.0rc1 and ==1.0 matches 1.0+local, so matching a specifier differs from comparing versions
  • RubyGems’ ~> 1.2 excludes 2.0.a, and the Ruby library currently includes it
  • a bare 1.0 in a Maven POM is a soft requirement that dependency mediation can replace

Compound requirements are open bugs in both libraries as I write this. The Ruby library reads the RubyGems requirement ~> 1.2, >= 1.2.5 as a single version, while the Go one parses it correctly and then serializes every comparator as vers:gem/>=1.2|>=1.2.5|<2, which reparses as a range containing 5.0.0. The Ruby library serializes Hex’s and the same way. It also accepts the Go range >= 1.0.0 < 2.0.0 as a single lower bound, so the range contains 3.0.0; in advisory data that range has a comma. Maven’s [1.0,2.0],[3.0,4.0] is a union of two ranges, and the Go library returns one range whose upper bound is the string 2.0],[3.0,4.0.

GitHub writes advisory ranges as >= 1.0, < 2.0 for every ecosystem, which is valid native syntax in Cargo, PyPI and RubyGems and invalid in npm. When the Ruby library’s parsers became stricter, a rescue around the conversion in advisories.ecosyste.ms turned each rejection into an empty affected-versions list, and most compound ranges returned empty matches for about ten days. Stored ranges consisting of an operator alone parsed as unbounded and flagged every release. An advisory range lists the versions that contain a bug and a manifest range lists the versions a resolver may install, so an advisory range includes prereleases that a package manager’s matching rule skips. OSV’s range for a Next.js advisory, >=16.0.0|<16.3.3, excluded 16.3.0-canary.97 under npm’s rule. An install should skip that version and a scanner should report it. The Ruby library has an include_prerelease option for this and the Go one has an open issue.

Ranges come from untrusted input, and a few thousand != constraints ran for seconds in both libraries before input limits went in. The Go library’s Conan parser recurses on 1 - 2 until it overflows the stack, a fatal error in Go that ends the process.

Tests

Both specs ship a test suite, and my libraries passed both with the bugs in this post present. Purl’s moved from a single JSON file to per-type files in 2025, after which my Ruby gem’s compliance test loaded zero cases and reported the skip as a pass for over a year while the README said 100%. The suite requires an uppercase qualifier key to fail in one case and pass in another. The VERS suite has 491 npm conversion cases and one npm containment case, 977 Maven comparisons and zero Maven ranges, and zero cases for Cargo, Composer, deb, rpm or Go, so the build passed with the PyPI prerelease bug present.

Each ecosystem’s own tests found the bugs: the Go library now harvests fixtures from node-semver, pypa/packaging, RubyGems, composer/semver, dpkg, rpm, apk-tools and others, and every batch of imported fixtures came with comparator fixes. For purl I run a new parser over a few thousand purls from production data and diff the output against the old one.

Upstream

The second edition of ECMA-427 makes unregistered types valid with a warning, the 2025 rewrite put the encoding rules in one clause, and a git type was added in 2026. The distro qualifier was ruled out of scope for that edition, and the proposal to replace golang with a go type that takes the whole module path as its name has been open since 2024 with 76 comments.

Sixteen of the twenty-four spec issues and pull requests linked in this post are open. The type definitions and test cases are JSON files in the two spec repositories, so a fix merged there shows up in the test run of every library that syncs them, and the fixtures harvested for the Go vers library are due to go upstream. Checking the examples for this post produced eleven new issues on my four libraries and four on my manifest parser while both suites passed.

And don’t even get me started on TEA.