Skip to content
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

Add CWE taxonomy to SARIF report #2410

Merged

Conversation

Jeeppler
Copy link
Contributor

@Jeeppler Jeeppler commented Apr 22, 2023

Add CWE taxonomy to SARIF report.

  • added class to calculate GUID based on UUID5
  • added classes for CWE information and data
  • added slimmed down JSON file with information about all CWEs (based on official CWE XML file). The script to create the slimmed down version is not included.
  • added new tests
  • changed, added and modified classes to create the CWE taxonomy

closes: #2321


Make sure these boxes are checked before submitting your PR -- thank you!

  • Added an entry into CHANGELOG.md if you have changed SpotBugs code

Jeeppler and others added 7 commits April 6, 2023 18:59
- added CWE 4.10 JSON to /etc
- added classes for the CWE weaknesses
- added the SARIF taxon element
- extended Rule, SarifBugReporter and BugCollectionAnalyser classes to include CWE details
- added a GUIDCalculator which implements UUIDv5
- fixed issues detected while testing
- New BugCollectionAnalyserTest
- added test for CWE taxonomies to SarifBugReporterTest
- applied spotless rules to source code
- made Taxon comparable
- CWEs without a severity level have no severity level assigned to them
- convert CWE severity levels to  SARIF severity levels
- the taxon id and relationship id are now strings rather than integers
@Jeeppler Jeeppler changed the title Add CWE taxonomy to sarif report Add CWE taxonomy to SARIF report Apr 22, 2023
@Jeeppler
Copy link
Contributor Author

@hazendaz and @ThrawnCA I wrote a small Python CLI app/script to convert the MITRE XML into a reduced JSON file.

Do you want me to add the Python script to this pull request?

  • If so, in which folder shall I put it?

@hazendaz
Copy link
Member

  • If so, in which folder shall I put it?

Sure on including but not sure where to place it. Make your best guess :)

@Jeeppler
Copy link
Contributor Author

I used the REUSE specification header comments for the CWE conversion script to put it under the proper license.

  1. Is that okay?
  2. Is there a reason why SpotBugs is not using the REUSE spec (SPDX format) for all files?

@hazendaz
Copy link
Member

hazendaz commented Apr 28, 2023 via email

@hazendaz hazendaz self-assigned this Apr 28, 2023
@hazendaz
Copy link
Member

2. Is there a reason why SpotBugs is not using the REUSE spec (SPDX format) for all files?

I don't know why, this project is really old so just maybe not something that was generally thought of. I'd have all files marked with license headers if this were maven but its gradle and my skills there are very low. If you understand gradle enough and know how to get that to be turned on and automated so files auto do it across the board, I think that would be a separate welcomed PR. I'm sure there are plugins for gradle to do same as there are for maven so its not something we have to think about :)

@hazendaz
Copy link
Member

@ThrawnCA I think I'm good here. WDYT?

@hazendaz
Copy link
Member

hazendaz commented Apr 29, 2023 via email

@hazendaz
Copy link
Member

hazendaz commented Apr 29, 2023 via email

@ThrawnCA ThrawnCA dismissed their stale review May 1, 2023 22:24

Style disagreement but not worth digging heels in, so abstaining

@Jeeppler
Copy link
Contributor Author

Jeeppler commented May 2, 2023

@hazendaz and @ThrawnCA is there anything outstanding which I have to change from your perspective? Is there any outstanding issue to get this merged?

@hazendaz
Copy link
Member

hazendaz commented May 2, 2023 via email

@hazendaz hazendaz merged commit ab605cf into spotbugs:master May 7, 2023
4 checks passed
@hazendaz
Copy link
Member

hazendaz commented May 7, 2023

@Jeeppler Merged, sorry for delays

@Jeeppler
Copy link
Contributor Author

Jeeppler commented May 8, 2023

@hazendaz thanks for merging it.

@Jeeppler Jeeppler deleted the add_cwe_taxonomy_to_sarif_report branch May 8, 2023 09:10
@hazendaz hazendaz added this to the SpotBugs 4.8.0 milestone Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CWE Taxonomy to SARIF Report
3 participants