SBOM をアップロードする

このページでは、ソフトウェア部品構成表(SBOM)ファイルを Cloud Storage にアップロードして、Artifact Registry に保存するコンテナ イメージのコンポーネントを追跡して証明する方法について説明します。

Cloud Storage の料金については、料金をご覧ください。

始める前に

  1. Google アカウントにログインします。

    Google アカウントをまだお持ちでない場合は、新しいアカウントを登録します。

  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Artifact Registry, Container Analysis APIs, if any are not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the APIs

  5. Install the Google Cloud CLI.

  6. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  7. To initialize the gcloud CLI, run the following command:

    gcloud init
  8. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  9. Verify that billing is enabled for your Google Cloud project.

  10. Enable the Artifact Registry, Container Analysis APIs, if any are not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the APIs

  11. Install the Google Cloud CLI.

  12. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  13. To initialize the gcloud CLI, run the following command:

    gcloud init
  14. Artifact Registry に、SBOM に記述されているコンテナ イメージを含む Docker リポジトリがある。Artifact Registry に習熟されていない場合は、Docker のクイックスタートをご覧ください。
  15. サポートされている形式のいずれかでアップロードする SBOM ファイルを用意します。

必要なロール

Cloud Storage バケットと SBOM ファイルの作成と管理に必要な権限を取得するには、プロジェクトに対する次の IAM ロールを付与するよう管理者に依頼してください。

  • デフォルトの Cloud Storage バケットを使用している場合、ストレージ バケットを管理するには、ストレージ管理者(roles/storage.admin)
  • Cloud Storage バケットを指定する場合は、ストレージ バケットを管理する: ストレージ オブジェクト管理者(roles/storage.objectAdmin)
  • SBOM 参照のメモがすでに存在する場合: Container Analysis メモ添付者 (roles/containeranalysis.notes.attacher)
  • 現在のプロジェクトで SBOM 参照オカレンスの新しいメモを作成する: Container Analysis メモ編集者((roles/containeranalysis.notes.editor)
  • SBOM 参照オカレンスを作成する: Container Analysis のオカレンスの編集者(roles/containeranalysis.occurrences.editor)

ロールの付与については、プロジェクト、フォルダ、組織へのアクセス権の管理をご覧ください。

必要な権限は、カスタムロールや他の事前定義ロールから取得することもできます。

サポートされているファイル形式

SBOM ファイルは、次のいずれかの形式の JSON ファイルである必要があります。

SBOM をアップロードする

次のコマンドを使用して SBOM をアップロードします。

gcloud artifacts sbom load /
    --source SOURCE /
    --uri URI

ここで

  • SOURCE: アップロードする SBOM ファイルのパス。
  • URI: SBOM ファイルが記述する Docker イメージの URI。イメージは、タグ形式またはダイジェスト形式で指定できます。タグ形式で指定されたイメージは、ダイジェスト形式に解決されます。

オプション フラグ

  • --destination: デフォルトのバケットの代わりに使用する Cloud Storage バケットを指定します。
  • --kms-key-version: SBOM 参照オカレンス ペイロードに署名する鍵バージョンを提供します。この鍵を使用して、SBOM の送信元を確認できます。

たとえば、次のコマンドは、タグ付きイメージ us-east1-docker.pkg.dev/my-image-repo/my-image から生成された JSON ファイル my-sbom.bom.json をアップロードし、my-key/cryptoKeyVersions/1 で終わる KMS 鍵バージョンで SBOM 参照オカレンスに署名します。

gcloud artifacts sbom load /
--source=my-sbom.bom.json
--uri=us-east1-docker.pkg.dev/my-image-repo/my-image
--kms-key-version=projects/my-project/locations/us/keyRings/my-key-ring/cryptoKeys/my-key/cryptoKeyVersions/1

次のコマンドは、イメージ ダイジェスト my-local-image@sha256:abcxyz に関連付けられている JSON ファイル my-sbom.spdx.json をアップロードし、Cloud Storage バケット gs://my-sbom-bucket に保存します。

gcloud artifacts sbom load /
    --source=my-sbom.spdx.json /
    --uri=my-local-image@sha256:abcxyz /
    --destination=gs://my-sbom-bucket

Artifact Analysis は SBOM を Cloud Storage にアップロードし、SBOM 参照オカレンスを作成します。

SBOM を表示するには、 Google Cloud コンソールまたは gcloud CLI を使用します。SBOM を含む Cloud Storage バケットを見つけるには、gcloud CLI を使用して SBOM を検索する必要があります。

次のステップ