-
-
Notifications
You must be signed in to change notification settings - Fork 413
Generation Software Bill of Materials (SBOM) #4757
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
base: main
Are you sure you want to change the base?
Conversation
I've these high level questions
(update: Android tests are fixed) |
cdc2cdd
to
b740cdc
Compare
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.
I've these high level questions
- I implemented the SBOM json from scratch, so that we can use the UPickle etc and do not add libraries:
The alternative is to use the CycloneDX 'model' library, that mostly implements the JSON and some hashing.
But that then adds this extra library etc: More stuff to download, more stuff in the classpath etc.
So, the question is: What is preferred in general: Avoiding external libraries when possible? Or go for maximum comparability and include more external libraries?
I'd say it depends on how stable the CyconeDX format it. We don't have an issue with downloading additional dependencies, as long as we encapsulate them in an isolated classloader and properly manage their use (e.g. share same classloader for multple modules via a worker module).
But the model added here seems small enough and the benefit of being directly cacheable by Mill as a task result is something I find useful.
- I adding this to the 'contrib' section the right place? The alternative seems to have it as a complete external library. However, that adds extra maintenance burdens: Pushing it to Maven repos, compiling it, versioning it. So, having it in-sync seems better.
Contrib is exactly for when you don't want to host it yourself.
- I've extended the returned data from the Coursier
.artifacts
method. I think that is ok, because that method wasn't yet published in0.12.9
?
I'd like to have @alexarchambault thoughts on that. I think we don't want to return tuples from Resolver.artifacts
(until we can use named tuples). Maybe we want add a new method with a better name instead.
I added some comments below.
b740cdc
to
bdb28c2
Compare
|
main/util/src/mill/util/Jvm.scala
Outdated
case Right(res) => | ||
Result.Success(res) | ||
case Right(artifacts) => | ||
Result.Success(ArtifactResolution(resolution, artifacts)) |
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.
Maybe coursier.Fetch.Result
could be used for that, like
Result.Success(ArtifactResolution(resolution, artifacts)) | |
Result.Success(Fetch.Result(resolution, artifacts.fullDetailedArtifacts0, artifacts.fullExtraArtifacts)) |
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.
And we could rename CoursierModule#artifacts
to CoursierModule#fetch
then
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.
Used Fetch.Result and renamed.
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.
@alexarchambault Ping. Updated to Fetch.Result
cc09aea
to
e5737a7
Compare
e5737a7
to
ff4bd95
Compare
Rebased & Tests passing =) |
1d3b959
to
3ba698a
Compare
@gamlerhart sorry we've overlooked this. Could you rebase this one more time, and flesh out the PR description with a more verbose explanation of what this is all about? I'm not familiar with SBOMs myself and need help understanding what's going on here |
Hi everyone. I'll try to get to it and rebase it. @lihaoyi At this stage the PR is the Eg. Missing atm:
Anyway, that is something to add if there is demand =). |
ff4bd95
to
b770fc6
Compare
@gamlerhart To get an idea, how such an SBOM looks like, could you attach an SBOM generated with this PR for Mill itself? |
e68e4df
to
006f36c
Compare
Ok...I'm not sure how to create a SBOM for Mill itself with a dev build: What I tried:
Then I get this error:
So, I think my plain |
@gamlerhart since Mill has a meta-build in mill-build/build.mill, you need to add your dependency there instead of in the build header |
> MILL_STABLE_VERSION=1 mill dist.installLocalCache
...
[7152] /home/lefou/.cache/mill/download/1.0.4-37-a03078
diff --git a/mill-build/build.mill b/mill-build/build.mill
@@ -15,6 +15,7 @@
// TODO: implement empty version for ivy deps as we do in import parser
mvn"com.lihaoyi::mill-contrib-buildinfo:${mill.api.BuildInfo.millVersion}",
mvn"com.goyeau::mill-scalafix_mill1:0.6.0",
- mvn"org.jsoup:jsoup:1.21.2"
+ mvn"org.jsoup:jsoup:1.21.2",
+ mvn"com.lihaoyi::mill-contrib-sbom:${mill.api.BuildInfo.millVersion}"
)
}
> MILL_VERSION="1.0.4-37-a03078" mill ... or edit the diff --git a/build.mill b/build.mill
@@ -1,4 +1,4 @@
-//| mill-version: 1.0.4-26-a6e4c1
+//| mill-version: 1.0.4-37-a03078
//| mill-jvm-opts: ["-XX:NonProfiledCodeHeapSize=250m", "-XX:ReservedCodeCacheSize=500m"]
//| mill-opts: ["--jobs=0.5C"]
|
006f36c
to
c6d59b9
Compare
Thanks for the help =). That worked: The SBOM for Mill itself looks like this: Or for example when viewing it in a tool like dependency track: Reminder: It is a
From my side: I probably more interested to also get the JavaScript/npm dependencies next. As having JVM backend + NPM in the frontend is so common. |
Motivation: In some companies, the development team has to produce Software Bill of Materials (SBOM) for their project for compliance reasons: To track dependencies and licenses across their organisation. Provide a Module that produces SBOMs in JSON format. Changes in the core: Extended the .getArtifact to return the coursier.Resolution as well. This is then used to get the license information. Outside the core: Add a SBOM contrib module - Generate the most basic CycloneDX SBOM files Supporting Java modules for a start - Provide a basic upload to the Dependency Track server
c6d59b9
to
d30555c
Compare
Motivation: In some companies, the development
team has to produce Software Bill of Materials (SBOM) for their project for compliance reasons:
To track dependencies and licenses across their organisation. Provide a Module that produces SBOMs
in JSON format.
Changes in the core: Extended the .getArtifact
to return the coursier.Resolution as well.
This is then used to get the license information.
Outside the core: Add a SBOM contrib module