From 23b5fece08a5781e0a41519287af81f96d2a4304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20=C3=8D=C3=B1igo=20Hern=C3=A1ndez?= Date: Mon, 2 Oct 2023 07:17:43 +0200 Subject: [PATCH] fix(report): removes git::http from uri in sarif (#5244) * fix(sarif): removes git::http from uri in sarif * fix(sarif): removes git::http from uri in sarif ## Description ## Related issues - Fixes https://github.com/aquasecurity/trivy/issues/5003 ## Checklist - [ ] I've read the [guidelines for contributing](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/) to this repository. - [ ] I've followed the [conventions](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/#title) in the PR title. - [ ] I've added tests that prove my fix is effective or that my feature works. - [ ] I've updated the [documentation](https://github.com/aquasecurity/trivy/blob/main/docs) with the relevant information (if needed). - [ ] I've added usage information (if the PR introduces new options) - [ ] I've included a "before" and "after" example to the description (if the PR is a user interface change). * fix lint --------- Co-authored-by: Simar --- pkg/report/sarif.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/report/sarif.go b/pkg/report/sarif.go index 724691e77886..11b452867efe 100644 --- a/pkg/report/sarif.go +++ b/pkg/report/sarif.go @@ -337,7 +337,7 @@ func ToPathUri(input string, resultClass types.ResultClass) string { input = ref.Context().RepositoryStr() } - return strings.ReplaceAll(input, "\\", "/") + return strings.ReplaceAll(strings.ReplaceAll(input, "\\", "/"), "git::https:/", "") } func (sw *SarifWriter) getLocations(name, version, path string, pkgs []ftypes.Package) []location {