chore(deps): bump github.com/aquasecurity/trivy from 0.50.1 to 0.51.1 (#1912)

Bumps [github.com/aquasecurity/trivy](https://github.com/aquasecurity/trivy) from 0.50.1 to 0.51.1.
- [Release notes](https://github.com/aquasecurity/trivy/releases)
- [Changelog](https://github.com/aquasecurity/trivy/blob/main/goreleaser.yml)
- [Commits](https://github.com/aquasecurity/trivy/compare/v0.50.1...v0.51.1)

---
updated-dependencies:
- dependency-name: github.com/aquasecurity/trivy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2024-05-15 22:37:12 +09:00
committed by GitHub
parent 0fa09e1517
commit f1c384812a
7 changed files with 229 additions and 225 deletions

View File

@@ -626,7 +626,7 @@ func (l *base) parseSystemctlStatus(stdout string) string {
return ss[1]
}
var trivyLoggerInit = sync.OnceValue(func() error { return tlog.InitLogger(config.Conf.Debug, config.Conf.Quiet) })
var trivyLoggerInit = sync.OnceFunc(func() { tlog.InitLogger(config.Conf.Debug, config.Conf.Quiet) })
func (l *base) scanLibraries() (err error) {
if len(l.LibraryScanners) != 0 {
@@ -640,9 +640,7 @@ func (l *base) scanLibraries() (err error) {
l.log.Info("Scanning Language-specific Packages...")
if err := trivyLoggerInit(); err != nil {
return xerrors.Errorf("Failed to init trivy logger. err: %w", err)
}
trivyLoggerInit()
found := map[string]bool{}
detectFiles := l.ServerInfo.Lockfiles

View File

@@ -15,7 +15,6 @@ import (
"github.com/aquasecurity/trivy/pkg/log"
xio "github.com/aquasecurity/trivy/pkg/x/io"
"github.com/samber/lo"
"go.uber.org/zap"
"golang.org/x/xerrors"
)
@@ -99,7 +98,7 @@ func (p *parser) parse(r xio.ReadSeekerAt) ([]jarLibrary, error) {
// The least element contains file path and SHA1 digest, they can be used at detect phase to
// determine actual name and version.
func (p *parser) parseArtifact(filePath string, size int64, r xio.ReadSeekerAt) ([]jarLibrary, error) {
log.Logger.Debugw("Parsing Java artifacts...", zap.String("file", filePath))
log.Debug("Parsing Java artifacts...", log.String("file", filePath))
sha1, err := digest.CalcSHA1(r)
if err != nil {
@@ -140,7 +139,7 @@ func (p *parser) parseArtifact(filePath string, size int64, r xio.ReadSeekerAt)
case isArtifact(fileInJar.Name):
innerLibs, err := p.parseInnerJar(fileInJar, filePath) //TODO process inner deps
if err != nil {
log.Logger.Debugf("Failed to parse %s. err: %s", fileInJar.Name, err)
log.Debugf("Failed to parse %s. err: %s", fileInJar.Name, err)
continue
}
libs = append(libs, innerLibs...)