anchore / anchore/syft

Use Debian distribution codename as distro qualifier in PURL

Open
#3,902 8 comments 0 reactions 0 assignees View on GitHub
enhancement good-first-issue
Dominant language
Go
Stars
9.6k
Forks
954
Avg merge
1d 5h
Merged PRs (30d)
42

Description

**What would you like to be added**:

As of filing this issue, the PURL generated for Debian packages uses a combination of the distribution vendor and distribution version number as value for the `distro` qualifier. Example:

`pkg:deb/debian/curl@7.50.3-1?arch=amd64&distro=debian-11`

The PURL specification[0] stipulates that qualifiers (such as `distro`) is optional and _type-specific_:

> **qualifiers**: extra qualifying data for a package such as an OS, architecture, a distro, etc. Optional and type-specific.

However, looking at examples[1] provided for the `deb` type they use the distribution codename rather than version number:

```
pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie
pkg:deb/debian/dpkg@1.19.0.4?arch=amd64&distro=stretch
pkg:deb/ubuntu/dpkg@1.19.0.4?arch=amd64
pkg:deb/debian/attr@1:2.4.47-2?arch=source
pkg:deb/debian/attr@1:2.4.47-2%2Bb1?arch=amd64
```

I would like to request that the `distro` qualifier in PURLs generated for `deb` components align with the examples given in the official specification (using the distribution codename), for the reason given below.

Alternatively, provide an option to select whether to use distribution version or codename in the `distro` qualifier when generating PURLs for components found by the `dpkg` cataloger.

Or make it possible to use a template for the PURL qualifiers where one could customize which values to use, in order to ensure that they are compatible with whatever software you might ingest them into? Something like:

```
pkg:deb/debian/curl@7.50.3-1?arch=%arch%&distro=%distro_codename% # pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie
pkg:deb/debian/curl@7.50.3-1?arch=%arch%&distro=%distro_version% # pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=debian-8
```

**Why is this needed**:

It seems that other tools within the SBOM ecosystem expects the `distro` qualifier to use the distribution codename as the value, as given in the examples from the official PURL specification. One example is Snyk, which provides an API for retreiving vulnerability data based on a PURL identifier that fail unless the distribution codename is used for the `distro` qualifier.

**Additional context**:

Details on the Snyk API mentioned above is available here[2].

[0] https://github.com/package-url/purl-spec/blob/main/PURL-SPECIFICATION.rst
[1] https://github.com/package-url/purl-spec/blob/main/PURL-TYPES.rst#deb
[2] https://docs.snyk.io/snyk-api/using-specific-snyk-apis/issues-list-issues-for-a-package

Contributor guide

Open the contributing guide

Research direction

Start with the dpkg cataloger and the PURL generation path for Debian components. Compare the current version-derived distro qualifier with the codename-based deb examples and the Snyk API requirement. Done means the generated PURL uses the agreed distro value, with coverage for the Debian package case and any selected configuration behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.