Skip to content

Commit

Permalink
ci: mark CVE-2024-3154 as a false scan positive (#7215)
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chadwell <[email protected]>
  • Loading branch information
jedevc committed Apr 29, 2024
1 parent f1ef8a6 commit 1108c9e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .trivyignore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vulnerabilities:
# https://github.com/advisories/GHSA-c5pj-mqfh-rvc3
# This issue is not fixed in a version of runc we can feasibly upgrade to. We
# simply do not use CRI-O for starting runc, so this is a false positive.
- id: CVE-2024-3154
46 changes: 32 additions & 14 deletions ci/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,37 @@ func (e *Engine) Scan(ctx context.Context) (string, error) {
return "", err
}

return dag.Container().
From("aquasec/trivy:0.50.1").
ignoreFiles := dag.Directory().WithDirectory("/", e.Dagger.Source, DirectoryWithDirectoryOpts{
Include: []string{
".trivyignore",
".trivyignore.yml",
".trivyignore.yaml",
},
})
ignoreFileNames, err := ignoreFiles.Entries(ctx)
if err != nil {
return "", err
}

ctr := dag.Container().
From("aquasec/trivy:0.50.4").
WithMountedFile("/mnt/engine.tar", target.AsTarball()).
WithMountedCache("/root/.cache/", dag.CacheVolume("trivy-cache")).
WithExec([]string{
"image",
"--format=json",
"--no-progress",
"--exit-code=1",
"--vuln-type=os,library",
"--severity=CRITICAL,HIGH",
"--input",
"/mnt/engine.tar",
}).
Stdout(ctx)
WithMountedDirectory("/mnt/ignores", ignoreFiles).
WithMountedCache("/root/.cache/", dag.CacheVolume("trivy-cache"))

args := []string{
"image",
"--format=json",
"--no-progress",
"--exit-code=1",
"--vuln-type=os,library",
"--severity=CRITICAL,HIGH",
"--show-suppressed",
}
if len(ignoreFileNames) > 0 {
args = append(args, "--ignorefile=/mnt/ignores/"+ignoreFileNames[0])
}
args = append(args, "--input", "/mnt/engine.tar")

return ctr.WithExec(args).Stdout(ctx)
}

0 comments on commit 1108c9e

Please sign in to comment.