fix(binary): detect grafana security-patch release versions (#5213)

---------
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
This commit is contained in:
Pujitha Paladugu
2026-08-27 04:20:09 +00:00
committed by GitHub
co-authored by Pujitha Paladugu
parent bf82010f3c
commit d3734ddeb2
6 changed files with 62 additions and 0 deletions
@@ -2294,6 +2294,39 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("grafana-binary"),
},
},
{
logicalFixture: "grafana/12.4.3-security-02/linux-arm",
expected: pkg.Package{
Name: "grafana",
Version: "12.4.3",
Type: "binary",
PURL: "pkg:generic/grafana@12.4.3",
Locations: locations("grafana"),
Metadata: metadata("grafana-binary"),
},
},
{
logicalFixture: "grafana/12.0.0-security-01/linux-amd64",
expected: pkg.Package{
Name: "grafana",
Version: "12.0.0",
Type: "binary",
PURL: "pkg:generic/grafana@12.0.0",
Locations: locations("grafana"),
Metadata: metadata("grafana-binary"),
},
},
{
logicalFixture: "grafana/11.0.5-security-01/linux-amd64",
expected: pkg.Package{
Name: "grafana",
Version: "11.0.5",
Type: "binary",
PURL: "pkg:generic/grafana@11.0.5",
Locations: locations("grafana"),
Metadata: metadata("grafana-binary"),
},
},
{
logicalFixture: "grafana/12.3.1/linux-amd64",
expected: pkg.Package{
+5
View File
@@ -1054,6 +1054,11 @@ func DefaultClassifiers() []binutils.Classifier {
EvidenceMatcher: binutils.MatchAny(
// [NUL][NUL][NUL][NUL]12.2.0-258092[NUL][NUL][NUL][NUL]
m.FileContentsVersionMatcher(`\x00+(?P<version>[0-9]{2}\.[0-9]+\.[0-9]+\-[0-9]{6,})\x00+`),
// security patch releases embed the raw version constant with no "release-" prefix
// and are not always preceded by NUL bytes (e.g. on arm builds):
// [NUL]11.0.5+security-01[NUL][NUL]call frame too large
// [NUL]12.4.3+security-02[NUL][NUL]
m.FileContentsVersionMatcher(`\x00(?P<version>[0-9]{1,2}\.[0-9]+\.[0-9]+)\+security-[0-9]+\x00`),
// [NUL][NUL][NUL][NUL]release-12.3.2+security-01[NUL][NUL][NUL][NUL]
// [NUL][NUL][NUL][NUL]release-12.3.1[NUL][NUL][NUL][NUL]
m.FileContentsVersionMatcher(`\x00+release-(?P<version>[0-9]{2}\.[0-9]+\.[0-9]+(-beta[0-9]|-test|-preview)?)(\+security-[0-9]+)?\x00+`),
+24
View File
@@ -1323,6 +1323,30 @@ from-images:
paths:
- /usr/share/grafana/bin/grafana
- name: grafana
version: 12.4.3-security-02
images:
- ref: grafana/grafana:12.4.3-security-02@sha256:fe5bc62ae401120c48b4cd50db122a632bfca8d48a7115a32cc7c9b80c19dc48
platform: linux/arm
paths:
- /usr/share/grafana/bin/grafana
- name: grafana
version: 12.0.0-security-01
images:
- ref: grafana/grafana:12.0.0-security-01@sha256:6fc2fee54f8551a3ae452a2dd14fd524143026e46a0f06b0302c79117fe89fcf
platform: linux/amd64
paths:
- /usr/share/grafana/bin/grafana
- name: grafana
version: 11.0.5-security-01
images:
- ref: grafana/grafana:11.0.5-security-01@sha256:0ba037897c6f22f26b7d289eb1f651ed4d9d552ea454ace60307ecd0585cbee1
platform: linux/amd64
paths:
- /usr/share/grafana/bin/grafana
- name: grafana
version: 12.0.0
images: