Event Threat Detection 的自訂模組可讓您根據環境設定偵測參數,擴大安全監控範圍,不限於內建偵測工具。您可以建立及管理自訂模組,並查看模組產生的發現項目,找出組織、資料夾或專案記錄資料中,組織特有的威脅。
事前準備
本節說明使用 Event Threat Detection 自訂模組的需求條件。
Security Command Center Premium 和 Event Threat Detection
如要使用 Event Threat Detection 自訂模組,必須啟用 Event Threat Detection。如要啟用 Event Threat Detection,請參閱「啟用或停用內建服務」。
必要的 IAM 角色和權限
IAM 角色會決定您可以使用 Event Threat Detection 自訂模組執行的動作。
下表列出必要的 Event Threat Detection 自訂模組權限,以及包含這些權限的預先定義 IAM 角色。
您可以使用 Google Cloud 控制台或 Security Command Center API,在組織、資料夾或專案層級套用這些角色。
| 必要權限 | 角色 |
|---|---|
securitycentermanagement.eventThreatDetectionCustomModules.createsecuritycentermanagement.eventThreatDetectionCustomModules.updatesecuritycentermanagement.eventThreatDetectionCustomModules.delete |
roles/securitycentermanagement.etdCustomModulesEditorroles/securitycenter.settingsEditorroles/securitycenter.admin |
securitycentermanagement.eventThreatDetectionCustomModules.listsecuritycentermanagement.eventThreatDetectionCustomModules.getsecuritycentermanagement.effectiveEventThreatDetectionCustomModules.listsecuritycentermanagement.effectiveEventThreatDetectionCustomModules.getsecuritycentermanagement.eventThreatDetectionCustomModules.validate |
roles/securitycentermanagement.etdCustomModulesViewerroles/securitycentermanagement.etdCustomModulesEditorroles/securitycenter.adminViewerroles/securitycenter.admin |
如果在 Security Command Center 遇到存取錯誤,請向管理員尋求協助。請根據您啟用 Security Command Center 的層級,查看下列其中一個頁面:
必要記錄
請確認貴組織、資料夾和專案已啟用相關記錄。如要瞭解各個自訂模組類型需要哪些記錄,請參閱「自訂模組和範本」中的表格。
不支援 Google Cloud 以外來源的記錄。
自訂模組層級
本文使用下列術語,說明自訂模組的建立層級:
- 住宅模組
- 這個模組是在目前的檢視畫面或範圍中建立。舉例來說,如果您在 Google Cloud 控制台的組織檢視畫面中,住宅模組就是組織層級建立的模組。
- 沿用模組
- 模組是在父項檢視畫面或範圍中建立。例如,在組織層級建立的模組,在任何資料夾或專案層級都是繼承模組。
- 子系模組
- 模組是在孩童檢視模式或範圍建立。例如,在資料夾或專案層級建立的模組,在組織層級就是子系模組。
建立自訂模組
您可以透過Google Cloud 控制台建立 Event Threat Detection 自訂模組,也可以修改 JSON 範本,並透過 gcloud CLI 提交。只有在打算使用 gcloud CLI 建立自訂模組時,才需要 JSON 範本。
如需支援的模組範本清單,請參閱「自訂模組和範本」。
範本結構
範本會定義自訂模組用來識別記錄中威脅的參數。範本是以 JSON 格式編寫,結構與 Security Command Center 產生的發現項目類似。只有在打算使用 gcloud CLI 建立自訂模組時,才需要設定 JSON 範本。
每個範本都包含可自訂的欄位:
severity:要指派給這類發現項目的嚴重性或風險等級,LOW、MEDIUM、HIGH或CRITICAL。description:自訂模組的說明。recommendation:處理自訂模組產生之發現項目的應變措施建議。- 偵測參數:用於評估記錄和觸發發現項目的變數。每個模組的偵測參數不盡相同,但都包含下列一或多個參數:
domains:要監控的網域ips:要監控的 IP 位址permissions:要留意的權限regions:允許建立新 Compute Engine 執行個體的區域roles:要監控的角色accounts:要監控的帳戶- 定義允許的 Compute Engine 執行個體類型參數,例如
series、cpus和ram_mb。 - 用來檢查屬性的規則運算式,例如
caller_pattern和resource_pattern。
下列程式碼範例是 Configurable Bad IP 的 JSON 範本。
{
"metadata": {
"severity": "LOW",
"description": "Flagged by Cymbal as malicious",
"recommendation": "Contact the owner of the relevant project."
},
"ips": [
"192.0.2.1",
"192.0.2.0/24"
]
}
在上述範例中,如果記錄檔指出資源連線至 IP 位址 192.0.2.1 或 192.0.2.0/24,自訂模組就會產生低嚴重性的發現項目。
修改模組範本
如要建立模組,請選擇模組範本並加以修改。
如果您打算使用 Google Cloud CLI 建立自訂模組,則必須執行這項工作。
如果您打算使用 Google Cloud 控制台建立自訂模組,請略過這項工作。您將使用畫面上顯示的選項,修改範本的參數。
- 從「Custom modules and templates」(自訂模組和範本) 中選擇範本。
- 將程式碼複製到本機檔案。
- 更新要用於評估記錄的參數。
- 將檔案儲存為 JSON 檔案。
- 使用 JSON 檔案透過 gcloud CLI 建立自訂模組。
建立自訂模組
本節說明如何透過Google Cloud 控制台、gcloud CLI、REST API 和 Terraform 建立自訂模組。每個 Event Threat Detection 自訂模組的大小上限為 6 MB。
如要建立自訂模組,請按照下列步驟操作:
控制台
- 查看 Event Threat Detection 服務的模組。預先定義和自訂模組會顯示在清單中。
- 按一下「Create module」(建立模組)。
- 按一下要使用的模組範本。
- 按一下「選取」。
- 在「Module name」部分,輸入新範本的顯示名稱。名稱長度不得超過 128 個字元,且只能包含英數字元和底線,例如
example_custom_module。 - 選取或新增要求的參數值。每個模組的參數都不同。舉例來說,如果您選取
Configurable allowed Compute Engine region模組範本,請選取一或多個區域。或者,您也可以提供 JSON 格式的清單。 - 點選「下一步」。
- 在「Severity」(嚴重性) 部分,輸入要指派給新自訂模組所產生發現項目的嚴重性等級。
- 在「說明」部分,輸入新自訂模組的說明。
- 在「Next steps」(後續步驟) 中,以純文字格式輸入建議採取的行動。系統會忽略您新增的所有段落符號。
- 點選「建立」。
gcloud
gcloud scc manage custom-modules etd create 指令會為組織、資料夾或專案建立 Event Threat Detection 自訂模組。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organization、folder或project) -
RESOURCE_ID:自訂模組的組織、資料夾或專案數值 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_CONFIG:自訂模組的配置設定。請以自訂模組範本為起點。 -
MODULE_TYPE:自訂模組的類型。如需支援的類型清單,請參閱「自訂模組和範本」。 -
MODULE_DISPLAY_NAME:自訂模組的人類可讀顯示名稱。可包含英文字母、數字和底線 (_),長度上限為 128 個字元。
將下列內容儲存至名為 request.json 的檔案:
{ MODULE_CONFIG }
執行 gcloud scc manage custom-modules etd create 指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage custom-modules etd create \ --RESOURCE_TYPE=RESOURCE_ID \ --custom-config-file=request.json \ --display-name=MODULE_DISPLAY_NAME \ --module-type=MODULE_TYPE \ --enablement-state=ENABLED
Windows (PowerShell)
gcloud scc manage custom-modules etd create ` --RESOURCE_TYPE=RESOURCE_ID ` --custom-config-file=request.json ` --display-name=MODULE_DISPLAY_NAME ` --module-type=MODULE_TYPE ` --enablement-state=ENABLED
Windows (cmd.exe)
gcloud scc manage custom-modules etd create ^ --RESOURCE_TYPE=RESOURCE_ID ^ --custom-config-file=request.json ^ --display-name=MODULE_DISPLAY_NAME ^ --module-type=MODULE_TYPE ^ --enablement-state=ENABLED
REST
Security Command Center Management API 的 RESOURCE_TYPE.locations.eventThreatDetectionCustomModules.create 方法可為組織、資料夾或專案建立 Event Threat Detection 自訂模組。
使用任何要求資料之前,請先修改下列項目的值:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organizations、folders或projects)。 -
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_ID:自訂模組的組織、資料夾或專案數值 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_CONFIG:自訂模組的配置設定。請以自訂模組範本為起點。 -
MODULE_TYPE:自訂模組的類型。如需支援的類型清單,請參閱「自訂模組和範本」。 -
MODULE_DISPLAY_NAME:自訂模組的人類可讀顯示名稱。可包含英文字母、數字和底線 (_),長度上限為 128 個字元。
HTTP 方法和網址:
POST https://securitycentermanagement.googleapis.com/v1/RESOURCE_TYPE/RESOURCE_ID/locations/global/eventThreatDetectionCustomModules
JSON 要求主體:
{
"config": MODULE_CONFIG,
"enablementState": "ENABLED",
"type": "MODULE_TYPE",
"displayName": "MODULE_DISPLAY_NAME"
}
請展開以下其中一個選項,以傳送要求:
您應該會收到如下的 JSON 回覆:
{
"name": "projects/1234567890123/locations/global/eventThreatDetectionCustomModules/98765432109876543210",
"config": {
"metadata": {
"severity": "MEDIUM",
"description": "An IAM custom role contains permissions that aren't allowed.",
"recommendation": "Remove the permissions from the custom role."
},
"permissions": [
"accessapproval.requests.get",
"accessapproval.requests.invalidate",
"accessapproval.requests.list",
"accessapproval.settings.delete"
]
},
"enablementState": "ENABLED",
"type": "CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION",
"displayName": "iam_custom_role_prohibited_permissions",
"updateTime": "2026-03-16T19:44:58.588134Z"
}
Terraform
如要瞭解如何套用或移除 Terraform 設定,請參閱「基本 Terraform 指令」。詳情請參閱 Terraform 供應商參考文件。
自訂模組建立完成,並開始掃描。如要刪除模組,請參閱「刪除自訂模組」。
自訂模組的類別名稱包含模組類型的發現項目類別,以及您設定的模組顯示名稱。舉例來說,自訂模組的類別名稱可以是 Unexpected Compute Engine Region: example_custom_module。在 Google Cloud 控制台中,底線會顯示為空格。不過,在查詢中必須包含底線。
配額控管 Event Threat Detection 自訂模組的使用。
偵測延遲時間
如要瞭解 Event Threat Detection 和所有其他內建 Security Command Center 服務的偵測延遲時間,請參閱「掃描延遲時間」。
查看發現項目
您可以在 Google Cloud 控制台,或使用 gcloud CLI 或 REST API,查看自訂模組產生的發現項目。
控制台
-
前往 Google Cloud 控制台的 Security Command Center「發現項目」頁面。
- 選取 Google Cloud 專案或組織。
- 在「快速篩選器」部分,選取「來源顯示名稱」子區段中的「Event Threat Detection Custom Modules」。發現項目查詢結果會更新,只顯示這個來源的發現項目。
- 如要查看特定發現項目的詳細資料,請按一下「Category」(類別) 欄中的發現項目名稱。系統會開啟發現項目的詳細資料面板,並顯示「摘要」分頁。
- 在「摘要」分頁中,查看發現項目的詳細資料,包括偵測到的內容、受影響的資源,以及可採取的修復步驟 (如有)。
- 選用:如要查看發現項目的完整 JSON 定義,請按一下「JSON」分頁標籤。
gcloud
找出來源 ID
gcloud scc sources describe 指令會顯示 Security Command Center 發現項目來源的相關資訊。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:來源所屬的資源類型 (organizations、folders或projects)。 -
RESOURCE_ID:組織、資料夾或專案的數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。
執行 gcloud scc sources describe 指令:
Linux、macOS 或 Cloud Shell
gcloud scc sources describe RESOURCE_TYPE/RESOURCE_ID \ --source-display-name="Event Threat Detection Custom Modules"
Windows (PowerShell)
gcloud scc sources describe RESOURCE_TYPE/RESOURCE_ID ` --source-display-name="Event Threat Detection Custom Modules"
Windows (cmd.exe)
gcloud scc sources describe RESOURCE_TYPE/RESOURCE_ID ^ --source-display-name="Event Threat Detection Custom Modules"
您應該會收到類似以下的回應:
canonicalName: organizations/123456789012/sources/98765432109876543210 description: Provider used by Event Threat Detection Custom Modules displayName: Event Threat Detection Custom Modules name: organizations/123456789012/sources/98765432109876543210
來源 ID 是 canonicalName 和 name 欄位結尾的數值,例如 98765432109876543210。
列出 Event Threat Detection 自訂模組的所有發現項目
gcloud scc findings list 指令會列出特定位置來源的發現項目。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:要取得的資源類型 (organizations、folders或projects)。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
LOCATION:要使用的 Security Command Center 位置,例如eu。如果未啟用資料落地設定,請使用global。 -
SOURCE_ID:發現項目來源的數值 ID。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud scc findings list RESOURCE_TYPE/RESOURCE_ID \ --source=SOURCE_ID \ --location=LOCATION
Windows (PowerShell)
gcloud scc findings list RESOURCE_TYPE/RESOURCE_ID ` --source=SOURCE_ID ` --location=LOCATION
Windows (cmd.exe)
gcloud scc findings list RESOURCE_TYPE/RESOURCE_ID ^ --source=SOURCE_ID ^ --location=LOCATION
回覆會列出發現項目。
列出特定自訂模組的發現項目
gcloud scc findings list 指令會列出特定位置來源的發現項目。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:要取得的資源類型 (organizations、folders或projects)。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
LOCATION:要使用的 Security Command Center 位置,例如eu。如果未啟用資料落地設定,請使用global。 -
SOURCE_ID:發現項目來源的數值 ID。 -
CUSTOM_MODULE_CATEGORY_NAME:自訂模組的類別名稱,由模組的發現項目類別 (如「自訂模組和範本」所列)、冒號、空格和模組顯示名稱組成,空格會以底線取代。例如Unexpected Compute Engine region: example_custom_module。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud scc findings list RESOURCE_TYPE/RESOURCE_ID \ --source=SOURCE_ID \ --location=LOCATION \ --filter="category=\"CUSTOM_MODULE_CATEGORY_NAME\""
Windows (PowerShell)
gcloud scc findings list RESOURCE_TYPE/RESOURCE_ID ` --source=SOURCE_ID ` --location=LOCATION ` --filter="category=\"CUSTOM_MODULE_CATEGORY_NAME\""
Windows (cmd.exe)
gcloud scc findings list RESOURCE_TYPE/RESOURCE_ID ^ --source=SOURCE_ID ^ --location=LOCATION ^ --filter="category=\"CUSTOM_MODULE_CATEGORY_NAME\""
回覆會列出發現項目。
REST
找出來源 ID
Security Command Center API 的 RESOURCE_TYPE.sources.list 方法會列出 Security Command Center 發現項目來源的相關資訊。
使用任何要求資料之前,請先修改下列項目的值:
-
RESOURCE_TYPE:父項資源類型 (organizations、folders或projects)。 -
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_ID:組織、資料夾或專案的數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。
HTTP 方法和網址:
GET https://securitycenter.googleapis.com/v2/RESOURCE_TYPE/RESOURCE_ID/sources
請展開以下其中一個選項,以傳送要求:
回覆會列出發現項目。
{
"sources": [
{
"name": "organizations/123456789012/sources/9876543210987654321",
"displayName": "Security Command Center",
"description": "Detector for misconfigurations within the Security Command Center platform.",
"canonicalName": "organizations/123456789012/sources/9876543210987654321"
},
{
"name": "organizations/123456789012/sources/8765432109876543210",
"displayName": "Application Design Center",
"description": "Provides vulnerabilities on ADC resources.",
"canonicalName": "organizations/123456789012/sources/8765432109876543210"
},
{
"name": "organizations/123456789012/sources/7654321098765432109",
"displayName": "Cloud Anomaly Detection",
"description": "Provider used by Cloud Anomaly Detection",
"canonicalName": "organizations/123456789012/sources/7654321098765432109"
},
{
"name": "organizations/123456789012/sources/6543210987654321098",
"displayName": "Vulnerability Assessment",
"description": "Provider for Vulnerability Assessment.",
"canonicalName": "organizations/123456789012/sources/6543210987654321098"
},
{
"name": "organizations/123456789012/sources/5432109876543210987",
"displayName": "Data Security Posture Management",
"description": "Service to detect drift and post findings",
"canonicalName": "organizations/123456789012/sources/5432109876543210987"
},
{
"name": "organizations/123456789012/sources/4321098765432109876",
"displayName": "Notebook Security Scanner",
"description": "Provider for the Notebook Security Scanner",
"canonicalName": "organizations/123456789012/sources/4321098765432109876"
},
{
"name": "organizations/123456789012/sources/3210987654321098765",
"displayName": "GKE Security Posture",
"description": "Provides actionable security issues on GKE.",
"canonicalName": "organizations/123456789012/sources/3210987654321098765"
},
{
"name": "organizations/123456789012/sources/1098765432109876543",
"displayName": "Event Threat Detection Custom Modules",
"description": "Provider used by Event Threat Detection Custom Modules",
"canonicalName": "organizations/123456789012/sources/1098765432109876543"
}
]
}
來源 ID 是 canonicalName 和 name 欄位結尾的數值。
列出 Event Threat Detection 自訂模組的發現項目
Security Command Center API 的 RESOURCE_TYPE.sources.locations.findings.list 方法會列出特定位置來源的發現項目。
使用任何要求資料之前,請先修改下列項目的值:
-
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_TYPE:要取得的資源類型 (organizations、folders或projects)。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
LOCATION:要使用的 Security Command Center 位置,例如eu。如果未啟用資料落地設定,請使用global。 -
SOURCE_ID:發現項目來源的數值 ID。
HTTP 方法和網址:
GET https://securitycenter.googleapis.com/v2/RESOURCE_TYPE/RESOURCE_ID/sources/SOURCE_ID/locations/LOCATION/findings
請展開以下其中一個選項,以傳送要求:
回覆會列出發現項目。
如要進一步瞭解如何篩選發現項目,請參閱「列出安全性發現項目」。
自訂模組產生的發現項目,可像 Security Command Center 中的所有發現項目一樣管理。如要瞭解詳情,請參考下列資源:
管理 Event Threat Detection 自訂模組
本節說明如何查看、列出、更新及刪除 Event Threat Detection 自訂模組。
查看或列出自訂模組
根據預設,列出 Event Threat Detection 的自訂模組時,您會看到下列所有項目:
- 屬於組織、資料夾或專案的所有 Event Threat Detection 自訂模組。
- 所有繼承的 Event Threat Detection 自訂模組。舉例來說,如果您正在查看專案,則該專案上層組織和資料夾中建立的自訂模組會包含在結果中。
- 在子資源中建立的所有 Event Threat Detection 自訂模組。舉例來說,如果您在組織檢視畫面中,結果會包含組織資料夾和專案中的自訂模組。
控制台
- 查看 Event Threat Detection 服務的模組。預先定義和自訂模組會顯示在清單中。
- 選用:如要只查看自訂模組,請在「Filter」(篩選器) 方塊中輸入
Type:Custom。
gcloud
gcloud scc manage custom-modules etd list 指令會列出組織、資料夾或專案的所有 Event Threat Detection 自訂模組。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organization、folder或project)。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。
執行 gcloud scc manage custom-modules etd list 指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage custom-modules etd list \ --RESOURCE_TYPE=RESOURCE_ID
Windows (PowerShell)
gcloud scc manage custom-modules etd list ` --RESOURCE_TYPE=RESOURCE_ID
Windows (cmd.exe)
gcloud scc manage custom-modules etd list ^ --RESOURCE_TYPE=RESOURCE_ID
您應該會收到類似以下的回應:
- config:
metadata:
description: There is a Compute Engine instance in a region that's not allowed.
recommendation: Delete the instance. If necessary, create a new instance in
an allowed region.
severity: MEDIUM
regions:
- region: northamerica-northeast1
displayName: compute_instance_prohibited_region
enablementState: ENABLED
name: organizations/123456789012/locations/global/eventThreatDetectionCustomModules/9876543210987654321
type: CONFIGURABLE_ALLOWED_COMPUTE_ENGINE_REGION
updateTime: '2026-02-19T01:23:10.237946Z'
- config:
metadata:
description: An IAM custom role contains permissions that aren't allowed.
recommendation: Remove the permissions from the custom role.
severity: MEDIUM
permissions:
- accessapproval.requests.get
- accessapproval.requests.invalidate
- accessapproval.requests.list
- accessapproval.settings.delete
displayName: iam_custom_role_prohibited_permissions
enablementState: ENABLED
name: organizations/123456789012/locations/global/eventThreatDetectionCustomModules/8765432109876543210
type: CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION
updateTime: '2025-12-23T06:54:15.618430Z'
REST
Security Command Center Management API 的 RESOURCE_TYPE.locations.eventThreatDetectionCustomModules.list 方法會列出組織、資料夾或專案的所有 Event Threat Detection 自訂模組。
使用任何要求資料之前,請先修改下列項目的值:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organizations、folders或projects)。 -
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。
HTTP 方法和網址:
GET https://securitycentermanagement.googleapis.com/v1/RESOURCE_TYPE/RESOURCE_ID/locations/global/eventThreatDetectionCustomModules
請展開以下其中一個選項,以傳送要求:
您應該會收到如下的 JSON 回覆:
[
{
"config": {
"metadata": {
"description": "There is a Compute Engine instance in a region that's not allowed.",
"recommendation": "Delete the instance. If necessary, create a new instance in an allowed region.",
"severity": "MEDIUM"
},
"regions": [
{
"region": "northamerica-northeast1"
}
]
},
"displayName": "compute_instance_prohibited_region",
"enablementState": "ENABLED",
"name": "organizations/123456789012/locations/global/eventThreatDetectionCustomModules/9876543210987654321",
"type": "CONFIGURABLE_ALLOWED_COMPUTE_ENGINE_REGION",
"updateTime": "2026-02-19T01:23:10.237946Z"
},
{
"config": {
"metadata": {
"description": "An IAM custom role contains permissions that aren't allowed.",
"recommendation": "Remove the permissions from the custom role.",
"severity": "MEDIUM"
},
"permissions": [
"accessapproval.requests.get",
"accessapproval.requests.invalidate",
"accessapproval.requests.list",
"accessapproval.settings.delete"
]
},
"displayName": "iam_custom_role_prohibited_permissions",
"enablementState": "ENABLED",
"name": "organizations/123456789012/locations/global/eventThreatDetectionCustomModules/8765432109876543210",
"type": "CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION",
"updateTime": "2025-12-23T06:54:15.618430Z"
}
]
啟用或停用自訂模組
啟用或停用自訂模組時,這項變更會套用至自訂模組所屬的組織、資料夾或專案。這項資源是自訂模組的「父項」。
自訂模組上層項目的子項資料夾或專案,也可能沿用這項變更。舉例來說,如果您在資料夾中建立自訂模組,該資料夾中的專案就能沿用自訂模組的狀態。
如果自訂模組的父項是資料夾或專案,您必須在資源階層的相同層級或較低層級啟用或停用自訂模組。舉例來說,如果自訂模組的上層是專案,您就無法為組織或資料夾啟用或停用自訂模組,因為這些資源類型一律是專案的上層。
控制台
請參閱「查看及編輯服務的模組」。
gcloud
gcloud scc manage custom-modules etd update 指令會更新 Event Threat Detection 自訂模組的狀態。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:要更新的資源類型 (organization、folder或project)。 -
RESOURCE_ID:自訂模組的組織、資料夾或專案數值 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_ID:模組的數值 ID -
NEW_STATE:ENABLED表示啟用模組;DISABLED表示停用模組;INHERITED表示沿用父項資源的啟用狀態 (僅適用於專案和資料夾)。
執行 gcloud scc manage custom-modules etd update 指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage custom-modules etd update event-threat-detection MODULE_ID \ --RESOURCE_TYPE=RESOURCE_ID \ --enablement-state="NEW_STATE"
Windows (PowerShell)
gcloud scc manage custom-modules etd update event-threat-detection MODULE_ID ` --RESOURCE_TYPE=RESOURCE_ID ` --enablement-state="NEW_STATE"
Windows (cmd.exe)
gcloud scc manage custom-modules etd update event-threat-detection MODULE_ID ^ --RESOURCE_TYPE=RESOURCE_ID ^ --enablement-state="NEW_STATE"
您應該會收到類似以下的回應:
config:
metadata:
description: An IAM custom role contains permissions that aren't allowed.
recommendation: Remove the permissions from the custom role.
severity: MEDIUM
permissions:
- accessapproval.requests.get
- accessapproval.requests.invalidate
- accessapproval.requests.list
- accessapproval.settings.delete
displayName: iam_custom_role_prohibited_permissions
enablementState: DISABLED
name: projects/1234567890123/locations/global/eventThreatDetectionCustomModules/98765432109876543210
type: CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION
updateTime: '2026-03-20T16:52:27.046766Z'
REST
Security Command Center Management API 的 RESOURCE_TYPE.locations.eventThreatDetectionCustomModules.patch 方法會更新 Event Threat Detection 自訂模組的狀態。
使用任何要求資料之前,請先修改下列項目的值:
-
RESOURCE_TYPE:要更新的資源類型 (organizations、folders或projects)。 -
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_ID:自訂模組的組織、資料夾或專案數值 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_ID:模組的數值 ID -
NEW_STATE:ENABLED表示啟用模組;DISABLED表示停用模組;INHERITED表示沿用父項資源的啟用狀態 (僅適用於專案和資料夾)。 -
FIELDS_TO_UPDATE:選用。以半形逗號分隔的欄位清單,用於指定要更新的欄位。如未指定,系統會更新所有欄位。
HTTP 方法和網址:
PATCH https://securitycentermanagement.googleapis.com/v1/RESOURCE_TYPE/RESOURCE_ID/locations/global/eventThreatDetectionCustomModules/MODULE_ID?updateMask=enablementState
JSON 要求主體:
{
"enablementState": "NEW_STATE"
}
請展開以下其中一個選項,以傳送要求:
您應該會收到如下的 JSON 回覆:
{
"name": "projects/1234567890123/locations/global/eventThreatDetectionCustomModules/98765432109876543210",
"config": {
"metadata": {
"severity": "MEDIUM",
"description": "An IAM custom role contains permissions that aren't allowed.",
"recommendation": "Remove the permissions from the custom role."
},
"permissions": [
"accessapproval.requests.get",
"accessapproval.requests.invalidate",
"accessapproval.requests.list",
"accessapproval.settings.delete"
]
},
"enablementState": "DISABLED",
"type": "CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION",
"displayName": "iam_custom_role_prohibited_permissions",
"updateTime": "2026-03-20T16:52:27.046766Z"
}
更新自訂模組的定義
本節說明如何透過Google Cloud 控制台和 gcloud CLI 更新自訂模組。每個 Event Threat Detection 自訂模組的大小上限為 6 MB。
您無法更新自訂模組的模組類型。
如要更新自訂模組,請按照下列步驟操作:
控制台
你只能編輯住宅自訂模組。舉例來說,如果您在組織檢視畫面中,就只能編輯在組織層級建立的自訂模組。
- 查看 Event Threat Detection 服務的 模組。預先定義和自訂模組會顯示在清單中。
- 找出要編輯的自訂模組。
- 在該自訂模組中,依序按一下「 Actions」>「Edit」。
- 視需要編輯自訂模組。
- 按一下「儲存」。
gcloud
如要更新模組,請執行下列指令,並加入更新後的模組範本 JSON:
gcloud alpha scc custom-modules etd update CUSTOM_MODULE_ID \
--RESOURCE_FLAG=RESOURCE_ID \
--enablement-state="ENABLED" \
--custom-config-from-file=PATH_TO_JSON_FILE
更改下列內容:
CUSTOM_MODULE_ID:Event Threat Detection 自訂模組的數字 ID,例如1234567890。查看自訂模組清單時,您可以從相關自訂模組的name欄位取得數字 ID。RESOURCE_FLAG:自訂模組所在的父項資源範圍,可以是organization、folder或project。RESOURCE_ID:父項資源的 ID,也就是組織 ID、資料夾 ID 或專案 ID。PATH_TO_JSON_FILE:包含自訂模組 JSON 定義的 JSON 檔案。
查看單一自訂模組的狀態
控制台
- 查看 Event Threat Detection 服務的模組。預先定義和自訂模組會顯示在清單中。
在清單中找出自訂模組。
自訂模組的狀態會顯示在「狀態」欄中。
gcloud
gcloud scc manage custom-modules etd describe 指令會取得組織、資料夾或專案的 Event Threat Detection 自訂模組。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organization、folder或project)。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_ID:自訂模組的數字 ID。
執行 gcloud scc manage custom-modules etd describe 指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage custom-modules etd describe MODULE_ID \ --RESOURCE_TYPE=RESOURCE_ID
Windows (PowerShell)
gcloud scc manage custom-modules etd describe MODULE_ID ` --RESOURCE_TYPE=RESOURCE_ID
Windows (cmd.exe)
gcloud scc manage custom-modules etd describe MODULE_ID ^ --RESOURCE_TYPE=RESOURCE_ID
您應該會收到類似以下的回應:
config:
metadata:
description: An IAM custom role contains permissions that aren't allowed.
recommendation: Remove the permissions from the custom role.
severity: MEDIUM
permissions:
- accessapproval.requests.get
- accessapproval.requests.invalidate
- accessapproval.requests.list
- accessapproval.settings.delete
displayName: iam_custom_role_prohibited_permissions
enablementState: ENABLED
name: organizations/123456789012/locations/global/eventThreatDetectionCustomModules/8765432109876543210
type: CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION
updateTime: '2025-12-23T06:54:15.618430Z'
REST
Security Command Center Management API 的 RESOURCE_TYPE.locations.eventThreatDetectionCustomModules.get 方法會取得組織、資料夾或專案的 Event Threat Detection 自訂模組。
使用任何要求資料之前,請先修改下列項目的值:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organizations、folders或projects)。 -
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_ID:要取得的組織、資料夾或專案數字 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_ID:自訂模組的數字 ID。
HTTP 方法和網址:
GET https://securitycentermanagement.googleapis.com/v1/RESOURCE_TYPE/RESOURCE_ID/locations/global/eventThreatDetectionCustomModules/MODULE_ID
請展開以下其中一個選項,以傳送要求:
您應該會收到如下的 JSON 回覆:
{
"config": {
"metadata": {
"description": "An IAM custom role contains permissions that aren't allowed.",
"recommendation": "Remove the permissions from the custom role.",
"severity": "MEDIUM"
},
"permissions": [
"accessapproval.requests.get",
"accessapproval.requests.invalidate",
"accessapproval.requests.list",
"accessapproval.settings.delete"
]
},
"displayName": "iam_custom_role_prohibited_permissions",
"enablementState": "ENABLED",
"name": "organizations/123456789012/locations/global/eventThreatDetectionCustomModules/8765432109876543210",
"type": "CONFIGURABLE_CUSTOM_ROLE_WITH_PROHIBITED_PERMISSION",
"updateTime": "2025-12-23T06:54:15.618430Z"
}
刪除自訂模組
刪除 Event Threat Detection 自訂模組時,系統不會修改該模組產生的發現項目,這些項目仍會顯示在 Security Command Center 中。相較之下,刪除安全狀態分析自訂模組時,系統會將產生的發現項目標示為無效。
自訂模組一經刪除即無法復原。
控制台
您無法刪除繼承的自訂模組。舉例來說,如果您在專案檢視畫面中,就無法刪除在資料夾或組織層級建立的自訂模組。
如要透過 Google Cloud 控制台刪除自訂模組,請按照下列步驟操作:
- 查看 Event Threat Detection 服務的模組。預先定義和自訂模組會顯示在清單中。
- 找出要刪除的自訂模組。
- 在該自訂模組中,依序點選 「Actions」(動作) >「Delete」(刪除)。系統會顯示訊息,提示您確認刪除。
- 點選「刪除」。
gcloud
gcloud scc manage custom-modules etd delete 指令會為組織、資料夾或專案建立 Event Threat Detection 自訂模組。
使用下列任何指令資料前,請先替換以下項目:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organization、folder或project)。 -
RESOURCE_ID:自訂模組的組織、資料夾或專案數值 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_ID:自訂模組的數字 ID。
執行 gcloud scc manage custom-modules etd delete 指令:
Linux、macOS 或 Cloud Shell
gcloud scc manage custom-modules etd delete MODULE_ID \ --RESOURCE_TYPE=RESOURCE_ID
Windows (PowerShell)
gcloud scc manage custom-modules etd delete MODULE_ID ` --RESOURCE_TYPE=RESOURCE_ID
Windows (cmd.exe)
gcloud scc manage custom-modules etd delete MODULE_ID ^ --RESOURCE_TYPE=RESOURCE_ID
您應該會收到類似以下的回應:
Deleted [projects/1234567890123/locations/global/eventThreatDetectionCustomModules/98765432109876543210].
REST
Security Command Center Management API 的 RESOURCE_TYPE.locations.eventThreatDetectionCustomModules.delete 方法可為組織、資料夾或專案建立 Event Threat Detection 自訂模組。
使用任何要求資料之前,請先修改下列項目的值:
-
RESOURCE_TYPE:自訂模組所屬的資源類型 (organizations、folders或projects) -
QUOTA_PROJECT:用於追蹤帳單和配額的專案 ID。 -
RESOURCE_ID:自訂模組的組織、資料夾或專案數值 ID。如果是專案,您也可以使用英數字元組成的專案 ID。 -
MODULE_ID:自訂模組的數字 ID。
HTTP 方法和網址:
DELETE https://securitycentermanagement.googleapis.com/v1/RESOURCE_TYPE/RESOURCE_ID/locations/global/eventThreatDetectionCustomModules/MODULE_ID
請展開以下其中一個選項,以傳送要求:
您應該會收到如下的 JSON 回覆:
{}
複製自訂模組
複製自訂模組時,產生的自訂模組會建立為您正在查看的資源常駐模組。舉例來說,如果您複製專案從組織繼承的自訂模組,新的自訂模組就會是專案中的常駐模組。
無法複製子系自訂模組。
如要透過 Google Cloud 控制台複製自訂模組,請按照下列步驟操作:
- 查看 Event Threat Detection 服務的模組。預先定義和自訂模組會顯示在清單中。
- 找出要複製的自訂模組。
- 在該自訂模組中,依序點選「 Actions」>「Clone」。
- 視需要編輯自訂模組。
- 點選「建立」。
後續步驟
- 進一步瞭解 Event Threat Detection 的自訂模組。