本文說明如何建立安全漏洞可利用性交換 (VEX) 陳述式。
每當容器映像檔推送至 Artifact Registry 時,Artifact Analysis 就能儲存相關聯的 VEX 陳述式。VEX 是一種安全建議,可指出產品是否受到已知安全漏洞影響。
每份對帳單都會提供下列資訊:
- VEX 聲明發布者
- 撰寫聲明的構件
- 任何已知安全漏洞的安全漏洞評估 (VEX 狀態)
軟體發布商可以建立 VEX 陳述,說明應用程式的安全防護機制。VEX 陳述書會記錄特定構件中發現的任何安全漏洞,並提供相關背景資訊,說明這些安全漏洞對客戶或監管機構的影響。
安全性和政策執行人員可以利用 VEX 狀態,對軟體供應鏈中的風險進行分類,並使用 VEX 陳述聲明驗證構件的組成,協助機構滿足法規要求。
VEX 狀態
VEX 狀態會指出構件是否受到已知的安全漏洞影響。
狀態可以是下列其中一種:
- 不受影響:您不必針對這個安全漏洞採取任何修復措施。
- 受影響:建議採取修復措施。
- 已修正:這個版本的產品已套用修正措施來因應安全漏洞。
- 調查中:尚未確定這個產品的狀態。發布商會在後續版本中提供最新狀態。
事前準備
-
Sign in to your Google Account.
If you don't already have one, sign up for a new account.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Container Analysis, Artifact Registry APIs.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Container Analysis, Artifact Registry APIs.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
- 在 Artifact Registry 存放區中儲存容器映像檔,或建立存放區並推送映像檔。
-
如要建立及更新附註:
Container Analysis Notes Editor (
roles/containeranalysis.notes.editor
) - PRODUCT_NAME 圖片中產品的使用者可解讀名稱。 採用字串值。值應為產品的完整標準名稱,包括版本號碼和其他屬性。
- LOCATION 是存放區的地區或多地區位置。
- PROJECT_ID 是包含存放區的專案 ID。
- REPO_NAME 是 Artifact Registry 中的 Docker 存放區名稱。
- IMAGE_NAME 是映像檔的名稱。
- CVE_ID 是安全漏洞的 ID,例如
CVE-2017-11164
。 - PRODUCT_STATUS 是指安全風險評估。
構件分析支援四種狀態類型:
known_affected
、known_not_affected
、under_investigation
和fixed
。
必要的角色
如要取得上傳 VEX 評估結果及查看安全漏洞 VEX 狀態所需的權限,請要求管理員授予您專案的下列 IAM 角色:
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
建立 VEX 陳述
構件分析支援 JSON 格式的常見安全諮詢格式 (CSAF) 2.0 標準。如要產生新的 VEX 陳述式,請使用 CSAF 架構。
以下範例是 Artifact Registry 中映像檔的 VEX 陳述式,其中一個 cve
分支代表已知的安全漏洞。
您必須為每個 CVE 定義 product_status
的值。
{
"document": {
"csaf_version": "2.0",
"lang": "en-US",
"publisher": {
"name": "Sample-Company",
"namespace": "https://sample-company.com"
},
"title": "Vex document 1.1"
},
"product_tree": {
"branches": [
{
"name": "https://LOCATION-docker.pkg.dev/PROJECT_ID/REPO_NAME/IMAGE_NAME",
"product": {
"name": "PRODUCT_NAME",
"product_id": "IMAGE_NAME"
}
}
]
},
"vulnerabilities": [
{
"cve": "CVE_ID",
"product_status": {
"PRODUCT_STATUS": [
"IMAGE_NAME"
]
}
}
]
}
地點
如要在 VEX 陳述中列出每項安全漏洞,都必須建立 cve
分支並定義 product_status
的值。
product_tree.branches.name
中 name
欄位的值是圖片 URI。加入這個值可將 VEX 陳述式與特定 Docker 映像檔建立關聯。