提供意見
認證斷言
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如要進一步瞭解如何使用認證聲明,請參閱建立認證政策 。
下表詳細列出可用於建構認證政策的判斷。他們可以驗證 Confidential Space 映像檔、工作負載容器和 VM 所做的判斷。
圖片聲明
斷言
類型
說明
assertion.dbgstat
互動對象:
定義的字串
確認 Confidential Space 映像檔是偵錯或正式版。
有效值如下:
enable
:確認使用的是偵錯圖片。
disabled-since-boot
:確認使用的是正式版圖片。
範例
下列程式碼會驗證是否使用 Confidential Space 映像檔的偵錯版本:
assertion.dbgstat == "enable"
下列程式碼會驗證是否使用 Confidential Space 映像檔的正式版:
assertion.dbgstat == "disabled-since-boot"
assertion.submods.confidential_space.support_attributes
字串陣列
驗證 TEE 的安全版本是否為正式版 Confidential Space 映像檔。偵錯機密空間映像檔未設定支援屬性。
支援的屬性有三種:
LATEST
:這是最新版圖片,且系統支援此版本。LATEST
圖片也STABLE
USABLE
。
STABLE
:這個版本的映像檔受到支援,且會監控是否有安全漏洞。STABLE
圖片也是 USABLE
。
USABLE
:只有這項屬性的映像檔已停止支援,且不再監控是否有安全漏洞。您必須自行承擔使用風險。
注意 :由於 Confidential Space 預設符記每小時會重新整理,因此不建議為長時間執行的工作負載指定 LATEST
。工作負載執行期間,Confidential Space
映像檔可能會更新,這表示工作負載不再是最新版本,因此無法通過認證。
範例
下列程式碼會驗證是否使用穩定版本的 Confidential Space 映像檔:
"STABLE" in assertion.submods.confidential_space.support_attributes
assertion.swname
定義的字串
驗證認證實體執行的軟體。值一律為 CONFIDENTIAL_SPACE
。
範例
assertion.swname == "CONFIDENTIAL_SPACE"
assertion.swversion
字串陣列
驗證 Confidential Space 映像檔的軟體版本。建議改用 assertion.submods.confidential_space.support_attributes
,以便指定最新版本的映像檔。
範例
int(assertion.swversion[0]) == 230103
容器斷言
斷言
類型
說明
assertion.submods.container.cmd_override
互動對象:
字串陣列
驗證工作負載映像檔中使用的
CMD 指令和參數。
範例
下列程式碼會驗證工作負載映像檔的 CMD 是否遭到覆寫:
size(assertion.submods.container.cmd_override) == 0
下列程式碼會驗證 program
是否為 CMD 覆寫中的唯一內容:
assertion.submods.container.cmd_override == ['program']
assertion.submods.container.env
互動對象:
JSON 物件
確認環境變數及其值已明確傳遞至容器。
範例
下列程式碼會驗證環境變數 example-env-1
是否設為 value-1
,以及 example-env-2
是否設為 value-2
。
assertion.submods.container.env == {"example-env-1": "value-1", "example-env-2": "value-2"}
assertion.submods.container.env_override
互動對象:
字串
確認工作負載運算子是否已覆寫容器中的環境變數。
範例
下列程式碼會驗證工作負載運算子是否未覆寫 example
環境變數:
!has(assertion.submods.container.env_override.example)
下列程式碼會驗證工作負載運算子是否覆寫任何環境變數:
size(assertion.submods.container.env_override) == 0
assertion.submods.container.image_digest
字串
驗證工作負載容器的映像檔摘要。指定這項條件後,多方就能同意授權工作負載存取資料。
範例
assertion.submods.container.image_digest == "sha256:837ccb607e312b170fac7383d7ccfd61fa5072793f19a25e75fbacb56539b86b"
assertion.submods.container.image_id
字串
驗證工作負載容器的映像檔 ID。
範例
assertion.submods.container.image_id == "sha256:652a44b0e911271ba07cf2915cd700fdfa50abd62a98f87a57fdebc59843d93f"
assertion.submods.container.image_reference
互動對象:
字串
驗證在 Confidential Space 映像檔上執行的工作負載容器位置。
範例
assertion.submods.container.image_reference == "us-docker.pkg.dev/PROJECT_ID/WORKLOAD_CONTAINER:latest"
assertion.submods.container.image_signatures
互動對象:
JSON 物件
驗證圖片是否具有特定簽章,或是否由公開金鑰和簽章演算法簽署。指定這項條件後,多方就能同意授權工作負載存取資料。
判斷可包含下列元素:
key_id
:公開金鑰的十六進位指紋。如要取得指紋,請執行下列指令:
openssl pkey -pubin -in public_key.pem -outform DER | openssl sha256
其中 public_key.pem
是 PEM 格式的公開金鑰。
signature
:與已簽署容器相關聯的酬載簽章,且遵循
簡易簽署格式 。
signature_algorithm
:用於簽署金鑰的演算法。可以是下列其中一項:
RSASSA_PSS_SHA256
(RSASSA-PSS,具有
SHA-256 摘要)
RSASSA_PKCS1V15_SHA256
(RSASSA-PKCS1 v1_5
搭配 SHA-256 摘要)
ECDSA_P256_SHA256
(具有 SHA-256 摘要之 P-256 曲線的 ECDSA)
範例
assertion.swname == 'CONFIDENTIAL_SPACE' && ['ECDSA_P256_SHA256:PUBLIC_KEY_FINGERPRINT '].exists(fingerprint, fingerprint in assertion.submods.container.image_signatures.map(sig, sig.signature_algorithm+':'+sig.key_id)) && 'serviceaccount.iam.gserviceaccount.com' in assertion.google_service_accounts"
assertion.submods.container.restart_policy
互動對象:
定義的字串
驗證容器啟動器的重新啟動政策,以瞭解工作負載停止時的行為。
有效值如下:
Never
(預設)
Always
OnFailure
範例
assertion.submods.container.restart_policy == "Never"
VM 聲明
斷言
類型
說明
assertion.google_service_accounts
互動對象:
字串陣列
確認指定服務帳戶已連線至執行工作負載的 VM,或已使用 VM 中繼資料的
tee-impersonate-service-accounts
列出。
範例
workload-service-account@my-project.iam.gserviceaccount.com in assertion.google_service_accounts
assertion.hwmodel
字串
驗證基礎機密運算技術。支援的平台如下:
範例
assertion.hwmodel == "GCP_AMD_SEV"
assertion.submods.confidential_space.monitoring_enabled
互動對象:
布林值
驗證認證實體的監控狀態。
範例
assertion.submods.confidential_space.monitoring_enabled.memory == true
assertion.submods.gce.instance_id
字串
驗證 VM 執行個體 ID。
範例
assertion.submods.gce.instance_id == "0000000000000000000"
assertion.submods.gce.instance_name
字串
驗證 VM 執行個體的名稱。
範例
assertion.submods.gce.instance_name == "workload-vm"
assertion.submods.gce.project_id
字串
驗證 VM 執行的 Google Cloud 專案是否具有指定的專案 ID。
範例
assertion.submods.gce.project_id == "project-id"
assertion.submods.gce.project_number
字串
驗證 VM 是否在具有指定專案編號的 Google Cloud 專案中執行。
範例
assertion.submods.gce.project_number == "00000000000"
assertion.submods.gce.zone
互動對象:
字串
確認 VM 是否在指定區域中執行。
範例
assertion.submods.gce.zone == "us-central1-a"
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-11 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-11 (世界標準時間)。"],[[["Attestation policies can validate assertions made by the Confidential Space image, the workload container, and the VM, using a variety of assertions."],["Image assertions, such as `assertion.dbgstat` and `assertion.submods.confidential_space.support_attributes`, verify the software version and security attributes of the Confidential Space image."],["Container assertions, such as `assertion.submods.container.cmd_override` and `assertion.submods.container.env`, verify the configuration and integrity of the workload container, including environment variables and command overrides."],["VM assertions, including `assertion.google_service_accounts` and `assertion.hwmodel`, verify details about the virtual machine environment, such as service accounts, hardware model, and project information."],["The table provided lists a multitude of assertions that can be used to create and enforce an attestation policy, with each assertion's type and a specific description."]]],[]]