Skip to content

Commit f6b81ba

Browse files
authored
ensure azure linux has 0 minor version (anchore#2498)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
1 parent 98d47a9 commit f6b81ba

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

grype/db/v6/vulnerability.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ func MimicV5Namespace(vuln *VulnerabilityHandle, affected *AffectedPackageHandle
156156
family = "amazonlinux"
157157
case "mariner":
158158
major := strings.Split(ver, ".")[0]
159+
if strings.Count(ver, ".") < 1 {
160+
ver = fmt.Sprintf("%s.0", major)
161+
}
159162
switch major {
160163
case "1", "2":
161164
family = "mariner"
162-
if strings.Count(ver, ".") < 1 {
163-
ver = fmt.Sprintf("%s.0", major)
164-
}
165165
default:
166166
family = "azurelinux"
167167
}

grype/db/v6/vulnerability_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ func TestV5Namespace(t *testing.T) {
359359
osVersion: "3.0",
360360
expected: "mariner:distro:azurelinux:3.0",
361361
},
362+
{
363+
name: "mariner azure version",
364+
provider: "mariner",
365+
osName: "mariner",
366+
osVersion: "3",
367+
expected: "mariner:distro:azurelinux:3.0",
368+
},
362369
{
363370
name: "oracle linux distribution",
364371
provider: "oracle",

0 commit comments

Comments
 (0)