Skip to content

feat: recognize TuxCare ELS advisories#2916

Open
Korulag wants to merge 5 commits into
google:mainfrom
Korulag:tuxcare-advisory-recognition
Open

feat: recognize TuxCare ELS advisories#2916
Korulag wants to merge 5 commits into
google:mainfrom
Korulag:tuxcare-advisory-recognition

Conversation

@Korulag

@Korulag Korulag commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds recognition of TuxCare Extended Lifecycle Support (ELS) advisories. TuxCare rebuilds distro packages with backported fixes and publishes its own advisory stream (CLSA-*), which osv.dev serves under dedicated ecosystems (TuxCare:<Distro>:<Version>). This PR routes TuxCare-rebuilt packages to those ecosystems so their advisories — and fixed versions — are reported.

Covers deb (Ubuntu / Debian) and RPM (AlmaLinux / CentOS / RHEL / Oracle Linux / CentOS Stream), including CentOS-8.4/8.5 channel detection.

Depends on #<PR 1> (RHEL-family RPM epoch handling). TuxCare's RPM ecosystems are RHEL-family and their feed encodes epochs, so correct matching requires that fix.

How it works

TuxCare-rebuilt packages carry a version marker (e.g. …+tuxcare.els3, ….tuxcare.els2). The change is built around a small supplementary-ecosystem seam rather than anything TuxCare-specific in the core:

  • Query routing (internal/clients/clientimpl/osvmatcher): a marker-driven registry routes a matched package's query to the vendor ecosystem (e.g. TuxCare:AlmaLinux:9.6) instead of the base one, before the base-ecosystem gate (so CentOS/Oracle RPMs, which scalibr leaves without a base ecosystem, are still matched). This mirrors the existing single-query model; a package resolves to exactly one ecosystem.
  • Vendor module (internal/tuxcare): all vendor knowledge — marker, os-release → ecosystem mapping, per-distro version granularity — lives here. Shared code touches only exported entrypoints.
  • CentOS-8 channel detection (internal/scalibrextract/os/tuxcare-els-repo): CentOS-8 ELS pins a minor (8.4 vs 8.5) that os-release doesn't expose, so a small extractor reads /etc/yum.repos.d/centos8.{4,5}-els.repo and a host-context step stamps the channel onto CentOS-8 RPMs, then strips the synthetic marker before matching/reporting.
  • Fixed-version reconciliation (internal/output, internal/utility/vulns): an advisory's affected entry is keyed to the overlay ecosystem while the scanned package keeps its base ecosystem, so fixed-version lookup previously found nothing and showed "No fix available". Reconciliation now normalizes the overlay prefix to the base — the same shape as the existing Ubuntu :Pro/:LTS variant handling — in both the table and the JSON/SARIF paths. (As a side effect this also fixes Ubuntu Pro fixed-version resolution in JSON/SARIF, which had the same base-vs-variant mismatch.)

Usage

RPM extraction is the experimental os/rpm opt-in; the repo-file extractor rides the artifact preset on image scans:

# container image
osv-scanner scan image <image> --experimental-plugins=os/rpm

# live / mounted host
osv-scanner scan source <root> --recursive \
  --experimental-plugins=os/rpm,os/tuxcare-els-repo \
  --experimental-no-default-plugins

Testing

  • Unit + e2e coverage for routing (deb + RPM, per-distro granularity), CentOS-8 channel detection/enrichment, marker stripping, and fixed-version reconciliation.
  • Verified against a live AlmaLinux 9.6 TuxCare host in three states: unpatched (full detection with correct fixed versions matching dnf), fully patched (clean), and the superseded-kernel case (an old kernel left on disk is correctly reported until removed).

Scope / notes

  • Detection is by version marker; a package resolves to a single ecosystem (base or TuxCare), not both.
  • Out of scope for now: Alpine (apk) and language ecosystems — the routing seam is ready for them, pending the corresponding TuxCare feeds.
  • The supplementary-ecosystem mechanism is intentionally generic; happy to adjust its shape/placement based on how you'd prefer vendor advisory streams to be modeled.

Depends on: #2915

@Korulag

Korulag commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@another-rex @jess-lowe could you please take a look or ping someone who can?

Introduce internal/tuxcare holding all TuxCare-specific knowledge: the
version marker that identifies a TuxCare-rebuilt package, the mapping from
os-release to the TuxCare advisory ecosystem (deb + RPM, per-distro version
granularity), CentOS-8 ELS channel detection from the repo file, and
host-context enrichment. Shared code references only the exported entrypoints.

Signed-off-by: Vasily Kleschov <vkleschov@cloudlinux.com>
Add a supplementary-ecosystem registry that detects a vendor version marker
and routes the osv.dev query to the vendor's ecosystem (e.g.
TuxCare:AlmaLinux:9.6) instead of the base one. Routing runs before the
base-ecosystem gate so CentOS/Oracle RPMs (which scalibr leaves without a
base ecosystem) are still matched. TuxCare ecosystems are RHEL-family with
epoch-encoding feeds, so their routed queries are epoch-qualified.

Signed-off-by: Vasily Kleschov <vkleschov@cloudlinux.com>
Add the os/tuxcare-els-repo extractor, which reads the host's
/etc/yum.repos.d/centos8.{4,5}-els.repo file to recover the CentOS-8 ELS
channel (8.4 vs 8.5) — the only reliable signal, since os-release reports
only major 8 and the package el-token is ambiguous. It emits a synthetic
channel marker consumed by host-context enrichment. Registered in the
artifact preset and resolvable by name.

Signed-off-by: Vasily Kleschov <vkleschov@cloudlinux.com>
Run host-context enrichment after extraction and before matching in both
scan paths: it stamps the detected CentOS-8 channel onto CentOS-8 RPM
packages so they route to the correct TuxCare ecosystem, then strips the
synthetic channel-marker package so it never reaches the matcher or report.

Signed-off-by: Vasily Kleschov <vkleschov@cloudlinux.com>
A TuxCare advisory's affected entry is keyed to the overlay ecosystem
(TuxCare:AlmaLinux:9.6) while the scanned package keeps its base ecosystem
(AlmaLinux:9.6), so fix-version reconciliation skipped every fix and
reported "No fix available" even when an upgrade existed. Normalize the
overlay prefix to the base when reconciling, mirroring how Ubuntu Pro/LTS
variant suffixes are handled, and apply it in both the table and the
JSON/SARIF fixed-version paths (which also fixes Ubuntu Pro there).

Signed-off-by: Vasily Kleschov <vkleschov@cloudlinux.com>
@Korulag
Korulag force-pushed the tuxcare-advisory-recognition branch from ee06a97 to a0e5bec Compare July 14, 2026 08:38
@Korulag

Korulag commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@another-rex, could you please take a look at this one?

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