This commit is contained in:
Eric Sim 2018-12-11 16:11:04 -08:00
parent 8fb9097dbd
commit 803cf4a29e
4 changed files with 39 additions and 39 deletions

View File

@ -35,14 +35,14 @@ import (
) )
const ( const (
amazonLinux1Name = "Amazon Linux 2018.03" amazonLinux1Name = "Amazon Linux 2018.03"
amazonLinux1Namespace = "amzn:2018.03" amazonLinux1Namespace = "amzn:2018.03"
amazonLinux1UpdaterFlag = "amazonLinux1Updater" amazonLinux1UpdaterFlag = "amazonLinux1Updater"
amazonLinux1MirrorListURI = "http://repo.us-west-2.amazonaws.com/2018.03/updates/x86_64/mirror.list" amazonLinux1MirrorListURI = "http://repo.us-west-2.amazonaws.com/2018.03/updates/x86_64/mirror.list"
amazonLinux2Name = "Amazon Linux 2" amazonLinux2Name = "Amazon Linux 2"
amazonLinux2Namespace = "amzn:2" amazonLinux2Namespace = "amzn:2"
amazonLinux2UpdaterFlag = "amazonLinux2Updater" amazonLinux2UpdaterFlag = "amazonLinux2Updater"
amazonLinux2MirrorListURI = "https://cdn.amazonlinux.com/2/core/latest/x86_64/mirror.list" amazonLinux2MirrorListURI = "https://cdn.amazonlinux.com/2/core/latest/x86_64/mirror.list"
) )
type updater struct { type updater struct {
@ -54,7 +54,7 @@ type updater struct {
func init() { func init() {
// Register updater for Amazon Linux 2018.03. // Register updater for Amazon Linux 2018.03.
amazonLinux1Updater := updater { amazonLinux1Updater := updater{
Name: amazonLinux1Name, Name: amazonLinux1Name,
Namespace: amazonLinux1Namespace, Namespace: amazonLinux1Namespace,
UpdaterFlag: amazonLinux1UpdaterFlag, UpdaterFlag: amazonLinux1UpdaterFlag,
@ -63,7 +63,7 @@ func init() {
vulnsrc.RegisterUpdater("amzn", &amazonLinux1Updater) vulnsrc.RegisterUpdater("amzn", &amazonLinux1Updater)
// Register updater for Amazon Linux 2. // Register updater for Amazon Linux 2.
amazonLinux2Updater := updater { amazonLinux2Updater := updater{
Name: amazonLinux2Name, Name: amazonLinux2Name,
Namespace: amazonLinux2Namespace, Namespace: amazonLinux2Namespace,
UpdaterFlag: amazonLinux2UpdaterFlag, UpdaterFlag: amazonLinux2UpdaterFlag,
@ -82,7 +82,7 @@ func (u *updater) Update(datastore database.Datastore) (response vulnsrc.UpdateR
} }
if !found { if !found {
flagValue = ""; flagValue = ""
} }
var timestamp string var timestamp string

View File

@ -64,20 +64,20 @@ func TestAmazonLinux1(t *testing.T) {
Name: "amzn:2018.03", Name: "amzn:2018.03",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "httpd-devel", FeatureName: "httpd-devel",
AffectedVersion: "2.2.21-1.18.amzn1", AffectedVersion: "2.2.21-1.18.amzn1",
FixedInVersion: "2.2.21-1.18.amzn1", FixedInVersion: "2.2.21-1.18.amzn1",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
{ {
Namespace: database.Namespace{ Namespace: database.Namespace{
Name: "amzn:2018.03", Name: "amzn:2018.03",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "httpd-debuginfo", FeatureName: "httpd-debuginfo",
AffectedVersion: "2.2.21-1.18.amzn1", AffectedVersion: "2.2.21-1.18.amzn1",
FixedInVersion: "2.2.21-1.18.amzn1", FixedInVersion: "2.2.21-1.18.amzn1",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
} }
@ -97,20 +97,20 @@ func TestAmazonLinux1(t *testing.T) {
Name: "amzn:2018.03", Name: "amzn:2018.03",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "cyrus-imapd-debuginfo", FeatureName: "cyrus-imapd-debuginfo",
AffectedVersion: "2.3.16-6.4.amzn1", AffectedVersion: "2.3.16-6.4.amzn1",
FixedInVersion: "2.3.16-6.4.amzn1", FixedInVersion: "2.3.16-6.4.amzn1",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
{ {
Namespace: database.Namespace{ Namespace: database.Namespace{
Name: "amzn:2018.03", Name: "amzn:2018.03",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "cyrus-imapd-utils", FeatureName: "cyrus-imapd-utils",
AffectedVersion: "2.3.16-6.4.amzn1", AffectedVersion: "2.3.16-6.4.amzn1",
FixedInVersion: "2.3.16-6.4.amzn1", FixedInVersion: "2.3.16-6.4.amzn1",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
} }
@ -120,7 +120,7 @@ func TestAmazonLinux1(t *testing.T) {
} }
func TestAmazonLinux2(t *testing.T) { func TestAmazonLinux2(t *testing.T) {
amazonLinux2Updater := updater { amazonLinux2Updater := updater{
Name: "Amazon Linux 2", Name: "Amazon Linux 2",
Namespace: "amzn:2", Namespace: "amzn:2",
UpdaterFlag: "amazonLinux2Updater", UpdaterFlag: "amazonLinux2Updater",
@ -157,20 +157,20 @@ func TestAmazonLinux2(t *testing.T) {
Name: "amzn:2", Name: "amzn:2",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "kernel", FeatureName: "kernel",
AffectedVersion: "4.9.76-38.79.amzn2", AffectedVersion: "4.9.76-38.79.amzn2",
FixedInVersion: "4.9.76-38.79.amzn2", FixedInVersion: "4.9.76-38.79.amzn2",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
{ {
Namespace: database.Namespace{ Namespace: database.Namespace{
Name: "amzn:2", Name: "amzn:2",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "kernel-headers", FeatureName: "kernel-headers",
AffectedVersion: "4.9.76-38.79.amzn2", AffectedVersion: "4.9.76-38.79.amzn2",
FixedInVersion: "4.9.76-38.79.amzn2", FixedInVersion: "4.9.76-38.79.amzn2",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
} }
@ -190,20 +190,20 @@ func TestAmazonLinux2(t *testing.T) {
Name: "amzn:2", Name: "amzn:2",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "qemu-kvm", FeatureName: "qemu-kvm",
AffectedVersion: "10:1.5.3-141.amzn2.5.3", AffectedVersion: "10:1.5.3-141.amzn2.5.3",
FixedInVersion: "10:1.5.3-141.amzn2.5.3", FixedInVersion: "10:1.5.3-141.amzn2.5.3",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
{ {
Namespace: database.Namespace{ Namespace: database.Namespace{
Name: "amzn:2", Name: "amzn:2",
VersionFormat: rpm.ParserName, VersionFormat: rpm.ParserName,
}, },
FeatureName: "qemu-img", FeatureName: "qemu-img",
AffectedVersion: "10:1.5.3-141.amzn2.5.3", AffectedVersion: "10:1.5.3-141.amzn2.5.3",
FixedInVersion: "10:1.5.3-141.amzn2.5.3", FixedInVersion: "10:1.5.3-141.amzn2.5.3",
AffectedType: database.AffectBinaryPackage, AffectedType: database.AffectBinaryPackage,
}, },
} }