Skip to content

Commit

Permalink
fix(report): detection logic bugs for Oracle Linux (future-architect#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
kotakanbe authored Jun 8, 2021
1 parent 4098840 commit 82c1abf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions oval/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
Expand Down
10 changes: 6 additions & 4 deletions oval/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -1303,7 +1304,8 @@ func TestIsOvalDefAffected(t *testing.T) {
arch: "x86_64",
},
},
wantErr: true,
wantErr: false,
fixedIn: "",
},
}

Expand Down

0 comments on commit 82c1abf

Please sign in to comment.