-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Changes to 'createJarBom' break single-module Gradle project when running multi-language #479
Comments
@malice00 Nice find! Is there a test project to reproduce this? We need to filter the metadata.component.components for anything that matches the metadata.component before adding here. https://github.com/CycloneDX/cdxgen/blob/master/index.js#L350 Also, note these warnings were added to catch bugs like this. https://github.com/CycloneDX/cdxgen/blob/master/validator.js#L90 |
@prabhu I can probably commit and push my current work soon, then you'd have a test. Just want to make sure most of it works, otherwise you'd be looking through code that will most likely change a lot still... :-) I can now also reproduce the warning on the single project: I forgot to add a parameter for Gradle. Weird though that without it, the bom-ref appears to be valid, although it is never written in the SBOM...
Edit: |
As per purl, maven is the type for all jars. However, bom-ref could be any string including bom-link (which might exist in a different document) |
Signed-off-by: Prabhu Subramanian <[email protected]>
@prabhu That commit actually made it worse: now all of Gradle's sub-projects are gone! I added some output when the Gradle-part in cdxgen is done, and this is what the parentComponent looks like (partially, it's very big):
Then the jar-parser kicks in:
You can actually reproduce this with the current master-branch of cdxgen and fineract -- put a console.log on line 1489 to see the parentComponent: |
@malice00 Bringing back sub-projects turned out to be easy. However, getting fineract to validate is going to take some time. Will first get fineract working then we can test our repo with the fix. Could you join discord so that we can collaborate easily? |
I'll set it up tonight when I get home. |
While working on the final issues for Gradle projects, I rebased to the latest master branch and started getting problems.
On multi-project Gradle projects, I get a warning that there is a component under
metadata.component.components
with the same data as the one inmetadata.component
:Then again, in another test-project, it doesn't complain, but there is this new entry:
When running a single sub-projects in Gradle, I do not get any warning (I seem to remember I had some at some point...), but the component that was written in
metadata.component
for the Gradle-project, is now overwritten with a similar component -- but since the bom-ref is different, all dependencies are referencing the wrong component!I have been able to trace it back to a commit for 'evinse' (#472), where the 'createJarBom'-method was changed to work with a 'parentComponent', which was initialized with 'createDefaultParentComponent'.
Unfortunately, I didn't notice when writing #470, but it seems for multi-project Gradle, the warning can just be ignored. Still, it would probably be a good idea to take a look at this and fix it.
Also: when I add
-t gradle
to my command, cdxgen doesn't scan for JARs, so then all is fine!The text was updated successfully, but these errors were encountered: