Skip to content

Commit 1e9f473

Browse files
daynewleedcaraveldavdhacs
authored
back port e2e fixes (#3072)
Co-authored-by: David Caravello <119438707+dcaravel@users.noreply.github.com> Co-authored-by: David House <105243888+davdhacs@users.noreply.github.com>
1 parent 955870b commit 1e9f473

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

e2etests/grpc_full_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ func checkGRPCMatch(t *testing.T, expectedVuln, matchingVuln *v1.Vulnerability)
153153
}
154154
expectedVuln.MetadataV2 = nil
155155
matchingVuln.MetadataV2 = nil
156+
157+
expectedVuln.Description = normalizeString(expectedVuln.Description)
158+
matchingVuln.Description = normalizeString(matchingVuln.Description)
159+
156160
assert.Equal(t, expectedVuln, matchingVuln)
157161
}
158162

e2etests/sanity_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/json"
88
"fmt"
99
"sort"
10+
"strings"
1011
"testing"
1112

1213
v1 "github.com/stackrox/scanner/api/v1"
@@ -58,6 +59,10 @@ func checkMatch(t *testing.T, source string, expectedVuln, matchingVuln v1.Vulne
5859
}
5960
expectedVuln.Metadata = nil
6061
matchingVuln.Metadata = nil
62+
63+
expectedVuln.Description = normalizeString(expectedVuln.Description)
64+
matchingVuln.Description = normalizeString(matchingVuln.Description)
65+
6166
assert.Equal(t, expectedVuln, matchingVuln)
6267
}
6368

@@ -183,3 +188,8 @@ func deepGet(m map[string]interface{}, keys ...string) interface{} {
183188
}
184189
return currVal
185190
}
191+
192+
// normalizeString removes newlines and collapses multiple spaces into one.
193+
func normalizeString(s string) string {
194+
return strings.Join(strings.Fields(s), " ")
195+
}

e2etests/testcase_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ var testCases = []testCase{
13511351
},
13521352
{
13531353
Name: "CVE-2020-1045",
1354-
Description: "<p>A security feature bypass vulnerability exists in the way Microsoft ASP.NET Core parses encoded cookie names.</p>\n<p>The ASP.NET Core cookie parser decodes entire cookie strings which could allow a malicious attacker to set a second cookie with the name being percent encoded.</p>\n<p>The security update addresses the vulnerability by fixing the way the ASP.NET Core cookie parser handles encoded names.</p>\n",
1354+
Description: "<p>A security feature bypass vulnerability exists in the way Microsoft ASP.NET Core parses encoded cookie names.</p>\n<p>The ASP.NET Core cookie parser decodes entire cookie strings which could allow a malicious attacker to set a second cookie with the name being percent encoded.</p>\n<p>The security update addresses the vulnerability by fixing the way the ASP.NET Core cookie parser handles encoded names.</p>",
13551355
Link: "https://nvd.nist.gov/vuln/detail/CVE-2020-1045",
13561356
Metadata: map[string]interface{}{
13571357
"NVD": map[string]interface{}{
@@ -1402,7 +1402,7 @@ var testCases = []testCase{
14021402
},
14031403
{
14041404
Name: "CVE-2020-1597",
1405-
Description: "A denial of service vulnerability exists when ASP.NET Core improperly handles web requests. An attacker who successfully exploited this vulnerability could cause a denial of service against an ASP.NET Core web application. The vulnerability can be exploited remotely, without authentication.\nA remote unauthenticated attacker could exploit this vulnerability by issuing specially crafted requests to the ASP.NET Core application.\nThe update addresses the vulnerability by correcting how the ASP.NET Core web application handles web requests.\n",
1405+
Description: "A denial of service vulnerability exists when ASP.NET Core improperly handles web requests. An attacker who successfully exploited this vulnerability could cause a denial of service against an ASP.NET Core web application. The vulnerability can be exploited remotely, without authentication.\nA remote unauthenticated attacker could exploit this vulnerability by issuing specially crafted requests to the ASP.NET Core application.\nThe update addresses the vulnerability by correcting how the ASP.NET Core web application handles web requests.",
14061406
Link: "https://nvd.nist.gov/vuln/detail/CVE-2020-1597",
14071407
Metadata: map[string]interface{}{
14081408
"NVD": map[string]interface{}{

0 commit comments

Comments
 (0)