-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature 345 summary in reports #2156
Feature 345 summary in reports #2156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall you are on the right track, but you need to build up the data structure for the summary in the HTMLScanResultReportModelBuilder
. See comments.
sechub-scan/src/main/resources/templates/report/html/scanresult.html
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/resources/templates/report/html/scanresult.html
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/resources/templates/report/html/scanresult.html
Outdated
Show resolved
Hide resolved
<tr> | ||
<td>Red</td> | ||
<td> | ||
<span th:if="!${redList.isEmpty()}"><a href="#redFindingsBlock" th:text="${#lists.size(redList)}"></a></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The id should be: #scanTypeRedFindingsBlock
<div th:if="!${redList.isEmpty()}"> | ||
<h2 class='redFindingHeadline'>Red findings</h2> | ||
<h2 class='redFindingHeadline' id="redFindingsBlock">Red findings</h2> | ||
<table class='findingsTable redFindingsTable'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a new table for every scanType + redList.
<div th:if="!${redList.isEmpty()}"> | ||
<h2 class='redFindingHeadline'>Red findings</h2> | ||
<h2 class='redFindingHeadline' id="redFindingsBlock">Red findings</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each finding table needs a separate heading.
For example:
<h3 class='redFindingHeadline' id="codeScanRedFindingsBlock">Code Scan</a>
@Jeeppler
|
|
@zigfridus yes, that is a good idea |
@zigfridus please add the image of the table from the Google drive into this issue here. I would like to have the documentation of this issue in one place. |
@Jeeppler |
@Jeeppler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outstanding work. I love how readable the code is.
I found some smaller issues. Please change those.
Still there are three major things I am missing:
- Tests (there should be a test for the ScanTypeCount class and extend HTMLScanResultReportModelBuilderTest)
- A list of CWEs found (see: Summary in Reports #345 (comment))
- The JSON report should contain the same summary (see: Summary in Reports #345 (comment))
You are clearly on the right track. I know the issue is challenging.
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCount.java
Outdated
Show resolved
Hide resolved
...scan/src/main/java/com/mercedesbenz/sechub/domain/scan/HTMLScanResultReportModelBuilder.java
Outdated
Show resolved
Hide resolved
- changed model's scanTypeCount List to Set in the HTMLScanResultReportModelBuilder; - added tests in the HTMLScanResultReportModelBuilderTest; - cleaned and added improvements in the ScanTypeCount; - created tests for the ScanTypeCount; - modified scanresult.html because of new set from the HTMLScanResultReportModelBuilder.
@Jeeppler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. However, I did found some issues. For details have a look at the comments.
Please include a screenshot with your next pull-request review request (only as comment in the pull-request conversation).
sechub-commons-model/src/main/java/com/mercedesbenz/sechub/commons/model/SecHubReportScan.java
Outdated
Show resolved
Hide resolved
...mmons-model/src/main/java/com/mercedesbenz/sechub/commons/model/SecHubReportScanDetails.java
Outdated
Show resolved
Hide resolved
...mmons-model/src/main/java/com/mercedesbenz/sechub/commons/model/SecHubReportScanDetails.java
Outdated
Show resolved
Hide resolved
...mmons-model/src/main/java/com/mercedesbenz/sechub/commons/model/SecHubReportScanDetails.java
Outdated
Show resolved
Hide resolved
...b-commons-model/src/main/java/com/mercedesbenz/sechub/commons/model/SecHubReportSummary.java
Show resolved
Hide resolved
sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCountTest.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCountTest.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCountTest.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCountTest.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanTypeCountTest.java
Show resolved
Hide resolved
@Jeeppler |
@zigfridus It would be nice to have a screenshot of the report with the summary once you request a review. The simply reason is, that you are working on the HTML report and it is always a good idea to show case the visual changes. Simply include the screenshot as part of this conversation. |
Hello @Jeeppler |
@zigfridus yes, they could both have different severity levels even for the same CWE, depending on how the tool calculates the severity level (e, g. based on a Control Flow Graph). It is certainly an edge case. In addition, some tools produce findings with a CWE-0. The problem, a CWE-0 does not exist. In the real world there are a lot of oddities, quirks and bugs. Tests might help to check for those. However, I do expect that over time we will uncover some situations/combinations you/we did not account for. That is fine. |
@Jeeppler Thank you for the explanation. |
@Jeeppler Finally I have some result that I can show you. These are 2 reports, generated by the modified code. Please have a look at the html files in the ZIP: I didn't find at your example a details block: Should it exist in my report too? |
@zigfridus Thanks, I know it takes time. Overall, it look very nice. Good job. 🥇 The details block should exist in your report as well. I am surprised, that it does not exist in your code. Regarding the tables. I think if they look this they would be easier to read:
In addition, it would be nice to use the Closed:
CodeScan open:
|
@Jeeppler
|
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
…mons/model/SecHubReportMetaDataSummaryTest.java Co-authored-by: Jeeppler <Jeeppler@users.noreply.github.com>
@Jeeppler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good too me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution.
I found some parts I want to have been changed. Especially the report for web scans is not correct rendering (JSON and HTML). Please look at the comments for more details.
...s-model/src/main/java/com/mercedesbenz/sechub/commons/model/SecHubReportMetaDataSummary.java
Show resolved
Hide resolved
@@ -241,7 +238,8 @@ public void before() throws Exception { | |||
map.put("yellowList", new ArrayList<>()); | |||
map.put("greenList", new ArrayList<>()); | |||
map.put("isWebDesignMode", false); | |||
map.put("metaData", Optional.ofNullable(null)); | |||
map.put("metaData", null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you do a
map.get("metadata")
and you have not defined it, it will always be null
Please remove the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...scan/src/main/java/com/mercedesbenz/sechub/domain/scan/HTMLScanResultReportModelBuilder.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/HTMLWebSecHubFinding.java
Outdated
Show resolved
Hide resolved
...scan/src/main/java/com/mercedesbenz/sechub/domain/scan/HTMLScanResultReportModelBuilder.java
Outdated
Show resolved
Hide resolved
...scan/src/main/java/com/mercedesbenz/sechub/domain/scan/HTMLScanResultReportModelBuilder.java
Outdated
Show resolved
Hide resolved
sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/report/ScanSecHubReport.java
Outdated
Show resolved
Hide resolved
sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ThymeLeafHTMLReportingTest.java
Show resolved
Hide resolved
hasMetaDataLabel("test-label2", ""). | ||
hasMetaDataLabel("test-label3_with_html", "<html>HTML is allowed, but must always be escaped in reports!</html>"). | ||
hasMetaDataLabel("test-label4_with_special_chars", "Line1\nLine2\tLine3"). | ||
hasMetaDataSummaryCodeScanTotal(32). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added your new tests - okay (of course)
But you dropped the existing meta data label tests. Why?
We need these tests to ensure that the labels are inside the report - it is an important version.
Please add the former meta data label checks/tests again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I didn't find any of these labels in the report that should be tested:
{"metaData":{"labels":{},"summary":
Should they exist here?
hasMetaDataLabel("test-label2", ""). | ||
hasMetaDataLabel("test-label3_with_html", "<html>HTML is allowed, but must always be escaped in reports!</html>"). | ||
hasMetaDataLabel("test-label4_with_special_chars", "Line1\nLine2\tLine3"); | ||
hasHTMLString("<td><a href=\"#redCodeScanTable\">28</a></td>"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added your new tests - okay (of course)
But you dropped the existing meta data label tests. Why?
We need these tests to ensure that the labels are inside the report - it is an important version.
Please add the former meta data label checks/tests again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I didn't find any of these labels in the report that should be tested:
{"metaData":{"labels":{},"summary":
Should they exist here?
@zigfridus : I am happy to see that you have done some new commits/pushes. When your changes are complete, please re-request a review from me by GitHub UI. Thank you. |
@de-jcup |
@zigfridus : Sorry (again) for the late response With we introduced a "community" branch. Please do me a favor and change your PR target from We try to install this as the default mechanism - to speed up merges, reduce frustration at contributor side, see build failures before merging to So... this is like a test balloon, but I hope this works well in future for other contributions/contributors as well. Thank you for your patience, your contribution and your perseverance regarding this long ongoing PR... Remark: With #2599 I fixed the sorting of the reduced open api file. Please merge the develop branch into your branch and get rid of the merge conflict (community branch is at same level as develop branch) |
@de-jcup |
@zigfridus awesome, thank you. |
@Jeeppler |
@zigfridus I think the best way to solve the problem is to close this pull-request (2156) and create a new pull-request fork/branch with the target branch mercedes-benz:community. To not loos all the discussions from this conversation, you can simply link/mention this pull-request in your new pull-request. |
This PR will close #345