Skip to content

Match Alpine, Debian, and Ubuntu packages by release and source package - #49

Merged
codeyevsky merged 5 commits into
solongate:mainfrom
GamehunterKaan:fix/distro-osv-identity
Oct 27, 2026
Merged

codeyevsky merged 5 commits into
solongate:mainfrom
GamehunterKaan:fix/distro-osv-identity

Conversation

@GamehunterKaan

Copy link
Copy Markdown
Member

Summary

Distribution packages were sent to OSV with a bare ecosystem and the installed binary name. OSV evaluates distro ranges per release and keys advisories by source package, so scans missed most findings and reported others from the wrong release.

 pkg:deb/debian/libc6@2.36-9+deb12u14?distro=debian-12.15&upstream=glibc
-  Debian    / libc6 / 2.36-9+deb12u14
+  Debian:12 / glibc / 2.36-9+deb12u14

 pkg:apk/alpine/libcrypto3@3.0.8-r0?distro=alpine-3.17.2&upstream=openssl
-  Alpine       / libcrypto3 / 3.0.8-r0
+  Alpine:v3.17 / openssl    / 3.0.8-r0
  • Release from distro: Alpine:v3.17, Debian:12, Ubuntu:22.04:LTS, Ubuntu:24.10
  • Source name and version from upstream (e.g. util-linux@2.38.1-5+deb12u3 for bsdutils@1:2.38.1-…). The stored purl keeps the installed package.
  • No usable distro: skipped with a reason instead of silently matching nothing

Findings behind this:

  • A bare Alpine or Ubuntu query only matches explicitly listed versions. Alpine records have none, so every Alpine package returned 0.
  • A bare Debian query merges all releases. Example: glibc 2.36-9+deb12u14 matches CVE-2023-4527 through the Debian 13 range, although Debian 12 fixed it in deb12u3.
  • 62 of 88 Debian 12 packages and 73 of 101 Ubuntu 22.04 packages have a binary name that differs from the source name.

Evidence

Real Syft v1.54.1 SBOMs of official images. "Expected" means OSV queried with the release and source package.

Image Expected Before After
alpine:3.17.2 35 0 35
debian:12 96 43 (67 missed, 14 from other releases) 96
ubuntu:22.04 62 9 62
  • Before: new sbom tests fail (e.g. osvIdentity(libssl3?distro=ubuntu-22.04&upstream=openssl) = "Ubuntu", "libssl3")
    After: the full CI Verify job passes in a Linux container (gofmt, govulncheck, vet, go test -race ./..., release builds)
  • Non-distro packages are unchanged: components, skip reasons, and findings are identical before and after for node, python, ruby, maven, and almalinux images and this repo's Go modules.

Merge Danger

Door: two-way

No schema or migration change; a revert restores the old mapping.

Blast Radius: SBOM import

  • SBOMs without a distro qualifier now skip Alpine, Debian, and Ubuntu packages that used to import.
  • Existing databases keep previously imported bare-ecosystem components; re-importing adds the corrected ones alongside them.

OSV only evaluates Alpine version ranges within a release branch such as
Alpine:v3.17, so querying the bare "Alpine" ecosystem returned no
vulnerabilities for every Alpine package and scans reported affected
releases as clean. Alpine advisories are also keyed by source package, so
binary subpackages like libcrypto3 never matched OpenSSL advisories.

Derive the branch from the purl distro qualifier and the name from the
upstream qualifier. Alpine components without a usable distro qualifier
are now skipped with an explicit reason instead of silently matching
nothing. A real alpine:3.17.2 SBOM goes from 0 to 35 findings.

The bundled example SBOM gains distro qualifiers so the quickstart still
imports all three components.

Signed-off-by: GamehunterKaan <kaan@kaangultekin.net>
Debian and Ubuntu components were queried under their installed binary
names, such as libc6 or libssl3, while OSV keys distribution advisories by
source package (glibc, openssl). The bare "Debian" ecosystem also merges
every release, so patched Debian 12 packages matched ranges from Debian 13
and later.

Generalize the Alpine handling: derive the release-specific ecosystem
(Debian:12, Ubuntu:22.04:LTS, Ubuntu:24.10) from the distro qualifier and
the source name and version from the upstream qualifier, keeping the
installed package URL. Distribution components without a usable release
are skipped with an explicit reason.

On real images, a debian:12 SBOM goes from 43 findings (67 missed, 14
from other releases) to the expected 96, and an ubuntu:22.04 SBOM from 9
to the expected 62.

Signed-off-by: GamehunterKaan <kaan@kaangultekin.net>
Describe how the importer selects the release and source package for
distribution packages, that those without a release are skipped, and the
remaining matching limitations in the threat model.

Signed-off-by: GamehunterKaan <kaan@kaangultekin.net>
@GamehunterKaan

GamehunterKaan commented Oct 24, 2026 •

Copy link
Copy Markdown
Member Author

The Verify failure is unrelated to this change: govulncheck now reports GO-2026-6809 in the Go 1.27.2 standard library (crypto/x509, fixed in 1.27.3). go.mod pins 1.27.2 and this PR doesn't touch it, so any CI run on main will hit the same failure until the Go version is bumped to 1.27.3. All other Verify steps pass with this branch.

Confirmed on unchanged main (6815e31): the same Verify job fails with the identical govulncheck report in this run.

@codeyevsky
codeyevsky merged commit bff9f9e into solongate:main Oct 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants