Feature: Add ffmpeg binary cataloger (#3994)

* Add ffmpeg binary cataloger

Signed-off-by: Alan Pope <alan.pope@anchore.com>

* add linux-amd64 snippet and test

Signed-off-by: Alan Pope <alan.pope@anchore.com>

* Widen scope of regex to two digit version numbers

Signed-off-by: Alan Pope <alan.pope@anchore.com>

* Add full test fixtures for ffmpeg

Signed-off-by: Alan Pope <alan.pope@anchore.com>

---------

Signed-off-by: Alan Pope <alan.pope@anchore.com>
This commit is contained in:
Alan Pope 2025-08-25 12:50:04 +01:00 committed by GitHub
parent ca21ccf21d
commit ada74a8121
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 54 additions and 0 deletions

View File

@ -1370,6 +1370,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("chrome-binary"), Metadata: metadata("chrome-binary"),
}, },
}, },
{
logicalFixture: "ffmpeg/7.1.1/darwin-arm64",
expected: pkg.Package{
Name: "ffmpeg",
Version: "7.1.1",
Type: "binary",
PURL: "pkg:generic/ffmpeg@7.1.1",
Locations: locations("ffmpeg"),
Metadata: metadata("ffmpeg-binary"),
},
},
{
logicalFixture: "ffmpeg/6.1.1/linux-amd64",
expected: pkg.Package{
Name: "ffmpeg",
Version: "6.1.1",
Type: "binary",
PURL: "pkg:generic/ffmpeg@6.1.1",
Locations: locations("ffmpeg"),
Metadata: metadata("ffmpeg-binary"),
},
},
} }
for _, test := range tests { for _, test := range tests {

View File

@ -627,6 +627,18 @@ func DefaultClassifiers() []binutils.Classifier {
PURL: mustPURL("pkg:generic/chrome@version"), PURL: mustPURL("pkg:generic/chrome@version"),
CPEs: singleCPE("cpe:2.3:a:google:chrome:*:*:*:*:*:*:*:*"), CPEs: singleCPE("cpe:2.3:a:google:chrome:*:*:*:*:*:*:*:*"),
}, },
{
Class: "ffmpeg-binary",
FileGlob: "**/ffmpeg",
EvidenceMatcher: m.FileContentsVersionMatcher(
// Pattern found in the binary: "%s version 7.1.1" or "%s version 6.0"
// When executed outputs: "ffmpeg version 7.1.1" or "ffmpeg version 6.0"
`(?m)%s version (?P<version>[0-9]+\.[0-9]+(\.[0-9]+)?)`,
),
Package: "ffmpeg",
PURL: mustPURL("pkg:generic/ffmpeg@version"),
CPEs: singleCPE("cpe:2.3:a:ffmpeg:ffmpeg:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
} }
return append(classifiers, defaultJavaClassifiers()...) return append(classifiers, defaultJavaClassifiers()...)

View File

@ -810,3 +810,23 @@ from-images:
platform: linux/amd64 platform: linux/amd64
paths: paths:
- /usr/local/bin/jq - /usr/local/bin/jq
- name: ffmpeg
version: 8.0
images:
- ref: linuxserver/ffmpeg:version-8.0-cli@sha256:9d7e80710e7f11a276a4185f07e5e81db26fc7027ea70d1591f93ddf58e36ab4
platform: linux/amd64
- ref: linuxserver/ffmpeg:arm64v8-version-8.0-cli@sha256:0b6cf2e15a78094396f23a7cb3afaf7dffcad195573a2b97f190eae1ee1a0420
platform: linux/arm64
paths:
- /usr/local/bin/ffmpeg
- name: ffmpeg
version: 7.1.1
images:
- ref: linuxserver/ffmpeg:7.1.1@sha256:aea59a11c54291ac456bb2d67000445e5a8994f70bc3d96cdc29f022fbbf89fb
platform: linux/amd64
- ref: linuxserver/ffmpeg:arm64v8-7.1.1@sha256:b2aa507f205ea2dc32369c55d0f93b5649f1b39e42d9e6cd27bd53def7a63655
platform: linux/arm64
paths:
- /usr/local/bin/ffmpeg