-
Notifications
You must be signed in to change notification settings - Fork 30
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
Integrate Native Image SBOM with GitHub's Dependency Submission API #119
Conversation
There is one failing test which is not related to this PR: |
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.
Thanks for the PR, @rudsberg! Looks very good already. Left a couple of comments and suggestions.
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.
LGTM
a8b9f27
to
37b175a
Compare
37b175a
to
798fe47
Compare
Overview
This PR adds support to automatically generate a highly accurate SBOM with Native Image and submit it to GitHub's dependency submission API. That enables a simple integration with all the powerful security tooling that Github provides:
The feature is activated with the option
native-image-enable-sbom
. It requirescontents: write
permission and for the Dependency Graph feature to be activated (on by default for public repositories). This feature is supported for GraalVM for JDK 24 or above. It cannot be used for earlier versions since thepurl
SBOM field, which the GitHub API requires, is only available in the upcoming JDK 24 release.Approach and Testing
The high-level approach for the implementation is the following:
run
inmain.ts
callssetUpSBOMSupport
which appends--enable-sbom=export
toNATIVE_IMAGE_OPTIONS
. Effectively, this instructs any subsequent invocation ofnative-image
to generate an SBOM.run
incleanup.ts
callsprocessSBOM
which finds the SBOM, maps the content to the format the GitHub API expects, and submits it to the API.The feature is tested with a mix of unit and integration tests:
sbom.test.ts
runs unit and integration tests. The GitHub API is mocked.test.yml
is extended with a new jobsbom-test
which builds a maven project and asserts that an SBOM is created and verifies its contents.Example
Consider the test project that the job
sbom-test
uses which defines one Java class with a dependency onorg.json
. After the job has executed, the GitHub dashboard is populated with vulnerability alerts underSecurity/Dependabot
and the Dependency Graph underInsights/Dependency graph
. Here is how theSecurity/Dependabot
page looks like:A specific vulnerability:
The
Insights/Dependency graph
includes theorg.json
component which was part of the SBOM and the dependencies picked up automatically from the manifest files: