Per-package SBOMs in `/var/lib/db/sbom` contain two apk components for the same package: which one should consumers use?

Đang mở
#78,757 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
shell
Lĩnh vực
devtools

Hướng nghiên cứu

Start by examining the example SPDX document structure described in the issue, especially the DESCRIBES and nested CONTAINS relationships, and trace how the per-package SBOM is generated. The issue asks maintainers to clarify why both apk components appear and which represents the package; no source files or tests are identified. Done means answering those questions and determining whether the nested component should be retained or removed.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement needs-triage

Description

Each Wolfi package ships an SPDX document in /var/lib/db/sbom/<package>-<version>.spdx.json. In the documents we
looked at, the same package appears twice as an apk component, with two different purls. Example with
libgcc-16.2.0-r1.spdx.json from cgr.dev/chainguard/wolfi-base (created by Tool: chainguard-build (v0.59.0)):

SPDX element purl sourceInfo supplier
SPDXRef-Package-apk-libgcc-16.2.0-r1 pkg:apk/wolfi/[email protected]?arch=x86_64&distro=wolfi – Organization: Wolfi
SPDXRef-Package-apk-libgcc-bc08e9c4c69fba15 pkg:apk/wolfi/[email protected]?arch=x86_64&origin=gcc acquired package info from APK DB: /.PKGINFO Organization: chainguard

Relationships:

SPDXRef-DOCUMENT                     DESCRIBES  SPDXRef-Package-apk-libgcc-16.2.0-r1
SPDXRef-Package-apk-libgcc-16.2.0-r1 CONTAINS   SPDXRef-DocumentRoot-Directory-libgcc
SPDXRef-DocumentRoot-Directory-libgcc CONTAINS  SPDXRef-Package-apk-libgcc-bc08e9c4c69fba15
SPDXRef-Package-apk-libgcc-16.2.0-r1 DESCRIBED_BY   SPDXRef-Package-Melange-gcc.yaml-…
SPDXRef-Package-apk-libgcc-16.2.0-r1 GENERATED_FROM SPDXRef-Package-Source-gitlab.com-gnutools-gcc.git-…

The first component is the package the document describes, linked to its recipe and sources. The second one is
nested under a DocumentRoot-Directory element and looks like the result of scanning the package's own contents,
which finds the package's own .PKGINFO. 18 of the 19 documents in wolfi-base have this structure; the exception is
wolfi-base-1-r7.spdx.json (single apk component).

Why it matters

Scanners that read these documents see two components for one package.
Trivy keeps one of them at random, so the same image yields different purls from one
scan to the next (aquasecurity/trivy#11362). Downstream
tools that match components by purl (e.g. carrying vulnerability analysis decisions over between versions in
Dependency-Track) then see the same package change identity.

Before changing how Trivy reads these documents, its maintainers asked us to check with you why the second component
is there and which of the two is meant to describe the package.

Questions
  1. Why does a single document contain two apk components for the same package? Is the nested one an intended part
    of the format, or a side effect of scanning the package contents?
  2. Which component should SBOM consumers treat as the description of the package? Our reading is the one targeted
    by SPDXRef-DOCUMENT DESCRIBES (distro=wolfi).
  3. If the nested component is useful (e.g. the origin= qualifier as a link to the source package), could it be
    kept in a form that consumers can tell apart; otherwise, could it be dropped from the generated documents?
Related
  • wolfi-dev/wolfictl#1409 / wolfi-dev/wolfictl#1420: wolfictl scan found two APK packages in one .apk once its contents were
    scanned (ELF package notes); the elf-package cataloger was removed from that scan. Similar effect, here from the
    package's own .PKGINFO.
  • chainguard-dev/melange#2061 (not merged): Syft scan of package contents to enrich the SBOM, which would produce
    this kind of nested component.
  • anchore/syft#3662 / #3983: other non-package components of these documents (GENERATED_FROM upstream source,
    DESCRIBED_BY recipe) imported as packages by Syft.
  • aquasecurity/trivy#9865 and #10751 (fixed): non-determinism between the apk database and these documents; this
    report is about the duplicate inside a single document.

We'll report the answer back to the Trivy discussion. Thanks!

Ngôn ngữ chính
Shell
Star
1.3k
Fork
453
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wolfi-dev/os

Tất cả issue của wolfi-dev/os

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.