From 300fe980ef44134d23b21afd643fa9336210c0f2 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Tue, 28 Feb 2017 12:55:54 -0500 Subject: [PATCH] ext/vulnsrc/ubuntu: add missing version format --- ext/vulnsrc/ubuntu/ubuntu.go | 7 +++++-- ext/vulnsrc/ubuntu/ubuntu_test.go | 22 ++++++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ext/vulnsrc/ubuntu/ubuntu.go b/ext/vulnsrc/ubuntu/ubuntu.go index 70602e6c..6ef3633a 100644 --- a/ext/vulnsrc/ubuntu/ubuntu.go +++ b/ext/vulnsrc/ubuntu/ubuntu.go @@ -377,8 +377,11 @@ func parseUbuntuCVE(fileContent io.Reader) (vulnerability database.Vulnerability // Create and add the new package. featureVersion := database.FeatureVersion{ Feature: database.Feature{ - Namespace: database.Namespace{Name: "ubuntu:" + database.UbuntuReleasesMapping[md["release"]]}, - Name: md["package"], + Namespace: database.Namespace{ + Name: "ubuntu:" + database.UbuntuReleasesMapping[md["release"]], + VersionFormat: dpkg.ParserName, + }, + Name: md["package"], }, Version: version, } diff --git a/ext/vulnsrc/ubuntu/ubuntu_test.go b/ext/vulnsrc/ubuntu/ubuntu_test.go index 3b9fd2ae..5cdbd9a4 100644 --- a/ext/vulnsrc/ubuntu/ubuntu_test.go +++ b/ext/vulnsrc/ubuntu/ubuntu_test.go @@ -24,6 +24,7 @@ import ( "github.com/coreos/clair/database" "github.com/coreos/clair/ext/versionfmt" + "github.com/coreos/clair/ext/versionfmt/dpkg" ) func TestUbuntuParser(t *testing.T) { @@ -46,22 +47,31 @@ func TestUbuntuParser(t *testing.T) { expectedFeatureVersions := []database.FeatureVersion{ { Feature: database.Feature{ - Namespace: database.Namespace{Name: "ubuntu:14.04"}, - Name: "libmspack", + Namespace: database.Namespace{ + Name: "ubuntu:14.04", + VersionFormat: dpkg.ParserName, + }, + Name: "libmspack", }, Version: versionfmt.MaxVersion, }, { Feature: database.Feature{ - Namespace: database.Namespace{Name: "ubuntu:15.04"}, - Name: "libmspack", + Namespace: database.Namespace{ + Name: "ubuntu:15.04", + VersionFormat: dpkg.ParserName, + }, + Name: "libmspack", }, Version: "0.4-3", }, { Feature: database.Feature{ - Namespace: database.Namespace{Name: "ubuntu:15.10"}, - Name: "libmspack-anotherpkg", + Namespace: database.Namespace{ + Name: "ubuntu:15.10", + VersionFormat: dpkg.ParserName, + }, + Name: "libmspack-anotherpkg", }, Version: "0.1", },