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(redhat): include arch in PURL qualifiers #7654

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Oct 4, 2024

Description

If arch is not included in the PURL, the CycloneDX BOM-Ref will conflict and the UUID will be used.

Before

$ TRIVY_EXPERIMENTAL_RPM_ARCHIVE=true ./trivy fs -q /tmp/rhel7 -f cyclonedx | jq '.components[]."bom-ref"'
"1b4f1e8d-5ab2-4cc1-82ee-e6a3e1c01d0f"
"3d5fbe66-61ae-4e94-99a3-a0733bb02f23"
"40b75c7a-c905-4705-bb0e-1d10a928100b"
"6945ac93-e8ea-4206-86e2-d9ecc535a831"
"6a99e954-0bab-400b-b1cb-41aa05e0d98a"
"d20ed80e-2bb9-4b31-87cf-29effae1f56b"
"f11347f2-5bd0-44c7-9bdf-a675e34348a9"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/bind-chroot@32%3A9.11.4-26.P2.el7"
"pkg:rpm/redhat/bind@32%3A9.11.4-26.P2.el7"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/cups@1%3A1.6.3-51.el7"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/dhcp@12%3A4.2.5-82.el7"
"pkg:rpm/redhat/[email protected]"
"pkg:rpm/redhat/[email protected]_1"

After

$ TRIVY_EXPERIMENTAL_RPM_ARCHIVE=true ./trivy fs -q /tmp/rhel7 -f cyclonedx | jq '.components[]."bom-ref"'
"b4212da9-d0c1-4a65-9aea-af375e90b97d"
"pkg:rpm/redhat/[email protected]?arch=noarch"
"pkg:rpm/redhat/[email protected]?arch=i686"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/bind-chroot@32%3A9.11.4-26.P2.el7?arch=x86_64"
"pkg:rpm/redhat/bind@32%3A9.11.4-26.P2.el7?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/cups@1%3A1.6.3-51.el7?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/dhcp@12%3A4.2.5-82.el7?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=noarch"
"pkg:rpm/redhat/[email protected]?arch=i686"
"pkg:rpm/redhat/[email protected]?arch=x86_64"
"pkg:rpm/redhat/[email protected]_1?arch=x86_64"
"pkg:rpm/redhat/[email protected]?arch=i686"
"pkg:rpm/redhat/[email protected]?arch=x86_64"

Related PRs

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

@knqyf263 knqyf263 self-assigned this Oct 4, 2024
packageurl.Qualifiers{
{
Key: "arch",
Value: pkg.Arch,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure - does the Arch field always exist?
I'm worried about the case when pkg.Arch is missing. Then we'll see a case like pkg:rpm/redhat/[email protected]?arch="

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe it doesn't happen, but I added a check just in case.

Signed-off-by: knqyf263 <[email protected]>
@knqyf263 knqyf263 marked this pull request as ready for review October 7, 2024 10:01
@knqyf263 knqyf263 requested a review from DmitriyLewen October 7, 2024 10:02
@knqyf263
Copy link
Collaborator Author

knqyf263 commented Oct 7, 2024

@DmitriyLewen It passed tests after some retries.

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

@knqyf263 knqyf263 added this pull request to the merge queue Oct 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 7, 2024
@knqyf263 knqyf263 added this pull request to the merge queue Oct 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 7, 2024
@knqyf263 knqyf263 added this pull request to the merge queue Oct 7, 2024
Merged via the queue into aquasecurity:main with commit a585e95 Oct 7, 2024
12 checks passed
@knqyf263 knqyf263 deleted the fix/add_rpm_arch branch October 7, 2024 12:25
@knqyf263
Copy link
Collaborator Author

@aqua-bot backport release/v0.56

@aqua-bot
Copy link
Contributor

Backport PR created: #7702

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.

3 participants