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

chore(deps): bump github.com/aquasecurity/trivy from 0.57.0 to 0.57.1 #2067

Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strconv"
"strings"

"github.com/aquasecurity/trivy/pkg/db"
"github.com/aquasecurity/trivy/pkg/javadb"
"github.com/asaskevich/govalidator"
"golang.org/x/xerrors"

Expand Down Expand Up @@ -87,6 +89,13 @@ type ReportOpts struct {
TrivyOpts
}

var (
// DefaultTrivyDBRepositories is the official repositories of Trivy DB
DefaultTrivyDBRepositories = []string{db.DefaultGCRRepository, db.DefaultGHCRRepository}
// DefaultTrivyJavaDBRepositories is the official repositories of Trivy Java DB
DefaultTrivyJavaDBRepositories = []string{javadb.DefaultGCRRepository, javadb.DefaultGHCRRepository}
)

// TrivyOpts is options for trivy DBs
type TrivyOpts struct {
TrivyCacheDBDir string `json:"trivyCacheDBDir,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions detector/javadb/javadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func UpdateJavaDB(trivyOpts config.TrivyOpts, noProgress bool) error {
}

// Download DB
if len(trivyOpts.TrivyJavaDBRepositories) == 0 {
trivyOpts.TrivyJavaDBRepositories = config.DefaultTrivyJavaDBRepositories
}
logging.Log.Infof("Trivy Java DB Repository: %s", strings.Join(trivyOpts.TrivyJavaDBRepositories, ", "))
logging.Log.Info("Downloading Trivy Java DB...")

Expand Down
3 changes: 3 additions & 0 deletions detector/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func DetectLibsCves(r *models.ScanResult, trivyOpts config.TrivyOpts, logOpts lo
}

func downloadDB(appVersion string, trivyOpts config.TrivyOpts, noProgress, skipUpdate bool) error {
if len(trivyOpts.TrivyDBRepositories) == 0 {
trivyOpts.TrivyDBRepositories = config.DefaultTrivyDBRepositories
}
refs := make([]name.Reference, 0, len(trivyOpts.TrivyDBRepositories))
for _, repo := range trivyOpts.TrivyDBRepositories {
ref, err := func() (name.Reference, error) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/BurntSushi/toml v1.4.0
github.com/CycloneDX/cyclonedx-go v0.9.1
github.com/Ullaakut/nmap/v2 v2.2.2
github.com/aquasecurity/trivy v0.57.0
github.com/aquasecurity/trivy v0.57.1
github.com/aquasecurity/trivy-db v0.0.0-20241028064941-053a5fa0d3b6
github.com/aquasecurity/trivy-java-db v0.0.0-20240109071736-184bd7481d48
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ github.com/aquasecurity/go-version v0.0.0-20240603093900-cf8a8d29271d h1:4zour5S
github.com/aquasecurity/go-version v0.0.0-20240603093900-cf8a8d29271d/go.mod h1:1cPOp4BaQZ1G2F5fnw4dFz6pkOyXJI9KTuak8ghIl3U=
github.com/aquasecurity/testdocker v0.0.0-20240730042311-4642e94c7fc8 h1:b43UVqYjz7qDqK+cVOtF2Lk6CxjytYItP6Pgf3wGsNE=
github.com/aquasecurity/testdocker v0.0.0-20240730042311-4642e94c7fc8/go.mod h1:wXA9k3uuaxY3yu7gxrxZDPo/04FEMJtwyecdAlYrEIo=
github.com/aquasecurity/trivy v0.57.0 h1:W3L+VVvAQjYsJsyiBsThs5xec66g2LpbVkWQJNcaZE0=
github.com/aquasecurity/trivy v0.57.0/go.mod h1:MPExNeIDQASo9nHkVjN4pSsx7Vxoka96FnjryoSnhk0=
github.com/aquasecurity/trivy v0.57.1 h1:loKFDGLDqZdlq1GPVjZypnEaPhbHz+q07hZEOTo2wEM=
github.com/aquasecurity/trivy v0.57.1/go.mod h1:MPExNeIDQASo9nHkVjN4pSsx7Vxoka96FnjryoSnhk0=
github.com/aquasecurity/trivy-checks v1.2.2 h1:EVHi0gthYzDLfqdAqBBwVGfg2l/gdZ622pIlC9rP+lU=
github.com/aquasecurity/trivy-checks v1.2.2/go.mod h1:TNV0QNVFyBIkt865eO2PtfpubmHt3Ve19Klny//SWIU=
github.com/aquasecurity/trivy-db v0.0.0-20241028064941-053a5fa0d3b6 h1:+FiQKYabU5fjaSyekuhbC0AE4JHJNojLBRyjziyQf1w=
Expand Down
11 changes: 4 additions & 7 deletions subcmds/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ package subcmds
import (
"context"
"flag"
"fmt"
"os"
"path/filepath"

"github.com/aquasecurity/trivy/pkg/cache"
trivydb "github.com/aquasecurity/trivy/pkg/db"
trivyjavadb "github.com/aquasecurity/trivy/pkg/javadb"
"github.com/google/subcommands"
"github.com/k0kubun/pp"
"golang.org/x/xerrors"
Expand Down Expand Up @@ -183,13 +180,13 @@ func (p *ReportCmd) SetFlags(f *flag.FlagSet) {
f.StringVar(&config.Conf.TrivyCacheDBDir, "trivy-cachedb-dir",
cache.DefaultDir(), "/path/to/dir")

config.Conf.TrivyOpts.TrivyDBRepositories = []string{trivydb.DefaultGHCRRepository}
config.Conf.TrivyOpts.TrivyDBRepositories = config.DefaultTrivyDBRepositories
dbRepos := stringArrayFlag{target: &config.Conf.TrivyOpts.TrivyDBRepositories}
f.Var(&dbRepos, "trivy-db-repository", fmt.Sprintf("Trivy DB Repository in a comma-separated list (default %s)", trivydb.DefaultGHCRRepository))
f.Var(&dbRepos, "trivy-db-repository", "Trivy DB Repository in a comma-separated list")

config.Conf.TrivyOpts.TrivyJavaDBRepositories = []string{trivyjavadb.DefaultGHCRRepository}
config.Conf.TrivyOpts.TrivyJavaDBRepositories = config.DefaultTrivyJavaDBRepositories
javaDBRepos := stringArrayFlag{target: &config.Conf.TrivyOpts.TrivyJavaDBRepositories}
f.Var(&javaDBRepos, "trivy-java-db-repository", fmt.Sprintf("Trivy Java DB Repository in a comma-separated list (default %s)", trivyjavadb.DefaultGHCRRepository))
f.Var(&javaDBRepos, "trivy-java-db-repository", "Trivy Java DB Repository in a comma-separated list")

f.BoolVar(&config.Conf.TrivySkipJavaDBUpdate, "trivy-skip-java-db-update", false, "Skip Trivy Java DB Update")
}
Expand Down
11 changes: 4 additions & 7 deletions subcmds/report_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ package subcmds
import (
"context"
"flag"
"fmt"
"os"
"path/filepath"

"github.com/aquasecurity/trivy/pkg/cache"
trivydb "github.com/aquasecurity/trivy/pkg/db"
trivyjavadb "github.com/aquasecurity/trivy/pkg/javadb"
"github.com/google/subcommands"
"github.com/k0kubun/pp"

Expand Down Expand Up @@ -180,13 +177,13 @@ func (p *ReportCmd) SetFlags(f *flag.FlagSet) {
f.StringVar(&config.Conf.TrivyCacheDBDir, "trivy-cachedb-dir",
cache.DefaultDir(), "/path/to/dir")

config.Conf.TrivyOpts.TrivyDBRepositories = []string{trivydb.DefaultGHCRRepository}
config.Conf.TrivyOpts.TrivyDBRepositories = config.DefaultTrivyDBRepositories
dbRepos := stringArrayFlag{target: &config.Conf.TrivyOpts.TrivyDBRepositories}
f.Var(&dbRepos, "trivy-db-repository", fmt.Sprintf("Trivy DB Repository in a comma-separated list (default %s)", trivydb.DefaultGHCRRepository))
f.Var(&dbRepos, "trivy-db-repository", "Trivy DB Repository in a comma-separated list")

config.Conf.TrivyOpts.TrivyJavaDBRepositories = []string{trivyjavadb.DefaultGHCRRepository}
config.Conf.TrivyOpts.TrivyJavaDBRepositories = config.DefaultTrivyJavaDBRepositories
javaDBRepos := stringArrayFlag{target: &config.Conf.TrivyOpts.TrivyJavaDBRepositories}
f.Var(&javaDBRepos, "trivy-java-db-repository", fmt.Sprintf("Trivy Java DB Repository in a comma-separated list (default %s)", trivyjavadb.DefaultGHCRRepository))
f.Var(&javaDBRepos, "trivy-java-db-repository", "Trivy Java DB Repository in a comma-separated list")

f.BoolVar(&config.Conf.TrivySkipJavaDBUpdate, "trivy-skip-java-db-update", false, "Skip Trivy Java DB Update")
}
Expand Down
11 changes: 4 additions & 7 deletions subcmds/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ package subcmds
import (
"context"
"flag"
"fmt"
"os"
"path/filepath"

"github.com/aquasecurity/trivy/pkg/cache"
trivydb "github.com/aquasecurity/trivy/pkg/db"
trivyjavadb "github.com/aquasecurity/trivy/pkg/javadb"
"github.com/google/subcommands"

"github.com/future-architect/vuls/config"
Expand Down Expand Up @@ -112,13 +109,13 @@ func (p *TuiCmd) SetFlags(f *flag.FlagSet) {
f.StringVar(&config.Conf.TrivyCacheDBDir, "trivy-cachedb-dir",
cache.DefaultDir(), "/path/to/dir")

config.Conf.TrivyOpts.TrivyDBRepositories = []string{trivydb.DefaultGHCRRepository}
config.Conf.TrivyOpts.TrivyDBRepositories = config.DefaultTrivyDBRepositories
dbRepos := stringArrayFlag{target: &config.Conf.TrivyOpts.TrivyDBRepositories}
f.Var(&dbRepos, "trivy-db-repository", fmt.Sprintf("Trivy DB Repository in a comma-separated list (default %s)", trivydb.DefaultGHCRRepository))
f.Var(&dbRepos, "trivy-db-repository", "Trivy DB Repository in a comma-separated list")

config.Conf.TrivyOpts.TrivyJavaDBRepositories = []string{trivyjavadb.DefaultGHCRRepository}
config.Conf.TrivyOpts.TrivyJavaDBRepositories = config.DefaultTrivyJavaDBRepositories
javaDBRepos := stringArrayFlag{target: &config.Conf.TrivyOpts.TrivyJavaDBRepositories}
f.Var(&javaDBRepos, "trivy-java-db-repository", fmt.Sprintf("Trivy Java DB Repository in a comma-separated list (default %s)", trivyjavadb.DefaultGHCRRepository))
f.Var(&javaDBRepos, "trivy-java-db-repository", "Trivy Java DB Repository in a comma-separated list")

f.BoolVar(&config.Conf.TrivySkipJavaDBUpdate, "trivy-skip-java-db-update", false, "Skip Trivy Java DB Update")
}
Expand Down
Loading