-
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
fix(sbom): add SBOM file's filePath as Application FilePath if we can't detect its path #8346
base: main
Are you sure you want to change the base?
fix(sbom): add SBOM file's filePath as Application FilePath if we can't detect its path #8346
Conversation
for i, app := range bom.Applications { | ||
if slices.Contains(ftypes.AggregatingTypes, app.Type) && app.FilePath == "" { | ||
if app.FilePath == "" { | ||
bom.Applications[i].FilePath = input.FilePath |
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 didn't add the type prefix (as we discussed in #7556 (reply in thread)) because name
is not a unique field (for CycloneDX and SPDX), so we can use the same name for multiple components.
docs/docs/target/container_image.md
Outdated
Trivy can search for Software Bill of Materials (SBOMs) among container image files and scan for vulnerabilities for components in these files. | ||
|
||
!!!note | ||
There are cases where Trivy can't detect the file path for Applications from third-party SBOM files. |
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.
Applications
is a kind of internal term as it is capitalized. We should explain this note without the context we maintainers have. We can reference the definition of applications.
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.
We can use something like There are cases where Trivy can't detect the file path of software components from third-party SBOM files.
wdyt?
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.
There are two cases:
- Cannot detect the file path of application paths having library components (e.g., Go binary)
- Cannot detect the file path of library components (e.g., .gemspec)
Am I correct? Do you think "software components" describe that enough?
For these, Trivy uses the SBOM file path as the Application file path
We also need to rephrase this sentence.
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 realized that it is better to write documents in the morning 😄
I updated the docs - 7dc1ca2
I think this should be clear to all users now.
Description
There are cases when we can't determine the FilePath of the application from the SBOM file (see #7556 (comment)).
So we need to add the FilePath of the SBOM file as the Application FilePath to avoid an empty Target (and an empty
name
field for the SBOM component, which makes the SBOM file invalid))example:
before:
after:
Related issues
Target
for some SBOM files in image #8189Checklist