-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(sbom): Support license detection for SBOM scan #6072
feat(sbom): Support license detection for SBOM scan #6072
Conversation
|
Looks good. Can you please test it @DmitriyLewen? |
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.
Hello @bedla
Thanks for your work.
You can read about PR title here - https://aquasecurity.github.io/trivy/v0.49/community/contribute/pr/#title
I left some comments. Take a look, please.
Can you also update docs:
trivy/docs/docs/scanner/license.md
Line 35 in 428420e
| Standard | ✅ | ✅ | - | - | trivy/docs/docs/target/sbom.md
Line 3 in 428420e
Trivy can take the following SBOM formats as an input and scan for vulnerabilities.
About tests - i think we can add 1 more testcase in integration sbom test:
add scanner
to args
, scan licenses for testdata/fixtures/sbom/centos-7-cyclonedx.json
and create new golden file.
Sure, I will take a look and make changes. |
5d7784b
to
0ecb5d7
Compare
0ecb5d7
to
5af436b
Compare
On my Maven test project I have generated Mind that golden file I did more deeper investigation because Cyclone DX Maven plugin is identifying License ID at most cases correctly. What I found is that they use mapping file https://github.com/CycloneDX/cyclonedx-core-java/blob/master/src/main/resources/license-mapping.json to find those License IDs. I think that new PR should be created to implement similar concept like they do. What do you think? |
We already have mapping - trivy/pkg/licensing/normalize.go Lines 8 to 14 in 8221473
But it looks like we need to supplement our map with pairs from cycledx-core-java .
|
This is really a great improvement! Just to be sure: will license scanning on SBOM also work for SPDX json with this PR? If not, this would be another great improvement for trivy. |
@christiankofler It should work for all supported SBOM formats |
@bedla Do you have time to wrap it up? If not, we can take care of this PR. |
sorry, I was on vacations last week. I will finish it this week. |
5af436b
to
9902696
Compare
Hi, I have force pushed new changes to my branch (sorry for delay). |
9902696
to
79ebdf9
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.
Hello @bedla
Left comments.
Also pay attention to integration tests. integration/client_server_test.go
is now broken.
pkg/dependency/parser/golang/mod/testdata/replaced-with-local-path-and-version-mismatch/go.sum
Outdated
Show resolved
Hide resolved
ahh, sorry ... will fix it asap. |
9137f7e
to
c09620f
Compare
all the stuff should be fixed |
hmm, interesting that test is not failing on my local machine ... will check it. |
c09620f
to
a1fa7ad
Compare
I have force pushed fixes, now it should be ok. |
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.
@DmitriyLewen you are welcome, I am happy to help :) |
Description
Hi, I find out that when scanning SBOM files I am not able to select License scanner, only Vulnerability scannes is available. I dig little bit in source code and it looks trivial - from high level.
What do you think about this change.
If you will guide me to tests I should write or other parts/use-cases I should test and fix, I can update it. I will also polish commits, PR title, and all the stuff required :)
Thx
Ivos
note: I have also started conversation here #6073
Issue
Checklist