]> source.dussan.org Git - sonarqube.git/commitdiff
Apply feedbacks on security reports
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Fri, 13 Jul 2018 07:49:15 +0000 (09:49 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 17 Jul 2018 18:21:26 +0000 (20:21 +0200)
server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx
server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/VulnerabilityList-test.tsx.snap

index a1af8a0f8086aefb1e0b1531753df61689de4b0c..262c5380aef4f93ed01cfee19f1897763aed690f 100755 (executable)
@@ -117,17 +117,26 @@ export default class VulnerabilityList extends React.PureComponent<Props, State>
     );
   };
 
-  renderFinding(finding: SecurityHotspot, isCWE?: boolean): React.ReactFragment {
+  renderFinding(
+    finding: SecurityHotspot,
+    isCWE?: boolean,
+    parent?: SecurityHotspot
+  ): React.ReactFragment {
     const { branchLike, component, type } = this.props;
     const params: { [name: string]: string | undefined } = {
       ...getBranchLikeQuery(branchLike),
       types: 'SECURITY_HOTSPOT'
     };
-    params[isCWE ? 'cwe' : type] = finding.cwe || finding.category;
+    if (isCWE && parent) {
+      params['cwe'] = finding.cwe;
+      params[type] = parent.category;
+    } else {
+      params[type] = finding.category;
+    }
 
     const subFindings =
       this.props.showCWE && finding.distribution
-        ? finding.distribution.map(f => this.renderFinding(f, true))
+        ? finding.distribution.map(f => this.renderFinding(f, true, finding))
         : null;
 
     const title = getRatingTooltip('security_rating', finding.vulnerabilityRating || 1);
index cde2b7944a405c36781b2789f90c8e4be81a8b74..117782d52276c6459147e513e07cdf191eb16d78 100644 (file)
@@ -549,6 +549,7 @@ exports[`renders with cwe 1`] = `
                       "query": Object {
                         "cwe": "42",
                         "id": "foo",
+                        "owaspTop10": "a1",
                         "resolved": "false",
                         "types": "VULNERABILITY",
                       },
@@ -570,6 +571,7 @@ exports[`renders with cwe 1`] = `
                         "query": Object {
                           "cwe": "42",
                           "id": "foo",
+                          "owaspTop10": "a1",
                           "resolved": "false",
                           "types": "VULNERABILITY",
                         },
@@ -596,6 +598,7 @@ exports[`renders with cwe 1`] = `
                     "query": Object {
                       "cwe": "42",
                       "id": "foo",
+                      "owaspTop10": "a1",
                       "resolved": "false",
                       "statuses": "OPEN,REOPENED",
                       "types": "SECURITY_HOTSPOT",
@@ -619,6 +622,7 @@ exports[`renders with cwe 1`] = `
                     "query": Object {
                       "cwe": "42",
                       "id": "foo",
+                      "owaspTop10": "a1",
                       "resolutions": "FIXED",
                       "statuses": "RESOLVED",
                       "types": "SECURITY_HOTSPOT",
@@ -642,6 +646,7 @@ exports[`renders with cwe 1`] = `
                     "query": Object {
                       "cwe": "42",
                       "id": "foo",
+                      "owaspTop10": "a1",
                       "resolutions": "WONTFIX",
                       "statuses": "RESOLVED",
                       "types": "SECURITY_HOTSPOT",