-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(db): check schema version for image name only (#6410)
Signed-off-by: knqyf263 <[email protected]> Co-authored-by: knqyf263 <[email protected]>
- Loading branch information
1 parent
e75a90f
commit 8baccd7
Showing
8 changed files
with
127 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package analyzer_test | |
import ( | ||
"context" | ||
"fmt" | ||
"github.com/google/go-containerregistry/pkg/name" | ||
"os" | ||
"sync" | ||
"testing" | ||
|
@@ -12,11 +13,11 @@ import ( | |
"golang.org/x/sync/semaphore" | ||
"golang.org/x/xerrors" | ||
|
||
xio "github.com/aquasecurity/trivy/pkg/x/io" | ||
"github.com/aquasecurity/trivy/pkg/fanal/analyzer" | ||
"github.com/aquasecurity/trivy/pkg/fanal/types" | ||
"github.com/aquasecurity/trivy/pkg/javadb" | ||
"github.com/aquasecurity/trivy/pkg/mapfs" | ||
xio "github.com/aquasecurity/trivy/pkg/x/io" | ||
|
||
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/imgconf/apk" | ||
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/language/java/jar" | ||
|
@@ -335,15 +336,18 @@ func TestAnalyzerGroup_AnalyzeFile(t *testing.T) { | |
FilePath: "/lib/apk/db/installed", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "musl", | ||
Version: "1.1.24-r2", | ||
SrcName: "musl", | ||
SrcVersion: "1.1.24-r2", | ||
Licenses: []string{"MIT"}, | ||
Arch: "x86_64", | ||
Digest: "sha1:cb2316a189ebee5282c4a9bd98794cc2477a74c6", | ||
InstalledFiles: []string{"lib/libc.musl-x86_64.so.1", "lib/ld-musl-x86_64.so.1"}, | ||
ID: "[email protected]", | ||
Name: "musl", | ||
Version: "1.1.24-r2", | ||
SrcName: "musl", | ||
SrcVersion: "1.1.24-r2", | ||
Licenses: []string{"MIT"}, | ||
Arch: "x86_64", | ||
Digest: "sha1:cb2316a189ebee5282c4a9bd98794cc2477a74c6", | ||
InstalledFiles: []string{ | ||
"lib/libc.musl-x86_64.so.1", | ||
"lib/ld-musl-x86_64.so.1", | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
@@ -615,7 +619,9 @@ func TestAnalyzerGroup_PostAnalyze(t *testing.T) { | |
|
||
if tt.analyzerType == analyzer.TypeJar { | ||
// init java-trivy-db with skip update | ||
javadb.Init("./language/java/jar/testdata", "ghcr.io/aquasecurity/trivy-java-db", true, false, types.RegistryOptions{Insecure: false}) | ||
repo, err := name.NewTag(javadb.DefaultRepository) | ||
require.NoError(t, err) | ||
javadb.Init("./language/java/jar/testdata", repo, true, false, types.RegistryOptions{Insecure: false}) | ||
} | ||
|
||
ctx := context.Background() | ||
|
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
Oops, something went wrong.