本文說明如何建立 Vulnerability Exploitability eXchange (VEX) 陳述式。
對於推送至 Artifact Registry 的每個容器映像檔,Artifact Analysis 都能儲存相關聯的 VEX 聲明。VEX 是一種安全性諮詢,可指出產品是否受到已知安全漏洞的影響。
每份對帳單都會提供下列資訊:
- VEX 聲明的發布者
- 撰寫聲明的構件
- 任何已知安全漏洞的評估結果 (VEX 狀態)
軟體發布商可以建立 VEX 聲明,說明應用程式的資安態勢。VEX 聲明會註明在特定構件中發現的任何安全漏洞,並提供相關背景資訊,說明這些漏洞對客戶或監管機構的影響。
資安和政策執行人員可使用 VEX 狀態,對軟體供應鏈中的風險進行分類,並使用 VEX 聲明證明構件的組成,協助組織符合法規要求。
VEX 狀態
VEX 狀態會指出構件是否受到已知的安全漏洞影響。
狀態可以是下列其中一種:
- 不受影響:您不必針對這個安全漏洞採取任何修復措施。
- 受影響:建議採取修復措施。
- 已修正:這個版本的產品已套用修正措施來處理安全漏洞。
- 調查中:尚未確定這個產品的狀態。發布商會在後續版本中提供最新狀態。
事前準備
-
登入 Google 帳戶。
如果還沒有帳戶,請 申請新帳戶。
-
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Container Analysis, Artifact Registry APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. 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.-
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.
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Container Analysis, Artifact Registry APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. 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.-
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 存放區中,或建立存放區並推送映像檔。
必要的角色
如要取得上傳 VEX 評估及檢查安全漏洞 VEX 狀態所需的權限,請要求管理員授予您專案的下列 IAM 角色:
-
如要建立及更新附註:容器分析附註編輯者 (
roles/containeranalysis.notes.editor)
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
建立 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"
]
}
}
]
}
地點
- 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 陳述中列出每項安全漏洞,您必須建立 cve 分支,並定義 product_status 的值。
product_tree.branches.name 中 name 欄位的值是圖片 URI。加入這個值可將 VEX 聲明與特定 Docker 映像檔建立關聯。
後續步驟
- 上傳 VEX 聲明:上傳現有的 VEX 聲明,或是其他發布者提供的 VEX 聲明。
- 使用 VEX 判斷安全漏洞問題的優先順序。瞭解如何查看 VEX 陳述式,以及依 VEX 狀態篩選安全漏洞。