Skip to content

Conversation

@maennchen
Copy link
Contributor

@maennchen maennchen commented May 19, 2025

Motivation

BEAM projects regularly depend on OTP applications that are themselves missing from any package manager:

  • The Erlang/OTP runtime shipped by a Linux distro is often outdated. Teams pin a newer runtime built with kerl or asdf, or bundle it in their release artefact.
  • Core language tooling (e.g. Elixir, Rebar3, Hex) is an OTP application too, yet it is rarely delivered by system package managers.
  • Because these components do not come from Hex, their SBOM entry cannot be a hex purl; nor can it be a distro purl such as deb, rpm, alpm.

Today we have to fall back to a generic or VCS purl, which loses precision versioned app vs. tag/commit, selective patching, etc.).
The otp purl type fills this gap.

Decision flow

When a tool can emit only one purl per package (e.g. GitHub Dependency Graph), follow this flowchart:

flowchart TD
    PM{"From Package Manager?
    rebar3 / mix"}
    OSPM{"From OS Package Manager?"}
    SCM{"Source (SCM)?"}
    GH["pkg:github/{owner}/{repo}"]
    BB["pkg:bitbucket/{owner}/{repo}"]
    Specific["pkg:{type}..."]
    PossiblyOtp{"OTP App?"}
    OTP["pkg:otp/{name}@{version}?vcs_url=git+https://{git}"]
    Generic["pkg:generic/...?vcs_url=git+https://{git}"]
    Hex["pkg:hex/{name}@{version}"]
    Git["Git"]
    OS["pkg:{alpm|deb|rpm}/..."]

    PM -- Yes --> SCM
    PM -- No --> OSPM
    OSPM -- No --> Git
    OSPM -- Yes --> OS
    SCM -- Hex.SCM --> Hex
    SCM -- Mix.SCM.Git --> Git
    Git -- GitHub --> GH
    Git -- Bitbucket --> BB
    Git -- Other Specific --> Specific
    Git -- None --> PossiblyOtp
    SCM -- Mix.SCM.Path --> PossiblyOtp
    PossiblyOtp -- No --> Generic
    PossiblyOtp -- Yes --> OTP
Loading

When multiple purls can be recorded (e.g. SPDX, CycloneDX) you may attach the otp purl and an additional purl (Git, GitHub, checksum, …) for maximum traceability.

Summary of the new type

Field Rule
type otp
namespace unused – must be empty
name OTP application name (from .app), lower‑cased
version Application version (vsn)
qualifiers platform, arch, plus generic qualifiers (repository_url, …)
subpath May reference a file/dir inside the application

Prefer hex when you can
If the package truly originates from a Hex repo, emit a hex purl instead of
otp. Hex’s global namespace all but eliminates name collisions.

Concrete examples

pkg:otp/[email protected]?platform=linux&arch=amd64&\
repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&\
vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Fotp.git

pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&\
vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Fotp.git

pkg:otp/[email protected]?platform=darwin&arch=x86_64&\
repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&\
vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Fotp.git

pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&\
vcs_url=git%20https:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git

pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Ferlang%2Frebar3&\
vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Frebar3.git

pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Fhexpm%2Fhex&\
vcs_url=git%20https:%2F%2Fgithub.com%2Fhexpm%2Fhex.git

@voltone
Copy link
Contributor

voltone commented Jun 6, 2025

For added context, this purl type proposal has been discussed in the Erlang Ecosystem Foundation for a long time. With the EEF becoming the official CNA for CVEs that affect the Erlang/OTP ecosystem, we will now have more control over how affected versions are expressed in CVE Records. The OTP purl type is an important part of our plans to improve CVE accuracy and the ability for automated tooling to reliably identify affected components in e.g. SBOMs.

@maennchen
Copy link
Contributor Author

The purl type has now also been used in a first CVE disclosure:

https://cna.erlef.org/cves/cve-2025-4748.html

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! See some some nitpickings for your consideration.
Also do you mind to remove the bolding to stay consistent with the style of other types?

@pombredanne
Copy link
Member

After the merge of PR #514, PURL types and tests are now defined in JSON: 😇 😁

With the new approach... this PR needs to be updated. Could you look into this? Thanks for your understanding and sorry for the churn!

@maennchen
Copy link
Contributor Author

@pombredanne Rebased.

FYI, there's a few tiny issues with the new setup:

  • README-dev.rst mentions the generate & docs make targets. They should be gencode and gendocs.
  • The README should probably also mention the format target
  • When running make format, I various files in the etc/scripts dir

@mjherzog mjherzog removed this from the PURL-TBD milestone Sep 18, 2025
@maennchen
Copy link
Contributor Author

@mjherzog / @pombredanne This type is already used extensively in the wild. (in CVE's, OpenVEX, SBoM, GH Dependency Submission etc.)

Is there any chance we can get this merged sometime soon?

@mjherzog mjherzog dismissed pombredanne’s stale review November 10, 2025 18:55

The July 1 requested change is moot with the migration from the RST file to JSON files for adding a PURL type.

@mjherzog
Copy link
Member

@maennchen I reviewed the PR and see one problem which is that URLs in a qualifier must/shall be encoded.
See #644 for the discussion and resolution.
This primarily affects the examples in the type definition and the test cases.

@maennchen maennchen force-pushed the jm/otp_type branch 3 times, most recently from c635a52 to 96f25b0 Compare November 12, 2025 16:25
@maennchen
Copy link
Contributor Author

@mjherzog Updated 👍

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the updates. This is essentially merge ready with only a few nits for your review!

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let's merge this puppy! 🐶

mjherzog

This comment was marked as outdated.

Copy link
Member

@mjherzog mjherzog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maennchen We are still unfortunately in a mostly manual mode for reviewing test cases, but we found additional test case errors from a second review by @johnmhoran.

@pombredanne
Copy link
Member

@mjherzog @johnmhoran good catches 🙇 ... are we all set now?

Copy link
Member

@mjherzog mjherzog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates resolve the review items.

@mjherzog mjherzog merged commit e578e27 into package-url:main Dec 9, 2025
@mjherzog
Copy link
Member

mjherzog commented Dec 9, 2025

@maennchen Thank you for your patience and quick response to the issues raised.
One thing I am still trying to figure out is how/where to add your flow chart to documentation.

@pombredanne
Copy link
Member

🎉

@maennchen maennchen deleted the jm/otp_type branch December 9, 2025 22:34
@maennchen
Copy link
Contributor Author

Thanks for getting this in and being patient with the issues :)

@mjherzog
Copy link
Member

mjherzog commented Dec 9, 2025

@maennchen You are most welcome. We still have a lot of work to do to make it more straightforward to register a PURL type.

BTW - Do you have a suggestion for an OTP icon to add to the packageurl.org website?

@maennchen
Copy link
Contributor Author

I guess you could use the Erlang "E" Logo.

But that would likely require talking to the OTP team for permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants