Skip to content
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): change error to warning for multiple OSes #6541

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Apr 23, 2024

Description

This PR shows a warning message for multiple OSes in SBOM rather than returning an error. It's a kind of workaround that allows KBOM scanning to be done successfully.

Before

$ trivy sbom ./sbom-k8s-cluster.json
2024-04-23T10:49:22+04:00       INFO    Vulnerability scanning is enabled
2024-04-23T10:49:22+04:00       INFO    Detected SBOM format    format="cyclonedx-json"
2024-04-23T10:49:22+04:00       FATAL   Fatal error     sbom scan error: scan error: scan failed: failed analysis: SBOM decode error: failed to decode: failed to decode components: multiple OS components are not supported

After

$ trivy sbom ./sbom-k8s-cluster.json
2024-04-23T11:06:41+04:00       INFO    Vulnerability scanning is enabled
2024-04-23T11:06:41+04:00       INFO    Detected SBOM format    format="cyclonedx-json"
2024-04-23T11:06:41+04:00       WARN    [sbom] Multiple OS components are not supported, taking the first one and ignoring the rest
2024-04-23T11:06:41+04:00       WARN    No OS package is detected. Make sure you haven't deleted any files that contain information about the installed packages.
2024-04-23T11:06:41+04:00       WARN    e.g. files under "/lib/apk/db/", "/var/lib/dpkg/" and "/var/lib/rpm"
2024-04-23T11:06:41+04:00       INFO    Detected OS     family="bottlerocket os" version="1.19.2"
2024-04-23T11:06:41+04:00       WARN    Unsupported os  family="bottlerocket os"
2024-04-23T11:06:41+04:00       INFO    Number of language-specific files       num=3
2024-04-23T11:06:41+04:00       INFO    [kubernetes] Detecting vulnerabilities...

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Signed-off-by: knqyf263 <knqyf263@gmail.com>
@knqyf263 knqyf263 self-assigned this Apr 23, 2024
Signed-off-by: knqyf263 <knqyf263@gmail.com>
@knqyf263 knqyf263 marked this pull request as ready for review April 23, 2024 08:12
Copy link
Contributor

@DmitriyLewen DmitriyLewen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@chen-keinan chen-keinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knqyf263 did quick test and it look that it solve the issue

@knqyf263 knqyf263 added this pull request to the merge queue Apr 24, 2024
Merged via the queue into aquasecurity:main with commit d2d4022 Apr 24, 2024
14 checks passed
@knqyf263 knqyf263 deleted the fix/multi_os branch April 24, 2024 07:16
knqyf263 added a commit that referenced this pull request Apr 24, 2024
Signed-off-by: knqyf263 <knqyf263@gmail.com>
knqyf263 added a commit that referenced this pull request Apr 24, 2024
Signed-off-by: knqyf263 <knqyf263@gmail.com>
fl0pp5 pushed a commit to altlinux/trivy that referenced this pull request May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple OS components in SBOM are not supported properly
3 participants