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

✨ Adding CycloneDX 1.4 and 1.5 reporter #1014

Merged

Conversation

marcwieserdev
Copy link
Contributor

About this PR

This PR aims to add the CycloneDX 1.4 and 1.5 format. The idea behind it is to be able to export everything in a commonly used format to later reuse the result to enrich it. (ex: re-running a vulnerability matching process on the packages to find emerging vulnerabilities).

This PR adds 2 versions of CycloneDX even though at the moment they report the exact same thing.

In future PR, we intend to extract where packages has been found during the extraction process (file, line, column), which is an information only supported by CycloneDX 1.5.

We need a CycloneDX 1.4 format for backward compatibility reasons.

Additional informations

You may want to review this PR commit by commit, as it should be easier to read

Copy link
Collaborator

@oliverchang oliverchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much for contributing this! we'd love to support this feature in OSV-Scanner. I just have some comments.

internal/utility/purl/composer_extractor.go Outdated Show resolved Hide resolved
internal/utility/purl/composer_extractor.go Outdated Show resolved Hide resolved
internal/utility/purl/golang_extractor.go Outdated Show resolved Hide resolved
internal/utility/purl/golang_extractor.go Outdated Show resolved Hide resolved
pkg/grouper/grouper_test.go Outdated Show resolved Hide resolved
pkg/grouper/package_grouper.go Outdated Show resolved Hide resolved
pkg/osvscanner/vulnerability_result.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@another-rex another-rex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I haven't had time to look into this recently, but I'll take a deeper look this week.

go.mod Outdated Show resolved Hide resolved
Copy link
Collaborator

@another-rex another-rex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments, otherwise LGTM!

pkg/reporter/cyclonedx.go Show resolved Hide resolved
pkg/reporter/sbom/models.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 88.04781% with 30 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@46aee59). Learn more about missing BASE report.
Report is 2 commits behind head on main.

Files Patch % Lines
pkg/reporter/sbom/cyclonedx_common.go 86.23% 12 Missing and 3 partials ⚠️
internal/utility/purl/purl.go 57.14% 7 Missing and 2 partials ⚠️
internal/utility/purl/package_grouper.go 91.17% 2 Missing and 1 partial ⚠️
pkg/reporter/cyclonedx.go 91.89% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1014   +/-   ##
=======================================
  Coverage        ?   65.74%           
=======================================
  Files           ?      159           
  Lines           ?    12776           
  Branches        ?        0           
=======================================
  Hits            ?     8400           
  Misses          ?     3905           
  Partials        ?      471           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@another-rex another-rex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will aim to get this merged in next week.

@another-rex another-rex merged commit 56e740a into google:main Jul 8, 2024
13 checks passed
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.

4 participants