-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Provide platform family for vulnmgmt (#1145)
* 🐛 Provide platform family for vulnmgmt This is needed to determine the applicable app vulns. Also fix which version shows up in the 'FIXED' column of the scan output. Signed-off-by: Christian Zunker <[email protected]> * Fix license Signed-off-by: Christian Zunker <[email protected]> --------- Signed-off-by: Christian Zunker <[email protected]>
- Loading branch information
Showing
4 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package advisories | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"go.mondoo.com/cnquery/v10/providers-sdk/v1/upstream/mvd" | ||
) | ||
|
||
func TestFindVulnerablePackageWithoutNamespace(t *testing.T) { | ||
advisory := &mvd.Advisory{ | ||
Fixed: []*mvd.Package{ | ||
{Name: "pkg1", Version: "1.0.0"}, | ||
{Name: "pkg2", Version: "2.0.0"}, | ||
{Name: "pkg2", Version: "3.0.0"}, | ||
{Name: "pkg3", Version: "3.0.0"}, | ||
}, | ||
} | ||
|
||
installedPkg := &mvd.Package{Name: "pkg2", Version: "2.0.0"} | ||
|
||
match := findVulnerablePackageWithoutNamespace(advisory, installedPkg) | ||
|
||
require.NotNil(t, match) | ||
require.Equal(t, "pkg2", match.Name) | ||
require.Equal(t, "3.0.0", match.Version) | ||
} |