Skip to content

Commit c00bd4d

Browse files
authored
Don't show remediation if not exists (#488)
1 parent d6d9dd5 commit c00bd4d

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

go.mod

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/jfrog/frogbot
33
go 1.20
44

55
require (
6-
github.com/go-git/go-git/v5 v5.8.1
6+
github.com/go-git/go-git/v5 v5.9.0
77
github.com/golang/mock v1.6.0
88
github.com/google/go-github/v45 v45.2.0
99
github.com/jfrog/build-info-go v1.9.10
1010
github.com/jfrog/froggit-go v1.14.0
1111
github.com/jfrog/gofrog v1.3.0
12-
github.com/jfrog/jfrog-cli-core/v2 v2.41.6
12+
github.com/jfrog/jfrog-cli-core/v2 v2.41.7
1313
github.com/jfrog/jfrog-client-go v1.32.1
1414
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
1515
github.com/owenrumney/go-sarif/v2 v2.2.0
@@ -35,15 +35,15 @@ require (
3535
github.com/chzyer/readline v1.5.1 // indirect
3636
github.com/cloudflare/circl v1.3.3 // indirect
3737
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
38+
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
3839
github.com/davecgh/go-spew v1.1.1 // indirect
3940
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
40-
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027 // indirect
4141
github.com/emirpasic/gods v1.18.1 // indirect
4242
github.com/forPelevin/gomoji v1.1.8 // indirect
4343
github.com/fsnotify/fsnotify v1.6.0 // indirect
4444
github.com/gfleury/go-bitbucket-v1 v0.0.0-20230626192437-8d7be5866751 // indirect
4545
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
46-
github.com/go-git/go-billy/v5 v5.4.1 // indirect
46+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
4747
github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d // indirect
4848
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
4949
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect

go.sum

+11-12
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWH
675675
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
676676
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
677677
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
678+
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
679+
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
678680
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
679681
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
680682
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -683,9 +685,7 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 h1:iFaUwBSo5Svw6L
683685
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s=
684686
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
685687
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
686-
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027 h1:1L0aalTpPz7YlMxETKpmQoWMBkeiuorElZIXoNmgiPE=
687-
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
688-
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
688+
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU=
689689
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
690690
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
691691
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -722,11 +722,11 @@ github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2H
722722
github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY=
723723
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
724724
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
725-
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
726-
github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg=
725+
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
726+
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
727727
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8=
728-
github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A=
729-
github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo=
728+
github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY=
729+
github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0=
730730
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
731731
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
732732
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -884,8 +884,8 @@ github.com/jfrog/froggit-go v1.14.0 h1:WdbCgar/zMrmq5EIremVosLEbxEsOcpTtyhyeYZPb
884884
github.com/jfrog/froggit-go v1.14.0/go.mod h1:0jRAaZZusaFFnITosmx6CA60SKryuoaCasJyUrP/c1s=
885885
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
886886
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
887-
github.com/jfrog/jfrog-cli-core/v2 v2.41.6 h1:wnHfeO4/7MOqyGKN1I5RaXHpKPNKwYAUMEuOHlwjV0U=
888-
github.com/jfrog/jfrog-cli-core/v2 v2.41.6/go.mod h1:HCMfdtCy2B81EF8YiQlsfbG3CsLk/VeqoWGNYoSUz8Q=
887+
github.com/jfrog/jfrog-cli-core/v2 v2.41.7 h1:t54PfmmTWsrX1L/7WpY0n57AwWfNZSfoTI1RG9huXlE=
888+
github.com/jfrog/jfrog-cli-core/v2 v2.41.7/go.mod h1:HCMfdtCy2B81EF8YiQlsfbG3CsLk/VeqoWGNYoSUz8Q=
889889
github.com/jfrog/jfrog-client-go v1.32.1 h1:RQmuPSLsF5222vZJzwkgHSZMMJF83ExS7SwIvh4P+H8=
890890
github.com/jfrog/jfrog-client-go v1.32.1/go.mod h1:362+oa7uTTYurzBs1L0dmUTlLo7uhpAU/pwM5Zb9clg=
891891
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA=
@@ -960,9 +960,9 @@ github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5
960960
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
961961
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
962962
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
963-
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
964963
github.com/nwaples/rardecode v1.1.0 h1:vSxaY8vQhOcVr4mm5e8XllHWTiM4JF507A0Katqw7MQ=
965964
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
965+
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
966966
github.com/owenrumney/go-sarif v1.1.1/go.mod h1:dNDiPlF04ESR/6fHlPyq7gHKmrM0sHUvAGjsoh8ZH0U=
967967
github.com/owenrumney/go-sarif/v2 v2.2.0 h1:1DmZaijK0HBZCR1fgcDSGa7VzYkU9NDmbZ7qC2QfUjE=
968968
github.com/owenrumney/go-sarif/v2 v2.2.0/go.mod h1:MSqMMx9WqlBSY7pXoOZWgEsVB4FDNfhcaXDA1j6Sr+w=
@@ -997,11 +997,10 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
997997
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
998998
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
999999
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
1000-
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
10011000
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
10021001
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
1003-
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
10041002
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
1003+
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
10051004
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
10061005
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
10071006
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=

utils/outputwriter/outputwriter.go

-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ func GetJasMarkdownDescription(severity, finding string) string {
219219

220220
func GetLocationDescription(location formats.Location) string {
221221
return fmt.Sprintf(`
222-
Found issue with the following snippet
223222
%s
224223
at %s (line %d)
225224
`,

utils/outputwriter/simplifiedoutput.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ func (smo *SimplifiedOutput) VulnerabilitiesContent(vulnerabilities []formats.Vu
113113
func (smo *SimplifiedOutput) ApplicableCveReviewContent(severity, finding, fullDetails, cveDetails, remediation string) string {
114114
var contentBuilder strings.Builder
115115
contentBuilder.WriteString(fmt.Sprintf(`
116-
### 📦🔍 Contextual Analysis CVE Vulnerability
116+
## 📦🔍 Contextual Analysis CVE Vulnerability
117117
118118
%s
119119
120-
#### Description
120+
### Description
121121
122122
%s
123123
124-
#### CVE details
124+
### CVE details
125125
126126
%s
127127
@@ -132,7 +132,7 @@ func (smo *SimplifiedOutput) ApplicableCveReviewContent(severity, finding, fullD
132132

133133
if len(remediation) > 0 {
134134
contentBuilder.WriteString(fmt.Sprintf(`
135-
#### Remediation
135+
### Remediation
136136
137137
%s
138138
@@ -144,7 +144,7 @@ func (smo *SimplifiedOutput) ApplicableCveReviewContent(severity, finding, fullD
144144

145145
func (smo *SimplifiedOutput) IacReviewContent(severity, finding, fullDetails string) string {
146146
return fmt.Sprintf(`
147-
### 🛠️ Infrastructure as Code Vulnerability
147+
## 🛠️ Infrastructure as Code (Iac) Vulnerability
148148
149149
%s
150150
@@ -160,17 +160,17 @@ func (smo *SimplifiedOutput) IacReviewContent(severity, finding, fullDetails str
160160
func (smo *SimplifiedOutput) SastReviewContent(severity, finding, fullDetails string, codeFlows [][]formats.Location) string {
161161
var contentBuilder strings.Builder
162162
contentBuilder.WriteString(fmt.Sprintf(`
163-
### 🎯 Static Application Security Testing (SAST) Vulnerability
163+
## 🎯 Static Application Security Testing (SAST) Vulnerability
164164
165165
%s
166166
167167
---
168-
#### Full description
168+
### Full description
169169
170170
%s
171171
172172
---
173-
#### Code Flows
173+
### Code Flows
174174
175175
`,
176176
GetJasMarkdownDescription(smo.FormattedSeverity(severity, "Applicable", false), finding),

utils/outputwriter/standardoutput.go

+13-11
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ func (so *StandardOutput) VulnerabilitiesContent(vulnerabilities []formats.Vulne
127127
func (so *StandardOutput) ApplicableCveReviewContent(severity, finding, fullDetails, cveDetails, remediation string) string {
128128
var contentBuilder strings.Builder
129129
contentBuilder.WriteString(fmt.Sprintf(`
130-
<div align="center">
130+
## 📦🔍 Contextual Analysis CVE Vulnerability
131131
132-
### 📦🔍 Contextual Analysis CVE Vulnerability
132+
<div align="center">
133133
134134
%s
135135
@@ -155,8 +155,8 @@ func (so *StandardOutput) ApplicableCveReviewContent(severity, finding, fullDeta
155155
GetJasMarkdownDescription(so.FormattedSeverity(severity, "Applicable", false), finding),
156156
fullDetails,
157157
cveDetails))
158-
159-
contentBuilder.WriteString(fmt.Sprintf(`
158+
if len(remediation) > 0 {
159+
contentBuilder.WriteString(fmt.Sprintf(`
160160
<details>
161161
<summary> <b>Remediation</b> </summary>
162162
<br>
@@ -166,16 +166,18 @@ func (so *StandardOutput) ApplicableCveReviewContent(severity, finding, fullDeta
166166
</details>
167167
168168
`,
169-
remediation))
169+
remediation))
170+
}
171+
170172
return contentBuilder.String()
171173
}
172174

173175
func (so *StandardOutput) IacReviewContent(severity, finding, fullDetails string) string {
174176
return fmt.Sprintf(`
175-
<div align="center">
177+
## 🛠️ Infrastructure as Code (Iac) Vulnerability
178+
179+
<div align="center">
176180
177-
### 🛠️ Infrastructure as Code Vulnerability
178-
179181
%s
180182
181183
</div>
@@ -196,10 +198,10 @@ func (so *StandardOutput) IacReviewContent(severity, finding, fullDetails string
196198
func (so *StandardOutput) SastReviewContent(severity, finding, fullDetails string, codeFlows [][]formats.Location) string {
197199
var contentBuilder strings.Builder
198200
contentBuilder.WriteString(fmt.Sprintf(`
199-
<div align="center">
200-
201-
### 🎯 Static Application Security Testing (SAST) Vulnerability
201+
## 🎯 Static Application Security Testing (SAST) Vulnerability
202202
203+
<div align="center">
204+
203205
%s
204206
205207
</div>

0 commit comments

Comments
 (0)