使用 Red Hat Trusted Profile Analyzer 检查您的 SBOM


Red Hat Advanced Developer Suite - software supply chain 1.7

了解如何扫描 SBOM,以获取有关应用程序安全状态的可操作信息。

Red Hat Customer Content Services

摘要

本文档提供有关如何查看 SBOM 以获取有关应用程序安全状态的可操作信息。

前言

当 Red Hat Advanced Developer Suite - 软件供应链构建应用程序镜像时,它还提供软件材料清单(SBOM)。SBOM 列出镜像使用的所有软件库。您可以使用 SBOM 来识别安全漏洞。

但是,SBOM 很长,难以阅读。要将原始 SBOM 转换为可操作的信息,您可以使用 Trusted Profile Analyzer (TPA)。例如,TPA 可以识别镜像中是已知常见漏洞和漏洞(CVE)的目标的依赖关系。

第 1 章 下载、转换和分析您的 SBOM

以下流程解释了如何使用 RHTPA 检查 SBOM。具体来说,它概述了如何下载 SBOM,将 SBOM 转换为兼容格式,并分析带有 RHTPA 的 SBOM。

注意

因为 RHADS - SSC 1.7 在构建应用程序时使用任何受支持的 CI 供应商时,您不需要这个过程,因为 RHADS - SSC 1.7 会自动发布您的 SBOM 到 RHTPA。

如果您希望手动提取 SBOM 并保留本地副本,请按照以下步骤操作。

先决条件

流程

  1. 在容器 registry 中,找到您要检查其 SBOM 的容器镜像的完整地址。该地址的格式是 registry/namespace/image:tag。例如: quay.io/app/app-image:ff59e21cc…

    注意

    不要使用 SBOM 镜像的地址,该镜像以 .sbom 结尾。将镜像的地址用于实际应用。

  2. 在 CLI 中,使用 cosign 来下载 SBOM。将输出重定向到稍后可以引用的文件。确保新文件名以 .json 结尾。

    cosign download sbom quay.io/redhat/rhtap-app:8d34c03188cf294a77339b2a733b1f6811263a369b309e6b170d9b489abc0334 > /tmp/sbom.json
    Copy to Clipboard Toggle word wrap
  3. (可选)您的 SBOM 最终会出现在 RHTPA UI 中,其名称列在此 .json 文件中。默认情况下,Syft 根据 SBOM 的文件路径创建该名称。如果您希望您的 SBOM 出现在带有更有意义的名称的 RHTPA UI 中,您必须在您刚才下载的 .json 文件中手动更改它。具体来说,您必须替换 .metadata.component 对象中的名称。如果需要,您可以选择在此处添加 version 字段。

    $ vim /tmp/sbom.json
    "component": {
          "bom-ref": "fdef64df97f1d419",
          "type": "file",
          "name": "/var/lib/containers/storage/vfs/dir/3b3009adcd335d2b3902c5a7014d22b2beb6392b1958f1d9c7aabe24acab2deb" #Replace this with a meaningful name
        }
    Copy to Clipboard Toggle word wrap
  4. 运行以下命令,将 Bombastic API URL 存储为环境变量:

    $ bombastic_api_url="https://$(oc -n rhtap-tpa get route --selector app.kubernetes.io/name=bombastic-api -o jsonpath='{.items[].spec.host}')"
    Copy to Clipboard Toggle word wrap
    注意

    在这个命令和下一个命令后,请务必输入安装 RHADS - SSC 的命名空间。示例假设您使用了名为 rhtap 的命名空间。

  5. 在 CLI 中,使用以下值创建新的 token_issuer_url 环境变量:

    $ token_issuer_url=https://$(oc -n rhtap-keycloak get route --selector app=keycloak -o  jsonpath='{.items[].spec.host}')/realms/chicken/protocol/openid-connect/token
    Copy to Clipboard Toggle word wrap
  6. 设置 TPA__OIDC__WALKER_CLIENT_SECRET 环境变量,并提供您的 TPA OIDC Walker 客户端 secret 作为其值:

    $ TPA__OIDC__WALKER_CLIENT_SECRET=$(kubectl get -n rhtap secrets/rhtap-trustification-integration --template={{.data.oidc_client_secret}} | base64 -d)
    Copy to Clipboard Toggle word wrap
  7. 运行以下命令,以获取 BOMbastic API 的令牌。令牌允许您上传 SBOM。

    $ tpa_token=$(curl \
        -d 'client_id=walker' \
        -d "client_secret=$TPA__OIDC__WALKER_CLIENT_SECRET" \
        -d 'grant_type=client_credentials' \
        "$token_issuer_url" \
    | jq -r .access_token)
    Copy to Clipboard Toggle word wrap
  8. 尝试上传 SBOM。

    curl \
        -H "authorization: Bearer $tpa_token" \
        -H "transfer-encoding: chunked" \
        -H "content-type: application/json" \
        --data @/tmp/sbom.json \
        "$bombastic_api_url/api/v2/sbom?id=my-sbom"
    Copy to Clipboard Toggle word wrap
    1. 如果您收到错误消息 storage error: invalid storage content,请使用 Syft 将 SBOM 转换为更早的 CycloneDX 1.4。您可以忽略与不同 pURLs 合并软件包的警告;它们表示 Syft 可能会丢弃原始 SBOM 中的一些数据,但这些数据并不重要。

      $ syft convert /tmp/sbom.json -o cyclonedx-json@1.4=/tmp/sbom-1-4.json
      Copy to Clipboard Toggle word wrap
    2. 然后尝试再次上传 SBOM:

      $ curl \
          -H "authorization: Bearer $tpa_token" \
          -H "transfer-encoding: chunked" \
          -H "content-type: application/json" \
          --data @/tmp/sbom-1-4.json \
          "$bombastic_api_url/api/v2/sbom?id=my-sbom"
      Copy to Clipboard Toggle word wrap
  9. 通过 OpenShift 控制台访问运行 RHADS - SSC 的集群。
  10. rhtap 项目中,导航到 Networking > Routes。打开在 spog-ui 服务所在的同一行中列出的 URL。
  11. 使用 Register 按钮创建新帐户并对 RHTPA 进行身份验证。
  12. 选择 SBOM (最新上传)并查看 insights RHTPA 根据 SBOM 提供的应用程序。

    1. 进入 Dependency Analytics Report 选项卡来查看漏洞和补救。





更新于 2025-09-07

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部