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): fix wrong overwriting of applications obtained from different sbom files but having same app type #8052

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Dec 5, 2024

Description

We don't save FilePath for app with aggregatedTypes.
That is why we overwrite apps with same types.
See more in #7851

This PR adds filepath (path to the SBOM file) for Apps got from SBOM analyzer.
This helps with overwriting when merging layers.

Example:

FROM alpine

COPY ./api/report-api.spdx.json /api/report-api.spdx.json

COPY ./core/report-core.spdx.json /core/report-core.spdx.json

before:

➜ trivy -q image test:7846 -f json --list-all-pkgs --pkg-types library --cache-backend memory | grep -E '"ID"|"FilePath"'
          "ID": "org.apache.logging.log4j:log4j-core:2.24.1",
          "FilePath": "log4j-core-2.24.1.jar"

after:

➜ ./trivy -q image test:7846 -f json --list-all-pkgs --pkg-types library --cache-backend memory | grep -E '"ID"|"FilePath"'
          "ID": "org.apache.logging.log4j:log4j-api:2.24.1",
          "FilePath": "log4j-api-2.24.1.jar"
          "ID": "org.apache.logging.log4j:log4j-core:2.24.1",
          "FilePath": "log4j-core-2.24.1.jar"

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).

@DmitriyLewen DmitriyLewen self-assigned this Dec 5, 2024
@DmitriyLewen DmitriyLewen changed the title feat fix wrong overwriting apps got from different sbom files, but with same type fix(sbom): fix wrong overwriting of applications obtained from different sbom files but having same app type Dec 5, 2024
@DmitriyLewen
Copy link
Contributor Author

DmitriyLewen commented Dec 5, 2024

@knqyf263
Looks like i found workaround/solution for #7851.
Take a look, when you have time.

@DmitriyLewen DmitriyLewen marked this pull request as ready for review December 5, 2024 10:08
@knqyf263 knqyf263 added this pull request to the merge queue Dec 5, 2024
Merged via the queue into aquasecurity:main with commit fd07074 Dec 5, 2024
15 of 16 checks passed
@DmitriyLewen DmitriyLewen deleted the fix/add-path-for-aggregated-apps-from-sbom branch December 6, 2024 06:09
@DmitriyLewen
Copy link
Contributor Author

@aqua-bot backport release/v0.58

@aqua-bot
Copy link
Contributor

Backport PR created: #8124

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.

bug(sbom): Trivy overwrites Applications when multiple sbom files contain aggregated language type
3 participants