From 82c1abfd3acad16e904f457105e3f77646f5a860 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Wed, 9 Jun 2021 05:46:42 +0900 Subject: [PATCH] fix(report): detection logic bugs for Oracle Linux (#1247) * fix(report): continue detecting if arch is emtpy for Oracle Linux * fix test case * fix(report): a bug of `Not Fixed Yet` of Oracle linux scanning --- oval/util.go | 6 ++++-- oval/util_test.go | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/oval/util.go b/oval/util.go index b6897fb458..78318b7ca8 100644 --- a/oval/util.go +++ b/oval/util.go @@ -306,7 +306,8 @@ func isOvalDefAffected(def ovalmodels.Definition, req request, family string, ru switch family { case constant.Oracle, constant.Amazon: if ovalPack.Arch == "" { - return false, false, "", xerrors.Errorf("OVAL DB for %s is old. Please re-fetch the OVAL", family) + logging.Log.Infof("Arch is needed to detect Vulns for Amazon and Oracle Linux, but empty. You need refresh OVAL maybe. oval: %s, defID: %s", ovalPack, def.DefinitionID) + continue } } @@ -370,7 +371,8 @@ func isOvalDefAffected(def ovalmodels.Definition, req request, family string, ru constant.SUSEEnterpriseServer, constant.Debian, constant.Ubuntu, - constant.Raspbian: + constant.Raspbian, + constant.Oracle: // Use fixed state in OVAL for these distros. return true, false, ovalPack.Version, nil } diff --git a/oval/util_test.go b/oval/util_test.go index 03a0b23e80..97f5f325c3 100644 --- a/oval/util_test.go +++ b/oval/util_test.go @@ -1263,7 +1263,7 @@ func TestIsOvalDefAffected(t *testing.T) { affected: true, fixedIn: "2.17-106.0.1", }, - // error when arch is empty for Oracle, Amazon linux + // arch is empty for Oracle, Amazon linux { in: in{ family: constant.Oracle, @@ -1282,9 +1282,10 @@ func TestIsOvalDefAffected(t *testing.T) { arch: "x86_64", }, }, - wantErr: true, + wantErr: false, + fixedIn: "", }, - // error when arch is empty for Oracle, Amazon linux + // arch is empty for Oracle, Amazon linux { in: in{ family: constant.Amazon, @@ -1303,7 +1304,8 @@ func TestIsOvalDefAffected(t *testing.T) { arch: "x86_64", }, }, - wantErr: true, + wantErr: false, + fixedIn: "", }, }