From a7b7117fe2c9608e990b42e702cc83675c48f888 Mon Sep 17 00:00:00 2001 From: Aqua Security automated builds <54269356+aqua-bot@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:14:03 +0300 Subject: [PATCH 01/20] fix(plugin): do not call GitHub content API for releases and tags [backport: release/v0.54] (#7279) Signed-off-by: knqyf263 Co-authored-by: Teppei Fukuda --- pkg/downloader/download.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/downloader/download.go b/pkg/downloader/download.go index 63b130a667fd..96fd3ce49008 100644 --- a/pkg/downloader/download.go +++ b/pkg/downloader/download.go @@ -154,7 +154,8 @@ func (t *CustomTransport) RoundTrip(req *http.Request) (*http.Response, error) { func NewGitHubTransport(u *url.URL, insecure bool, token string) http.RoundTripper { client := newGitHubClient(insecure, token) ss := strings.SplitN(u.Path, "/", 4) - if len(ss) < 4 || strings.HasPrefix(ss[3], "archive/") { + if len(ss) < 4 || strings.HasPrefix(ss[3], "archive/") || strings.HasPrefix(ss[3], "releases/") || + strings.HasPrefix(ss[3], "tags/") { // Use the default transport from go-github for authentication return client.Client().Transport } From f61725c28b56d80fb46395479842a2ab0c517c5f Mon Sep 17 00:00:00 2001 From: Aqua Security automated builds <54269356+aqua-bot@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:56:18 +0300 Subject: [PATCH 02/20] fix(java): Return error when trying to find a remote pom to avoid segfault [backport: release/v0.54] (#7283) Co-authored-by: Colm O hEigeartaigh Co-authored-by: DmitriyLewen --- pkg/dependency/parser/java/pom/parse.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/dependency/parser/java/pom/parse.go b/pkg/dependency/parser/java/pom/parse.go index 550c5761c6ee..cbd7bf47db17 100644 --- a/pkg/dependency/parser/java/pom/parse.go +++ b/pkg/dependency/parser/java/pom/parse.go @@ -13,7 +13,7 @@ import ( "sort" "strings" - multierror "github.com/hashicorp/go-multierror" + "github.com/hashicorp/go-multierror" "github.com/samber/lo" "golang.org/x/net/html/charset" "golang.org/x/xerrors" @@ -680,18 +680,15 @@ func (p *Parser) fetchPOMFromRemoteRepositories(paths []string, snapshot bool) ( func (p *Parser) remoteRepoRequest(repo string, paths []string) (*http.Request, error) { repoURL, err := url.Parse(repo) if err != nil { - p.logger.Error("URL parse error", log.String("repo", repo)) - return nil, nil + return nil, xerrors.Errorf("unable to parse URL: %w", err) } paths = append([]string{repoURL.Path}, paths...) repoURL.Path = path.Join(paths...) - logger := p.logger.With(log.String("host", repoURL.Host), log.String("path", repoURL.Path)) req, err := http.NewRequest("GET", repoURL.String(), http.NoBody) if err != nil { - logger.Debug("HTTP request failed") - return nil, nil + return nil, xerrors.Errorf("unable to create HTTP request: %w", err) } if repoURL.User != nil { password, _ := repoURL.User.Password() @@ -709,7 +706,8 @@ func (p *Parser) fetchPomFileNameFromMavenMetadata(repo string, paths []string) req, err := p.remoteRepoRequest(repo, mavenMetadataPaths) if err != nil { - return "", xerrors.Errorf("unable to create request for maven-metadata.xml file") + p.logger.Debug("Unable to create request", log.String("repo", repo), log.Err(err)) + return "", nil } client := &http.Client{} @@ -739,7 +737,8 @@ func (p *Parser) fetchPomFileNameFromMavenMetadata(repo string, paths []string) func (p *Parser) fetchPOMFromRemoteRepository(repo string, paths []string) (*pom, error) { req, err := p.remoteRepoRequest(repo, paths) if err != nil { - return nil, xerrors.Errorf("unable to create request for pom file") + p.logger.Debug("Unable to create request", log.String("repo", repo), log.Err(err)) + return nil, nil } client := &http.Client{} From 334a1c293bb3d490af2a6d80732f399efaac22f7 Mon Sep 17 00:00:00 2001 From: Aqua Security automated builds <54269356+aqua-bot@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:00:38 +0300 Subject: [PATCH 03/20] fix(flag): incorrect behavior for deprected flag `--clear-cache` [backport: release/v0.54] (#7285) Co-authored-by: afdesk --- pkg/flag/cache_flags.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/flag/cache_flags.go b/pkg/flag/cache_flags.go index 074953c2ea44..9cf8403a1e56 100644 --- a/pkg/flag/cache_flags.go +++ b/pkg/flag/cache_flags.go @@ -80,6 +80,7 @@ type CacheOptions struct { // NewCacheFlagGroup returns a default CacheFlagGroup func NewCacheFlagGroup() *CacheFlagGroup { return &CacheFlagGroup{ + ClearCache: ClearCacheFlag.Clone(), CacheBackend: CacheBackendFlag.Clone(), CacheTTL: CacheTTLFlag.Clone(), RedisTLS: RedisTLSFlag.Clone(), From 854c61d34a550a9fcbab3bc59e55b868c15d1962 Mon Sep 17 00:00:00 2001 From: Aqua Security automated builds <54269356+aqua-bot@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:52:50 +0300 Subject: [PATCH 04/20] release: v0.54.1 [release/v0.54] (#7282) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8f1dfd40939e..72245abf2f9d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"0.54.0"} +{".":"0.54.1"} diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a57a25147e..5ffb38bd5cf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.54.1](https://github.com/aquasecurity/trivy/compare/v0.54.0...v0.54.1) (2024-07-31) + + +### Bug Fixes + +* **flag:** incorrect behavior for deprected flag `--clear-cache` [backport: release/v0.54] ([#7285](https://github.com/aquasecurity/trivy/issues/7285)) ([334a1c2](https://github.com/aquasecurity/trivy/commit/334a1c293bb3d490af2a6d80732f399efaac22f7)) +* **java:** Return error when trying to find a remote pom to avoid segfault [backport: release/v0.54] ([#7283](https://github.com/aquasecurity/trivy/issues/7283)) ([f61725c](https://github.com/aquasecurity/trivy/commit/f61725c28b56d80fb46395479842a2ab0c517c5f)) +* **plugin:** do not call GitHub content API for releases and tags [backport: release/v0.54] ([#7279](https://github.com/aquasecurity/trivy/issues/7279)) ([a7b7117](https://github.com/aquasecurity/trivy/commit/a7b7117fe2c9608e990b42e702cc83675c48f888)) + ## [0.54.0](https://github.com/aquasecurity/trivy/compare/v0.53.0...v0.54.0) (2024-07-30) From fcb0414e41769eaadb3e5fc3ec8b832158506017 Mon Sep 17 00:00:00 2001 From: Carson Gee Date: Fri, 14 Apr 2023 14:20:17 -0600 Subject: [PATCH 05/20] Added Secrets to the HTML report --- contrib/html.tpl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contrib/html.tpl b/contrib/html.tpl index e92b1b1cf7f5..0cfe85412ddc 100644 --- a/contrib/html.tpl +++ b/contrib/html.tpl @@ -137,6 +137,28 @@ {{- end }} {{- end }} + {{- if (eq (len .Secrets ) 0) }} + No Secrets found + {{- else }} + + Category + Rule ID + Check + Severity + Match + + {{- range .Secrets }} + + {{ .Category }} + {{ escapeXML .RuleID }} + {{ escapeXML .Title }} + {{ escapeXML .Severity }} + + {{ escapeXML .Match }} + + + {{- end }} + {{- end }} {{- end }} {{- else }} From e850523eddac12718a08fee79a8dd66e72a081fc Mon Sep 17 00:00:00 2001 From: Carson Gee Date: Fri, 14 Apr 2023 16:00:43 -0600 Subject: [PATCH 06/20] Added targets --- contrib/html.tpl | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/contrib/html.tpl b/contrib/html.tpl index 0cfe85412ddc..76c840e02f3c 100644 --- a/contrib/html.tpl +++ b/contrib/html.tpl @@ -25,6 +25,9 @@ table { margin: 0 auto; } + .pkg-path { + overflow-wrap: anywhere + } .severity { text-align: center; font-weight: bold; @@ -52,7 +55,9 @@ } a.toggle-more-links { cursor: pointer; } - {{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }} + + Trivy Report - {{ now }} + -

{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }}

+

Trivy Report - {{ now }}

{{- range . }} - + + + {{- if (eq (len .Vulnerabilities) 0) }} - + {{- else }} @@ -95,6 +102,7 @@ + {{- range .Vulnerabilities }} @@ -104,16 +112,17 @@ + {{- end }} {{- end }} {{- if (eq (len .Misconfigurations ) 0) }} - + {{- else }} From 58ce809358d3e85fb8e6e9fee10c6d26548e07ad Mon Sep 17 00:00:00 2001 From: Carson Gee Date: Fri, 14 Apr 2023 16:39:41 -0600 Subject: [PATCH 07/20] Added Target and Package Path to HTML Report --- contrib/html.tpl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/html.tpl b/contrib/html.tpl index 76c840e02f3c..8c31ddce4214 100644 --- a/contrib/html.tpl +++ b/contrib/html.tpl @@ -26,7 +26,7 @@ margin: 0 auto; } .pkg-path { - overflow-wrap: anywhere + white-space: normal; } .severity { text-align: center; @@ -55,9 +55,7 @@ } a.toggle-more-links { cursor: pointer; } - - Trivy Report - {{ now }} - + Trivy Report - {{ now }}
{{ .Type | toString | escapeXML }}
Target: {{ escapeXML .Target }} — Type: {{ escapeXML .Type }}
No Vulnerabilities found
No Vulnerabilities found
PackageSeverity Installed Version Fixed VersionPackage Path Links
{{ escapeXML .Vulnerability.Severity }} {{ escapeXML .InstalledVersion }} {{ escapeXML .FixedVersion }}{{ escapeXML .PkgPath }}
No Misconfigurations found
No Misconfigurations found
Type