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(detector/library): update JAR-like files' Name/Version in library list #1874

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions detector/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func DetectLibsCves(r *models.ScanResult, trivyOpts config.TrivyOpts, logOpts lo

var javaDBClient *javadb.DBClient
defer javaDBClient.Close()
for _, lib := range r.LibraryScanners {
for i, lib := range r.LibraryScanners {
d := libraryDetector{scanner: lib}
if lib.Type == ftypes.Jar {
if javaDBClient == nil {
Expand All @@ -76,6 +76,7 @@ func DetectLibsCves(r *models.ScanResult, trivyOpts config.TrivyOpts, logOpts lo
if err != nil {
return xerrors.Errorf("Failed to scan library. err: %w", err)
}
r.LibraryScanners[i] = d.scanner
for _, vinfo := range vinfos {
vinfo.Confidences.AppendIfMissing(models.TrivyMatch)
if v, ok := r.ScannedCves[vinfo.CveID]; !ok {
Expand Down Expand Up @@ -129,7 +130,7 @@ func showDBInfo(cacheDir string) error {
}

// Scan : scan target library
func (d libraryDetector) scan() ([]models.VulnInfo, error) {
func (d *libraryDetector) scan() ([]models.VulnInfo, error) {
if d.scanner.Type == ftypes.Jar {
if err := d.improveJARInfo(); err != nil {
return nil, xerrors.Errorf("Failed to improve JAR information by trivy Java DB. err: %w", err)
Expand Down
Loading