diff --git a/go.mod b/go.mod index ad46e4bb336f..d9941176a402 100644 --- a/go.mod +++ b/go.mod @@ -391,4 +391,4 @@ replace oras.land/oras-go => oras.land/oras-go v1.1.1 // spdx logic write on v0.3.0 and incompatible with v0.3.1-0.20230104082527-d6f58551be3f replace github.com/spdx/tools-golang => github.com/spdx/tools-golang v0.3.0 -replace github.com/aquasecurity/go-dep-parser => /Users/wagdezabit/go/src/github.com/wagde-orca/go-dep-parser +replace github.com/aquasecurity/go-dep-parser => github.com/wagde-orca/go-dep-parser v0.0.0-20230611165515-52b03ea40fe7 diff --git a/go.sum b/go.sum index 6a05581411cb..da75726cb9b5 100644 --- a/go.sum +++ b/go.sum @@ -1517,6 +1517,8 @@ github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1 github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/wagde-orca/go-dep-parser v0.0.0-20230611165515-52b03ea40fe7 h1:kY/IetnGMByprG5tRsJYQ1LJwa0HHjbDzFGwpbc9KJU= +github.com/wagde-orca/go-dep-parser v0.0.0-20230611165515-52b03ea40fe7/go.mod h1:E5p/rvZrFOz2Py3WtBopQjC1d7AqU54D2FqjjEFHEkk= github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= diff --git a/pkg/fanal/handler/sysfile/filter.go b/pkg/fanal/handler/sysfile/filter.go index 344511bfdce9..a91a77271b13 100644 --- a/pkg/fanal/handler/sysfile/filter.go +++ b/pkg/fanal/handler/sysfile/filter.go @@ -59,9 +59,10 @@ func (h systemFileFilteringPostHandler) Handle(_ context.Context, result *analyz for _, file := range append(result.SystemInstalledFiles, defaultSystemFiles...) { // Trim leading slashes to be the same format as the path in container images. systemFile := strings.TrimPrefix(file, "/") + // We should check the root filepath ("/") and ignore it. // Otherwise libraries with an empty filePath will be removed. - if systemFile != "" { + if systemFile != "" && !strings.HasSuffix(systemFile, "."+types.Jar) { systemFiles = append(systemFiles, systemFile) } }