diff --git a/e2etests/grpc_full_test.go b/e2etests/grpc_full_test.go index 67d43d3fa..d065c637e 100644 --- a/e2etests/grpc_full_test.go +++ b/e2etests/grpc_full_test.go @@ -153,6 +153,10 @@ func checkGRPCMatch(t *testing.T, expectedVuln, matchingVuln *v1.Vulnerability) } expectedVuln.MetadataV2 = nil matchingVuln.MetadataV2 = nil + + expectedVuln.Description = normalizeString(expectedVuln.Description) + matchingVuln.Description = normalizeString(matchingVuln.Description) + assert.Equal(t, expectedVuln, matchingVuln) } diff --git a/e2etests/sanity_test.go b/e2etests/sanity_test.go index bca846a75..dbf503f7c 100644 --- a/e2etests/sanity_test.go +++ b/e2etests/sanity_test.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "sort" + "strings" "testing" v1 "github.com/stackrox/scanner/api/v1" @@ -58,6 +59,10 @@ func checkMatch(t *testing.T, source string, expectedVuln, matchingVuln v1.Vulne } expectedVuln.Metadata = nil matchingVuln.Metadata = nil + + expectedVuln.Description = normalizeString(expectedVuln.Description) + matchingVuln.Description = normalizeString(matchingVuln.Description) + assert.Equal(t, expectedVuln, matchingVuln) } @@ -183,3 +188,8 @@ func deepGet(m map[string]interface{}, keys ...string) interface{} { } return currVal } + +// normalizeString removes newlines and collapses multiple spaces into one. +func normalizeString(s string) string { + return strings.Join(strings.Fields(s), " ") +} diff --git a/e2etests/testcase_test.go b/e2etests/testcase_test.go index 63a267469..1ab075a09 100644 --- a/e2etests/testcase_test.go +++ b/e2etests/testcase_test.go @@ -991,7 +991,7 @@ var testCases = []testCase{ { Name: "CVE-2018-1125", NamespaceName: "centos:7", - Description: "DOCUMENTATION: If a process inspected by pgrep has an argument longer than INT_MAX bytes, \"int bytes\" could wrap around back to a large positive int (rather than approaching zero), leading to a stack buffer overflow via strncat(). MITIGATION: The procps suite on Red Hat Enterprise Linux is built with FORTIFY, which limits the impact of this stack overflow (and others like it) to a crash.", + Description: "DOCUMENTATION: If a process inspected by pgrep has an argument longer than INT_MAX bytes, \"int bytes\" could wrap around back to a large positive int (rather than approaching zero), leading to a stack buffer overflow via strncat(). MITIGATION: The procps suite on Red Hat Enterprise Linux is built with FORTIFY, which limits the impact of this stack overflow (and others like it) to a crash.", Link: "https://access.redhat.com/security/cve/CVE-2018-1125", Severity: "Low", Metadata: map[string]interface{}{