extractor/os/rpm: trim AlmaLinux ecosystem suffix to major version#2250
Conversation
…ilities
Two root causes were found that prevented ALSA advisories from being detected
when scanning AlmaLinux container images:
1. RPM extractor was missing from the "artifact" preset (presets.go):
The image scan uses the "artifact" extractor preset which included apk
(Alpine), dpkg (Debian/Ubuntu), chisel, and homebrew — but NOT the rpm
extractor. This caused all RPM packages (curl-minimal, openssl, bash, etc.)
from AlmaLinux images to be completely ignored.
2. AlmaLinux ecosystem suffix was using full VERSION_ID instead of major only:
/etc/os-release in almalinux:9.0 sets VERSION_ID="9.0", producing ecosystem
"AlmaLinux:9.0". OSV.dev keys ALSA advisories by major version only
("AlmaLinux:9"), so zero advisories were matched. This is fixed upstream in
google/osv-scalibr#2250; this PR includes a go.mod replace directive to
pick up that fix while the upstream PR is reviewed.
With both fixes applied, scanning almalinux:9.0 now correctly produces:
AlmaLinux:9 | 68 packages | 282 known vulnerabilities from 2 ecosystems
curl-minimal 7.76.1-14.el9_0.5 → 12 vulnerabilities including ALSA advisories
Fixes google#2870 (responds to @michaelkedar review)
Depends on google/osv-scalibr#2250 (ecosystem suffix trim)
…ilities
Two root causes were found that prevented ALSA advisories from being detected
when scanning AlmaLinux container images:
1. RPM extractor was missing from the "artifact" preset (presets.go):
The image scan uses the "artifact" extractor preset which included apk
(Alpine), dpkg (Debian/Ubuntu), chisel, and homebrew — but NOT the rpm
extractor. This caused all RPM packages (curl-minimal, openssl, bash, etc.)
from AlmaLinux images to be completely ignored.
2. AlmaLinux ecosystem suffix was using full VERSION_ID instead of major only:
/etc/os-release in almalinux:9.0 sets VERSION_ID="9.0", producing ecosystem
"AlmaLinux:9.0". OSV.dev keys ALSA advisories by major version only
("AlmaLinux:9"), so zero advisories were matched. This is fixed upstream in
google/osv-scalibr#2250; this PR includes a go.mod replace directive to
pick up that fix while the upstream PR is reviewed.
With both fixes applied, scanning almalinux:9.0 now correctly produces:
AlmaLinux:9 | 68 packages | 282 known vulnerabilities from 2 ecosystems
curl-minimal 7.76.1-14.el9_0.5 → 12 vulnerabilities including ALSA advisories
Fixes google#2870 (responds to @michaelkedar review)
Depends on google/osv-scalibr#2250 (ecosystem suffix trim)
|
Hi @michaelkedar, this is a small follow-up to the merged #2148. The original mapping passed VERSION_ID through unmodified, so real images produce It's also currently blocking the E2E test in osv-scanner#2870 (pulled in via a temporary go.mod replace), so getting this merged lets me drop the replace directive there. Would appreciate a review when you have a moment. Thanks! |
|
Hi @michaelkedar, gentle ping on this follow-up to the merged #2148. This 3-line fix is what enables the E2E test in osv-scanner#2870 to surface actual ALSA vulnerabilities (AlmaLinux:9 vs AlmaLinux:9.0). Would appreciate a review when you have a moment. Thanks! |
|
Hi @michaelkedar, rebased against current main. This 3-line fix is a prerequisite for the E2E tests in osv-scanner#2870 without it, AlmaLinux:9.0 matches zero advisories. Would appreciate a review when you get a chance! |
Ly-Joey
left a comment
There was a problem hiding this comment.
Hi @herdiyana256, apologies for our delayed response. The change looks good to me!
OSV.dev keys ALSA advisories by major version only (e.g. "AlmaLinux:9"). VERSION_ID in /etc/os-release is a full point release (e.g. "9.0" or "9.8"), so the ecosystem produced was "AlmaLinux:9.0" which matches zero advisories. Empirical check on AlmaLinux 9.0 docker image (curl-minimal-7.76.1-14.el9_0.5): AlmaLinux:9 -> matches ALSA-2022:8299 (curl vulnerable) AlmaLinux:9.0 -> 0 matches Trim VERSION_ID to the part before the first "." so that: "9.0" -> "9" "9.8" -> "9" "8.9" -> "8" A bare major version such as "9" is returned unchanged by strings.Cut. Fixes google#2091
4aa61fb to
b9fa0d7
Compare
google/osv-scalibr#2250 (trim AlmaLinux VERSION_ID to major version) has been merged into osv-scalibr main. Remove the temporary replace directive that pointed to the fork and upgrade the module to the upstream pseudo-version that includes the fix.
…ilities
Two root causes were found that prevented ALSA advisories from being detected
when scanning AlmaLinux container images:
1. RPM extractor was missing from the "artifact" preset (presets.go):
The image scan uses the "artifact" extractor preset which included apk
(Alpine), dpkg (Debian/Ubuntu), chisel, and homebrew — but NOT the rpm
extractor. This caused all RPM packages (curl-minimal, openssl, bash, etc.)
from AlmaLinux images to be completely ignored.
2. AlmaLinux ecosystem suffix was using full VERSION_ID instead of major only:
/etc/os-release in almalinux:9.0 sets VERSION_ID="9.0", producing ecosystem
"AlmaLinux:9.0". OSV.dev keys ALSA advisories by major version only
("AlmaLinux:9"), so zero advisories were matched. This is fixed upstream in
google/osv-scalibr#2250; this PR includes a go.mod replace directive to
pick up that fix while the upstream PR is reviewed.
With both fixes applied, scanning almalinux:9.0 now correctly produces:
AlmaLinux:9 | 68 packages | 282 known vulnerabilities from 2 ecosystems
curl-minimal 7.76.1-14.el9_0.5 → 12 vulnerabilities including ALSA advisories
Fixes google#2870 (responds to @michaelkedar review)
Depends on google/osv-scalibr#2250 (ecosystem suffix trim)
google/osv-scalibr#2250 (trim AlmaLinux VERSION_ID to major version) has been merged into osv-scalibr main. Remove the temporary replace directive that pointed to the fork and upgrade the module to the upstream pseudo-version that includes the fix.
…ilities
Two root causes were found that prevented ALSA advisories from being detected
when scanning AlmaLinux container images:
1. RPM extractor was missing from the "artifact" preset (presets.go):
The image scan uses the "artifact" extractor preset which included apk
(Alpine), dpkg (Debian/Ubuntu), chisel, and homebrew — but NOT the rpm
extractor. This caused all RPM packages (curl-minimal, openssl, bash, etc.)
from AlmaLinux images to be completely ignored.
2. AlmaLinux ecosystem suffix was using full VERSION_ID instead of major only:
/etc/os-release in almalinux:9.0 sets VERSION_ID="9.0", producing ecosystem
"AlmaLinux:9.0". OSV.dev keys ALSA advisories by major version only
("AlmaLinux:9"), so zero advisories were matched. This is fixed upstream in
google/osv-scalibr#2250; this PR includes a go.mod replace directive to
pick up that fix while the upstream PR is reviewed.
With both fixes applied, scanning almalinux:9.0 now correctly produces:
AlmaLinux:9 | 68 packages | 282 known vulnerabilities from 2 ecosystems
curl-minimal 7.76.1-14.el9_0.5 → 12 vulnerabilities including ALSA advisories
Fixes google#2870 (responds to @michaelkedar review)
Depends on google/osv-scalibr#2250 (ecosystem suffix trim)
…nux snapshot - Rebase onto upstream/main (includes snapshot refresh google#2920, google#2921) - Drop go.mod replace directive: google/osv-scalibr#2250 (AlmaLinux VERSION_ID trim) is now merged upstream - Bump osv-scalibr to v0.4.6-0.20260713000915-500ad84f4ed1 (official upstream) - Regenerate TestCommand_OCIImage_JSONFormat/scanning_almalinux_9_image snapshot and cassette with updated scalibr
PR #2148 mapped
ID=almalinuxtoEcosystemAlmaLinuxusing the fullos-releaseVERSION_IDas the suffix. On a real host or container,VERSION_IDis a point release (e.g."9.0","9.8"), producing the ecosystem"AlmaLinux:9.0".OSV.dev keys AlmaLinux (ALSA) advisories by major version only (
"AlmaLinux:9"), so the point-release suffix matches zero advisories.Empirical check
Using
almalinux:9.0docker image (curl-minimal-7.76.1-14.el9_0.5):AlmaLinux:9AlmaLinux:9.0Fix
Trim
VERSION_IDto the part before the first"."so:"9.0"→"9""9.8"→"9""8.9"→"8"A bare major such as
"9"is returned unchanged bystrings.Cut.Testing
9.0,9.8,8.9) inecosystem_test.goFixes #2091
Related to: google/osv-scanner#2870