microsoft / microsoft/component-detection

Distro release is included in LinuxComponent.Id but not Purl

Open
#1,714 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
553
Forks
135
Avg merge
20h 58m
Merged PRs (30d)
6

Description

When computing LinuxComponent Id, the distro release is included:

protected override string ComputeBaseId() => $"{this.Distribution} {this.Release} {this.Name} {this.Version} - {this.Type}";

But it is not included in the Purl:

return new PackageURL(packageType, this.Distribution, this.Name, this.Version, null, null);

This means that the component Id identifies packages more precisely than the Purl. However, since the component Id is not persisted to the SBOM (the Purl is), it can't be used directly for deduplication, or roundtrip or downstream resolution of packages. The Purl could be used, but doesn't match the precision of the component ID, so could over-match.

One possibility - and I think this is what Syft does - would be to attach a distro qualifier to the Purl:
pkg:deb/ubuntu/curl@7.68.0?distro=ubuntu-20.04

Perhaps another approach would be to simply flow through the Syft-composed Purl.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LinuxComponent.ComputeBaseId and the Purl construction shown in the issue, then trace how the Purl is persisted in the SBOM and used for deduplication or roundtripping. Done means the chosen representation preserves the distro-release precision of the component ID and its behavior is covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.