* feat: update-trivy * add v2 parser * implement v2 * refactor * feat: add show version to future-vuls * add test case for v2 * trivy v0.20.0 * support --list-all-pkgs * fix lint err * add test case for jar * add a test case for gemspec in container * remove v1 parser and change Library struct * Changed the field name in the model struct LibraryScanner * add comment * fix comment * fix comment * chore * add struct tag
27 lines
627 B
Go
27 lines
627 B
Go
package scanner
|
|
|
|
import (
|
|
"github.com/aquasecurity/fanal/types"
|
|
"github.com/future-architect/vuls/models"
|
|
)
|
|
|
|
func convertLibWithScanner(apps []types.Application) ([]models.LibraryScanner, error) {
|
|
scanners := []models.LibraryScanner{}
|
|
for _, app := range apps {
|
|
libs := []models.Library{}
|
|
for _, lib := range app.Libraries {
|
|
libs = append(libs, models.Library{
|
|
Name: lib.Name,
|
|
Version: lib.Version,
|
|
FilePath: lib.FilePath,
|
|
})
|
|
}
|
|
scanners = append(scanners, models.LibraryScanner{
|
|
Type: app.Type,
|
|
LockfilePath: app.FilePath,
|
|
Libs: libs,
|
|
})
|
|
}
|
|
return scanners, nil
|
|
}
|