Reuse embedded per-platform SBOMs and consolidate duplicate generation

未关闭
#1,571 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
devops, docker, github-actions, shell

调研方向

Start by reading .github/workflows/wc-build-push.yml around platform SBOM generation, index merge, and the standalone scan; then inspect the inventory script and helpers/add-sbom-note/add-sbom-note.sh. Reproduce the documented registry inspection for the immutable sample index and compare embedded SPDX with standalone Syft output. Done means tested, validated per-platform extraction and coverage mappings preserve all consumers, with redundant scanning removed only where equivalent.

由索引模型根据 Issue 内容生成。

描述

Goal

Use the existing per-platform BuildKit SBOMs as the canonical source wherever they meet consumer requirements, prove their coverage survives image assembly, and remove redundant post-build scanning without losing release SBOMs, dependency snapshots, or curated tool inventory.

This is not a request to add another scanner or assume platform SBOM generation is missing. Cryptographic signing and verification remain in philips-software/amp-devcontainer#1135.

Findings: two SBOM producers, not a Trivy multi-platform SBOM

Source inspected at af840070c907d71ce06334ea65eded00dc3946a4. Recheck before implementation.

Path Current behavior Consumers
docker/build-push-action, sbom: true BuildKit generates SPDX evidence during each platform build, attached through attestation manifests Image consumers via registry/index
anchore/sbom-action in merge-image Runs Syft again against the merged index without explicit platform selection; writes sbom.spdx.json Workflow/release assets, GitHub dependency snapshot, optional curated inventory
Scheduled crazy-max/ghaction-container-scan Trivy vulnerability scanning with JSON/SARIF outputs; workflow does not configure SPDX/CycloneDX generation or a platform matrix GitHub code-scanning reports

BuildKit uses its Syft scanner by default unless a generator is overridden; none is specified here. The standalone action also runs Syft. Syft's documented default for an index is linux/amd64, not a scan of all its platforms. Thus there is overlapping generation, but the outputs may differ because of scanner versions/configuration: they must be compared before one is removed.

Real registry evidence

Read-only inspection of public ghcr.io/philips-software/amp-devcontainer-base:edge resolved index:

sha256:5dd8934f7527dbc675901f87357e8d235e4eab480c25ed2facbeaa4a058121f3

Platform Image manifest digest Embedded SPDX blob digest
linux/amd64 sha256:19a6a003b06ce3e87059d7eb1c035690cc76ada378a1b2d0e860c74279bcbe5b sha256:edf7c16c124ed939bdaf497489d4001411461944208e62101cde41844572ecf3
linux/arm64 sha256:e6308bce07ca214048ad4a4ff960f6ea10824be91d8af2779546b44facf38e49 sha256:efeefb25024ce2c3db4f4ffeddb5527643072e9e3490420bed18d4613f0626a1

Both embedded statements:

  • Have predicateType: https://spdx.dev/Document and spdxVersion: SPDX-2.3.
  • Identify their corresponding platform manifest as the subject.
  • Report creators syft-v1.51.0 and buildkit-v0.34.2.
  • Contain 336 package entries each. Equal counts do not imply identical packages or architecture-independent coverage.

The index therefore already contains an SBOM for each of these two platforms. This proves that sample's coverage and assembly preservation, not every flavor or historical release. The evidence is an in-toto statement stored in the image index, not by itself a cryptographically signed GitHub/Sigstore attestation.

Reproduce without pulling runnable image layers:

image='ghcr.io/philips-software/amp-devcontainer-base@sha256:5dd8934f7527dbc675901f87357e8d235e4eab480c25ed2facbeaa4a058121f3'
docker buildx imagetools inspect "${image}" --raw \
  | jq '.manifests[] | {digest, platform, annotations}'
docker buildx imagetools inspect "${image}" --format '{{json .SBOM}}' \
  | jq 'to_entries[] | {
      platform: .key,
      creators: .value.SPDX.creationInfo.creators,
      packages: (.value.SPDX.packages | length)
    }'

The evidence above was obtained through read-only registry API requests, with descriptor/blob SHA256 checks and subject-to-platform checks. The Docker commands are the documented equivalent inspection path.

Starting points

Implementation requirements

  1. Inventory required platforms from the actual runnable image descriptors of the immutable final index. Do not hard-code only the observed architectures or mistake attestation descriptors with unknown/unknown for runnable platforms.
  2. Resolve and extract existing embedded SPDX predicates through their attestation manifests. Validate descriptor/blob digests, statement subject, platform association, expected predicate/schema, and nonempty usable package data. Preserve relationships back to the final index. Use supported registry tooling and the existing authentication model for GHCR and external registries.
  3. Emit a deterministic coverage manifest mapping final index digest → platform → runnable manifest digest → SBOM file/digest and generator metadata. Preserve separate platform documents; do not concatenate package lists into a document that silently conflates architectures or discards differing versions.
  4. Compare extracted output with the current standalone Syft output on representative images, including custom ELF notes, manually installed tools, purls, versions, and SPDX relationships. Reuse the embedded source when it meets the contract. If a necessary cataloger/configuration difference exists, align the build-time generator where feasible; retain a second scan only with demonstrated necessity and documented scope.
  5. Preserve every consumer before removing anchore/sbom-action: workflow artifacts, release attachments, dependency snapshots, curated inventory, and signing inputs for philips-software/amp-devcontainer#1135. File extraction and format conversion do not require rescanning the image filesystem.
  6. Make platform scope explicit for consumers that currently accept one document. Keep their existing compatibility contract with an explicitly identified platform or extend it deliberately with migration guidance. Do not silently flatten conflicting per-platform tool versions, overwrite release assets, or drop dependency information. Ensure outputs have unique flavor/platform names and stable digest mappings.
  7. Prefer extraction and reuse, not a new scan for every platform. Missing/corrupt/mismatched expected SBOMs must fail the evidence gate clearly; do not silently substitute the host platform's scan and report complete coverage.
  8. Document generation versus extraction versus signing, expected final-filesystem coverage, and any build-stage/context limitations. Update requirement/test traceability and consumer documentation. Preserve provenance generation and verification.

Required tests

  • A multi-platform fixture has architecture-distinct packages/versions. Every runnable platform gets the correct extracted document and subject mapping after index assembly.
  • Missing platform SBOM, incorrect subject, altered blob, unsupported/malformed document, duplicate/conflicting candidates, and missing registry permissions fail with actionable diagnostics.
  • Extraction handles attestation descriptors without treating them as platforms and works with immutable index references rather than mutable-tag races.
  • Existing curated tools, including custom ELF-note packages, remain discoverable; existing consumer tests pass and platform conflicts are not silently deduplicated.
  • Release assets and workflow artifacts contain the expected uniquely named documents; dependency snapshots remain valid; signed predicates can consume the same canonical files without regeneration.
  • Demonstrate coverage across supported flavors/platforms using a justified shared-workflow test matrix and representative real evidence.
  • Show removal of the redundant standalone scan, or record the measured functional reason for any retained scan. Run relevant workflow lint and integration checks.

Acceptance criteria

  • Existing platform coverage is proven and continuously checked, rather than assumed missing or complete.
  • Canonical per-platform SBOMs and index/platform/digest mappings are available to downstream consumers.
  • Redundant generation is removed where equivalent; any retained second scan has an evidenced purpose.
  • Release artifacts, dependency snapshots, tool inventory, and provenance keep their intended behavior.
  • No platform conflation, unsigned-as-signed claim, or unnecessary additional scanning is introduced.
  • Automated positive/negative tests and consumer documentation cover the chosen design.

Coordination

This issue owns canonical SBOM selection, extraction, coverage checks, and consolidation. philips-software/amp-devcontainer#1135 owns cryptographic signing/verification of those documents; it must not treat index attachment alone as sufficient. This issue can complete without waiting for signing, avoiding a circular dependency.

Follow philips-software/amp-devcontainer#1134 for retention of platform subjects and associated registry evidence. Broader vulnerability-scanner coverage is not required here; do not remove the scheduled Trivy scan merely because SBOM generation is consolidated.

References

主要语言
Shell
星标
136
派生
8
平均合并
17 小时 19 分钟
30 天内合并 PR
53

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

philips-software/amp-devcontainer 的其他 Issue

查看 philips-software/amp-devcontainer 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。