Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(azure): Add Azure Linux support #409

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tofay
Copy link

@tofay tofay commented Jun 6, 2024

Another part of aquasecurity/trivy#6673, along with aquasecurity/vuln-list-update#294.

Azure Linux is a rebranding of CBL-Mariner, starting at version 3.0, so this updates the existing Mariner parsing code to be used by both azure linux/cbl-mariner vulnsrcs.

Azure Linux is a rebranding of CBL-Mariner, starting at version 3.0, so this reuses the existing Mariner
parsing function.
@tofay tofay requested a review from knqyf263 as a code owner June 6, 2024 14:36
@@ -36,21 +27,31 @@ type resolvedTest struct {
}

type VulnSrc struct {
dbc db.Operation
Dbc db.Operation
VulnListDir string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VulnListDir is usually vuln-list dir.
Let's use more obvious name

Suggested change
VulnListDir string
MarinerDir string

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

azure is a renamed mariner.
So I think we can use one package for them:

➜  trivy-db git:(azure-linux) ✗ ls -hl ./pkg/vulnsrc/azure 
total 36K
-rw-rw-r-- 1 dmitriy dmitriy  690 июл  2 13:12 azure.go
-rw-rw-r-- 1 dmitriy dmitriy 2,4K июл  2 13:12 azure_test.go
-rw-rw-r-- 1 dmitriy dmitriy 6,9K июл  2 13:39 mariner.go
-rw-rw-r-- 1 dmitriy dmitriy 6,1K июн 20 10:12 mariner_test.go
drwxrwxr-x 2 dmitriy dmitriy 4,0K июл  2 13:57 oval
drwxrwxr-x 4 dmitriy dmitriy 4,0K июл  2 13:12 testdata
-rw-rw-r-- 1 dmitriy dmitriy  206 окт 25  2022 types.go

I suggest the following refactoring:

  1. move logic from mariner.go to azure.go
  2. create only NewMarinerVulnSrc() function in mariner.go

ErrNotSupported = xerrors.New("format not supported")
)

func NewVulnSrc() mariner.VulnSrc {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add this function to this map

{
name: "happy path",
dir: filepath.Join("testdata", "happy"),
wantValues: []vulnsrctest.WantValues{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about vulnerability-detail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants