忽略各个发现结果

本文档介绍了如何在 Security Command Center 中静态忽略单个发现结果、取消忽略发现结果或批量忽略发现结果。

所需的角色

如需获得忽略或取消忽略发现结果所需的权限,请让管理员向您授予组织、文件夹或项目的以下 IAM 角色:

如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

您也可以通过自定义角色或其他预定义角色来获取所需的权限。

忽略个别发现结果

您可以使用Google Cloud 控制台、gcloud CLI 或 Security Command Center API,静态地忽略个别发现结果。

静态地忽略发现结果不会影响其有效状态。如果某个有效的发现结果被忽略,其 state 属性会保持不变,即仍为 state="ACTIVE"。虽然该发现结果被隐藏起来,但在其相关的底层漏洞、配置错误或威胁得以消除之前,它会一直保持有效状态。此外,通过静态地忽略发现结果,您会替换适用于该发现结果的所有动态忽略规则。

忽略恶意组合发现结果会关闭相应的恶意组合支持请求。

如需忽略与您指定的条件匹配的所有未来发现结果,请参阅管理忽略规则

如需查看用于忽略发现结果的示例代码,请参阅忽略发现结果

如需静态地忽略个别发现结果,请点击要使用的过程对应的标签页。

控制台

  1. 在 Google Cloud 控制台中,前往 Security Command Center 发现结果页面。

    转至“发现结果”

  2. 如有必要,选择您的 Google Cloud 项目或组织。
  3. 如果您在发现结果的查询结果面板中没有看到需要忽略的发现结果,请在快速过滤条件面板的类别部分选择该发现结果的类别。
  4. 选择需要忽略的发现结果。您可以选择一个或多个发现结果。
  5. 发现结果的查询结果操作栏上,点击忽略选项,然后选择应用忽略替换项

    所选发现结果的 mute 属性将被设置为 MUTED,并且该发现结果会从发现结果的查询结果面板中被移除。或者,您也可以在发现结果的详细信息面板中忽略相应的发现结果:

  6. 发现结果页面的发现结果的查询结果面板中,选择类别列,然后点击需要忽略的发现结果的名称。系统会打开该发现结果的详细信息面板。

  7. 点击执行操作

  8. 执行操作菜单中,选择应用忽略替换项

    如果您选择忽略这类发现结果,则系统会打开创建忽略规则页面,您可以在其中为具有相同类型或包含相同 Indicator 属性的发现结果创建忽略规则。

gcloud

  1. 在 Google Cloud 控制台中,激活 Cloud Shell。

    激活 Cloud Shell

    Cloud Shell 会话随即会在 Google Cloud 控制台的底部启动,并显示命令行提示符。Cloud Shell 是一个已安装 Google Cloud CLI 且已为当前项目设置值的 Shell 环境。该会话可能需要几秒钟时间来完成初始化。

  2. 如需将发现结果的忽略状态设置为 MUTED,请使用 gcloud CLI 中的 set-mute 命令:

    gcloud scc findings set-mute FINDING_ID \
      --PARENT=PARENT_ID \
      --location=LOCATION \
      --source=SOURCE_ID \
      --mute=MUTED

    替换以下内容:

    • FINDING_ID:要忽略的发现结果的 ID

      如需检索发现结果 ID,请使用 Security Command Center API 列出发现结果。 发现结果 ID 是 canonicalName 属性的最后一部分,例如 projects/123456789012/sources/1234567890123456789/findings`/5ee30aa342e799e4e1700826de053aa9/。

    • PARENT:父级资源(projectfolderorganization),区分大小写

    • PARENT_ID:父级组织、文件夹或项目的 ID

    • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global

    • SOURCE_ID:来源 ID

      如需了解如何检索来源 ID,请参阅获取来源 ID

Go

import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)

// setMute mutes an individual finding.
// If a finding is already muted, muting it again has no effect.
// Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
func setMute(w io.Writer, findingPath string) error {
	// findingPath: The relative resource name of the finding. See:
	// https://cloud.google.com/apis/design/resource_names#relative_resource_name
	// Use any one of the following formats:
	//  - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
	//  - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
	//  - projects/{project_id}/sources/{source_id}/finding/{finding_id}
	// findingPath := fmt.Sprintf("projects/%s/sources/%s/finding/%s", "your-google-cloud-project-id", "source", "finding-id")
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.SetMuteRequest{
		Name: findingPath,
		Mute: securitycenterpb.Finding_MUTED}

	finding, err := client.SetMute(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to set the specified mute value: %w", err)
	}
	fmt.Fprintf(w, "Mute value for the finding: %s is %s", finding.Name, finding.Mute)
	return nil
}

Java


import com.google.cloud.securitycenter.v2.Finding;
import com.google.cloud.securitycenter.v2.Finding.Mute;
import com.google.cloud.securitycenter.v2.SecurityCenterClient;
import com.google.cloud.securitycenter.v2.SetMuteRequest;
import java.io.IOException;

public class SetMuteFinding {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the variables within {}
    // findingPath: The relative resource name of the finding. See:
    // https://cloud.google.com/apis/design/resource_names#relative_resource_name
    // Use any one of the following formats:
    //  - organizations/{org_id}/sources/{source_id}/locations/{location}/finding/{finding_id}
    //  - folders/{folder_id}/sources/{source_id}/locations/{location}/finding/{finding_id}
    //  - projects/{project_id}/sources/{source_id}/locations/{location}/finding/{finding_id}
    //
    String findingPath = "{path-to-the-finding}";

    setMute(findingPath);
  }

  // Mute an individual finding.
  // If a finding is already muted, muting it again has no effect.
  // Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
  public static Finding setMute(String findingPath) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      SetMuteRequest setMuteRequest =
          SetMuteRequest.newBuilder()
              // Relative path for the finding.
              .setName(findingPath)
              .setMute(Mute.MUTED)
              .build();

      Finding finding = client.setMute(setMuteRequest);
      System.out.println(
          "Mute value for the finding " + finding.getName() + " is: " + finding.getMute());
      return finding;
    }
  }
}

Python

def set_mute_finding(finding_path: str) -> None:
    """
      Mute an individual finding.
      If a finding is already muted, muting it again has no effect.
      Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
    Args:
        finding_path: The relative resource name of the finding. See:
        https://cloud.google.com/apis/design/resource_names#relative_resource_name
        Use any one of the following formats:
        - organizations/{organization_id}/sources/{source_id}/finding/{finding_id},
        - folders/{folder_id}/sources/{source_id}/finding/{finding_id},
        - projects/{project_id}/sources/{source_id}/finding/{finding_id}.
    """
    from google.cloud import securitycenter_v2

    client = securitycenter_v2.SecurityCenterClient()

    request = securitycenter_v2.SetMuteRequest()
    request.name = finding_path
    request.mute = securitycenter_v2.Finding.Mute.MUTED

    finding = client.set_mute(request)
    print(f"Mute value for the finding: {finding.mute.name}")
    return finding

REST

在 Security Command Center API 中,使用 findings.setMute 方法忽略发现结果。请求正文是指示产生的忽略状态的枚举。

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/sources/SOURCE_ID/locations/LOCATION/findings/FINDING_ID:setMute

{
  "mute": "MUTED"
}

替换以下内容:

  • PARENT:父级资源(organizationsfoldersprojects)。
  • PARENT_ID:父级组织、文件夹或项目的 ID。
  • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global
  • SOURCE_ID:来源的数字 ID。

    如需了解如何检索来源 ID,请参阅获取来源 ID

  • FINDING_ID:要忽略的发现结果的 ID。

    如需检索发现结果 ID,请使用 Security Command Center API 列出发现结果。 发现结果 ID 是 canonicalName 属性的最后一部分,例如 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9/。

忽略发现结果后,其 mute 属性会被设为 MUTED

取消忽略各个发现结果

您可以使用 Google Cloud 控制台、gcloud CLI 或 Security Command Center API,静态地取消忽略个别发现结果。

如果您需要防止某项发现结果被过于宽泛的忽略规则隐藏,或者被可能过于复杂而无法修改的规则隐藏,以排除您认为重要的发现结果,那么取消忽略该发现结果非常有用。

仅当发现结果被手动忽略时,取消忽略的发现结果才会再次被忽略。使用 gcloud CLI 或 Security Command Center API 创建的忽略规则不会影响用户取消忽略的发现结果。

如需查看用于取消忽略某项发现结果的示例代码,请参阅取消忽略发现结果

控制台

如需使用 Google Cloud 控制台取消忽略个别发现结果,请点击您的服务层级对应的标签页:

  1. 在 Google Cloud 控制台中,前往 Security Command Center 发现结果页面。

    转至“发现结果”

  2. 如有必要,选择您的 Google Cloud 项目或组织。 系统随即会打开发现结果页面,并在查询预览部分中显示默认查询。由于默认查询会过滤掉已忽略的发现结果,因此您需要先修改该查询,之后系统才会在发现结果的查询结果面板中显示已忽略的发现结果。
  3. 查询预览部分右侧,点击修改查询以打开查询编辑器
  4. 查询编辑器字段中,将现有忽略语句替换为以下内容:
    mute="MUTED"
  5. 点击应用发现结果的查询结果面板中的发现结果会相应更新,以仅包含已忽略的发现结果。
  6. 如有必要,您可以过滤掉其他已忽略的发现结果。例如,您可以在快速过滤条件面板下方的类别部分,选择需要取消忽略的发现结果的名称,以过滤掉所有其他类别的发现结果。
  7. 选择要取消忽略的发现结果。您可以选择一个或多个发现结果。
  8. 发现结果的查询结果操作栏上,点击忽略选项,然后选择应用取消忽略替换项。 所选发现结果的 mute 属性将被设置为 UNMUTED,并且该发现结果会从发现结果的查询结果面板中被移除。或者,您也可以在发现结果的详细信息面板中取消忽略相应的发现结果:
  9. 发现结果页面的发现结果的查询结果面板中,选择类别列,然后点击需要取消忽略的发现结果的名称。系统会打开该发现结果的详细信息面板。
  10. 点击执行操作
  11. 执行操作菜单中,选择应用取消忽略替换项

gcloud

  1. 在 Google Cloud 控制台中,激活 Cloud Shell。

    激活 Cloud Shell

    Cloud Shell 会话随即会在 Google Cloud 控制台的底部启动,并显示命令行提示符。Cloud Shell 是一个已安装 Google Cloud CLI 且已为当前项目设置值的 Shell 环境。该会话可能需要几秒钟时间来完成初始化。

  2. 如需将发现结果的忽略状态设置为 UNMUTED,请使用 gcloud CLI 中的 set-mute 命令:

    gcloud scc findings set-mute FINDING_ID \
      --PARENT=PARENT_ID \
      --location=LOCATION \
      --source=SOURCE_ID \
      --mute=UNMUTED

    替换以下内容:

    • FINDING_ID:要忽略的发现结果的 ID

      如需检索发现结果 ID,请使用 Security Command Center API 列出发现结果。 发现结果 ID 是 canonicalName 属性的最后一部分,例如 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9/。

    • PARENT:父级资源(projectfolderorganization),区分大小写

    • PARENT_ID:父级组织、文件夹或项目的 ID

    • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global

    • SOURCE_ID:来源 ID

      如需了解如何检索来源 ID,请参阅获取来源 ID

Go


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)

// setUnmute unmutes an individual finding.
// Unmuting a finding that isn't muted has no effect.
// Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
func setUnmute(w io.Writer, findingPath string) error {
	// findingPath: The relative resource name of the finding. See:
	// https://cloud.google.com/apis/design/resource_names#relative_resource_name
	// Use any one of the following formats:
	//  - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
	//  - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
	//  - projects/{project_id}/sources/{source_id}/finding/{finding_id}
	// findingPath := fmt.Sprintf("projects/%s/sources/%s/finding/%s", "your-google-cloud-project-id", "source", "finding-id")
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.SetMuteRequest{
		Name: findingPath,
		Mute: securitycenterpb.Finding_UNMUTED}

	finding, err := client.SetMute(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to set the specified mute value: %w", err)
	}
	fmt.Fprintf(w, "Mute value for the finding: %s is %s", finding.Name, finding.Mute)
	return nil
}

Java


import com.google.cloud.securitycenter.v2.Finding;
import com.google.cloud.securitycenter.v2.Finding.Mute;
import com.google.cloud.securitycenter.v2.SecurityCenterClient;
import com.google.cloud.securitycenter.v2.SetMuteRequest;
import java.io.IOException;

public class SetUnmuteFinding {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the variables within {}
    // findingPath: The relative resource name of the finding. See:
    // https://cloud.google.com/apis/design/resource_names#relative_resource_name
    // Use any one of the following formats:
    //  - organizations/{org_id}/sources/{source_id}/locations/{location}/finding/{finding_id}
    //  - folders/{folder_id}/sources/{source_id}/locations/{location}/finding/{finding_id}
    //  - projects/{project_id}/sources/{source_id}/locations/{location}/finding/{finding_id}
    //
    String findingPath = "{path-to-the-finding}";

    setUnmute(findingPath);
  }

  // Unmute an individual finding.
  // Unmuting a finding that isn't muted has no effect.
  // Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
  public static Finding setUnmute(String findingPath) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      SetMuteRequest setMuteRequest =
          SetMuteRequest.newBuilder()
              .setName(findingPath)
              .setMute(Mute.UNMUTED)
              .build();

      Finding finding = client.setMute(setMuteRequest);
      System.out.println(
          "Mute value for the finding " + finding.getName() + " is: " + finding.getMute());
      return finding;
    }
  }
}

Python

def set_unmute_finding(finding_path: str) -> None:
    """
      Unmute an individual finding.
      Unmuting a finding that isn't muted has no effect.
      Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
    Args:
        finding_path: The relative resource name of the finding. See:
        https://cloud.google.com/apis/design/resource_names#relative_resource_name
        Use any one of the following formats:
        - organizations/{organization_id}/sources/{source_id}/finding/{finding_id},
        - folders/{folder_id}/sources/{source_id}/finding/{finding_id},
        - projects/{project_id}/sources/{source_id}/finding/{finding_id}.
    """
    from google.cloud import securitycenter_v2

    client = securitycenter_v2.SecurityCenterClient()

    request = securitycenter_v2.SetMuteRequest()
    request.name = finding_path
    request.mute = securitycenter_v2.Finding.Mute.UNMUTED

    finding = client.set_mute(request)
    print(f"Mute value for the finding: {finding.mute.name}")
    return finding

REST

在 Security Command Center API 中,使用 findings.setMute 方法取消忽略发现结果。请求正文是指示产生的忽略状态的枚举。

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/sources/SOURCE_ID/locations/LOCATION/findings/FINDING_ID:setMute

{
  "mute": "UNMUTED"
}

替换以下内容:

  • PARENT:父级资源(organizationsfoldersprojects
  • PARENT_ID:父级组织、文件夹或项目的 ID
  • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global
  • SOURCE_ID:来源的数字 ID

    如需了解如何检索来源 ID,请参阅获取来源 ID

  • FINDING_ID:要忽略的发现结果的 ID。

    如需检索发现结果 ID,请使用 Security Command Center API 列出发现结果。 发现结果 ID 是 canonicalName 属性的最后一部分,例如 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9/。

所选的发现结果不再隐藏,并且发现结果的 mute 特性设置为 UNMUTED

从个别发现结果中移除忽略状态替换项

如果您有意修改发现结果的忽略状态,以静态地忽略或取消忽略发现结果,则会应用忽略状态替换项。例如,您可能希望应用忽略状态替换项,以隐藏不值得创建动态忽略规则的严重程度为“低”的发现结果。

您可以使用 Google Cloud 控制台、gcloud CLI 或 Security Command Center API,从个别发现结果中移除忽略状态替换项。

在从某项发现结果中移除忽略状态替换项之前,请先了解以下内容:

  • 如果发现结果被静态地忽略或取消忽略,则会具有忽略状态替换项。您可以使用静态忽略规则手动或自动对任何发现结果应用忽略状态替换项。
  • 忽略状态替换项会无限期地应用于发现结果,并优先于任何匹配的忽略规则。
  • 从发现结果中移除忽略状态替换项会重置发现结果的忽略状态,以便由静态或动态忽略规则进行处理。
  • 从发现结果中移除忽略状态替换项与取消忽略发现结果不同。当您取消忽略某项发现结果(应用取消忽略替换项)后,在您手动移除忽略状态替换项之前,忽略规则无法忽略该发现结果。

如需从个别发现结果中移除忽略替换项,请执行以下操作:

控制台

  1. 在 Google Cloud 控制台中,前往 Security Command Center 发现结果页面。

    转至“发现结果”

  2. 选择您的 Google Cloud 项目或组织。
  3. 查询预览部分右侧,点击修改查询以打开查询编辑器
  4. 查询编辑器字段中,将现有忽略语句替换为以下内容:
    mute="MUTED" OR mute="UNMUTED"
  5. 点击应用发现结果的查询结果面板中的发现结果会相应更新,以包含被静态忽略及未被忽略的发现结果。
  6. 如有必要,请过滤掉其他发现结果。例如,您可以在快速过滤条件面板下方的类别中,选择需要重置的发现结果的名称,以过滤掉所有其他类别的发现结果。
  7. 选择要重置的发现结果。您可以选择一个或多个发现结果。
  8. 发现结果的查询结果操作栏上,点击忽略选项,然后选择移除忽略替换项。 所选发现结果的 mute 属性将被设置为 UNDEFINED,并且该发现结果会从发现结果的查询结果面板中被移除。或者,您也可以在发现结果的详细信息面板中取消忽略相应的发现结果:
  9. 发现结果页面的发现结果的查询结果面板中,选择类别列,然后点击需要取消忽略的发现结果的名称。系统会打开该发现结果的详细信息面板。
  10. 点击执行操作
  11. 执行操作菜单中,选择移除忽略替换项

gcloud

  1. 在 Google Cloud 控制台中,激活 Cloud Shell。

    激活 Cloud Shell

    Cloud Shell 会话随即会在 Google Cloud 控制台的底部启动,并显示命令行提示符。Cloud Shell 是一个已安装 Google Cloud CLI 且已为当前项目设置值的 Shell 环境。该会话可能需要几秒钟时间来完成初始化。

  2. 如需将发现结果的忽略状态设置为 UNDEFINED,请使用 gcloud CLI 中的 set-mute 命令:

    gcloud scc findings set-mute FINDING_ID \
      --PARENT=PARENT_ID \
      --location=LOCATION \
      --source=SOURCE_ID \
      --mute=UNDEFINED

    替换以下内容:

    • FINDING_ID:要重置的发现结果的 ID

      如需检索发现结果 ID,请使用 Security Command Center API 列出发现结果。发现结果 ID 是 canonicalName 属性的最后一部分,例如 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9/。

    • PARENT:父级资源(projectfolderorganization),区分大小写

    • PARENT_ID:父级组织、文件夹或项目的 ID

    • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global

    • SOURCE_ID:来源 ID

      如需了解如何检索来源 ID,请参阅获取来源 ID

REST

在 Security Command Center API 中,使用 findings.setMute 方法重置发现结果的忽略状态。请求正文是指示产生的忽略状态的枚举。

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/sources/SOURCE_ID/locations/LOCATION/findings/FINDING_ID:setMute

{
  "mute": "UNDEFINED"
}

替换以下内容:

  • PARENT:父级资源(organizationsfoldersprojects
  • PARENT_ID:父级组织、文件夹或项目的 ID
  • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global
  • SOURCE_ID:来源的数字 ID

Java


import com.google.cloud.securitycenter.v2.Finding;
import com.google.cloud.securitycenter.v2.Finding.Mute;
import com.google.cloud.securitycenter.v2.SecurityCenterClient;
import com.google.cloud.securitycenter.v2.SetMuteRequest;
import java.io.IOException;

public class SetMuteUndefinedFinding {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the variables within {}

    // findingPath: The relative resource name of the finding. See:
    // https://cloud.google.com/apis/design/resource_names#relative_resource_name
    // Use any one of the following formats:
    // - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
    // - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
    // - projects/{project_id}/sources/{source_id}/finding/{finding_id}
    String findingPath = "{path-to-the-finding}";
    setMuteUndefined(findingPath);
  }

  // Reset mute state of an individual finding.
  // If a finding is already reset, resetting it again has no effect.
  // Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE/UNDEFINED.
  public static Finding setMuteUndefined(String findingPath) throws IOException {
    // Initialize client that will be used to send requests. This client only needs
    // to be created once, and can be reused for multiple requests.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      SetMuteRequest setMuteRequest =
          SetMuteRequest.newBuilder()
              .setName(findingPath)
              .setMute(Mute.UNDEFINED)
              .build();

      Finding finding = client.setMute(setMuteRequest);
      System.out.println(
          "Mute value for the finding " + finding.getName() + " is: " + finding.getMute());
      return finding;
    }
  }
}

忽略或重置多个现有的发现结果

您可以使用 gcloud scc findings bulk-mute gcloud CLI 命令或 Security Command Center API 的 bulkMute 方法,对多个现有的发现结果执行以下批量忽略操作:

  • 忽略多个现有的发现结果。批量忽略现有的发现结果会静态地忽略这些发现结果,并替换适用于发现结果的所有动态忽略规则。如果您需要忽略类似的未来发现结果,请创建忽略规则

  • 移除多个现有发现结果中的忽略状态替换项。通过移除发现结果中的忽略状态替换,您可以将忽略状态从 MUTED(静态地忽略)或 UNMUTED(静态地取消忽略)重置为 UNDEFINED。如果您从静态忽略规则迁移到动态忽略规则,此功能非常有用。

通过定义发现结果过滤条件,指定您需要忽略的发现结果集。批量忽略过滤条件并不支持所有发现结果属性。 如需查看不支持的属性列表,请参阅忽略规则不支持的发现结果属性

如果为 Security Command Center 启用了数据驻留,则批量忽略操作的范围仅限于在其中执行操作的 Security Command Center 位置。

如需查看批量忽略发现结果的示例代码,请参阅批量忽略发现结果

如需批量忽略或重置发现结果,请点击要使用的过程对应的标签页:

控制台

在 Google Cloud 控制台中,您只能通过创建忽略规则来批量忽略发现结果。在Google Cloud 控制台中,创建忽略规则会忽略现有和未来的发现结果。

gcloud

  1. 在 Google Cloud 控制台中,激活 Cloud Shell。

    激活 Cloud Shell

    Cloud Shell 会话随即会在 Google Cloud 控制台的底部启动,并显示命令行提示符。Cloud Shell 是一个已安装 Google Cloud CLI 且已为当前项目设置值的 Shell 环境。该会话可能需要几秒钟时间来完成初始化。

  2. 如需批量忽略或重置多个发现结果,请运行 gcloud scc findings bulk-mute 命令:

    gcloud scc findings bulk-mute \
      --PARENT=PARENT_ID \
      --location=LOCATION \
      --filter="FILTER" \
      --mute-state=MUTE_STATE

    替换以下内容:

    • PARENT:忽略规则适用的资源层次结构中的范围,即 organizationfolderproject
    • PARENT_ID:父级组织、文件夹或项目的数字 ID,或父级项目的字母数字 ID。
    • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global
    • FILTER:您定义来过滤发现结果的表达式。

      例如,如需忽略 internal-test 项目中所有现有的低严重级别 OPEN_FIREWALLPUBLIC_IP_ADDRESS 发现结果,您的过滤条件可以是 "category=\"OPEN_FIREWALL\" OR category=\"PUBLIC_IP_ADDRESS\" AND severity=\"LOW\" AND resource.projectDisplayName=\"internal-test\""

    • MUTE_STATE:指示发现结果是否静态地忽略的值。有效值为 MUTEDUNDEFINED。默认情况下,该值设置为 MUTED。仅当您要重置多个现有发现结果的忽略状态时,才将此值设置为 UNDEFINED

REST

在 Security Command Center API 中,使用 findings.bulkMute 方法可忽略或重置多个现有发现结果的忽略状态。请求正文包含用于过滤发现结果的表达式:

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/findings:bulkMute

{
  "filter": "FILTER",
  "muteState": "MUTE_STATE"
}

替换以下内容:

  • PARENT:父级资源(organizationsfoldersprojects)。
  • PARENT_ID:父级组织、文件夹或项目的 ID。
  • LOCATION:在其中忽略或取消忽略发现结果的 Security Command Center 位置;如果启用了数据驻留,请使用 eusaus;否则,请使用值 global
  • FILTER:您定义来过滤发现结果的表达式。

    例如,如需忽略 internal-test 项目中所有现有的低严重级别 OPEN_FIREWALLPUBLIC_IP_ADDRESS 发现结果,您的过滤条件可以是 "category=\"OPEN_FIREWALL\" OR category=\"PUBLIC_IP_ADDRESS\" AND severity=\"LOW\" AND resource.projectDisplayName=\"internal-test\""

  • MUTE_STATE:指示发现结果是否忽略的值。有效值为 MUTEDUNDEFINED。默认情况下,该值设置为 MUTED。仅当您要重置多个现有发现结果的忽略状态时,才将此值设置为 UNDEFINED

系统会隐藏您选择的资源中与过滤条件完全匹配的所有现有发现结果。发现结果的 mute 特性设置为 MUTED

如果忽略发现结果,则系统不会更改其状态。如果有效的发现结果被忽略,这些发现结果会隐藏起来,但在底层漏洞、配置错误或威胁得以消除之前会保持有效状态。

在 Google Cloud 控制台中查看已忽略的发现结果

您可以在 Google Cloud 控制台中查看已静默的发现结果,方法是修改发现结果查询,以选择包含属性值 mute="MUTED" 的发现结果。

例如,以下发现结果查询仅显示已忽略的活跃发现结果:

state="ACTIVE"
AND mute="MUTED"

如需显示所有活跃的发现结果(包括已忽略的发现结果和取消忽略的发现结果),请完全省略查询中的 mute 属性:

state="ACTIVE"

默认情况下, Google Cloud 控制台中的发现结果查询仅显示未忽略的发现结果。

查看按忽略规则类型忽略的发现结果

以下部分介绍了如何按忽略规则类型查询活跃发现结果。

如需详细了解如何列出特定的发现结果,请参阅过滤发现结果

已被静态忽略规则忽略的查询发现结果

如需显示在指定时间后被静态忽略规则忽略的活跃发现结果,请使用以下查询并检查 muteInitiator 属性,以确定发现结果是否已被静态忽略规则忽略。

state="ACTIVE" AND
muteInfo.staticMute.applyTime>=TIMESTAMP AND
muteInfo.staticMute.state="MUTED"

TIMESTAMP 替换为表示您要查询的时间段的开始日期和时间字符串。如需了解时间格式,请参阅 gcloud topic datetimes

已被动态忽略规则忽略的查询发现结果

如需显示在指定时间后由动态忽略规则忽略的活跃发现结果,请使用以下查询:

state="ACTIVE" AND
muteUpdateTime>=TIMESTAMP AND
contains(muteInfo.dynamicMuteRecords, muteConfig="PARENT_ID/muteConfigs/CONFIG_ID")

替换以下内容:

  • TIMESTAMP:表示您要查询的时间段的开始日期/时间字符串。如需了解时间格式,请参阅 gcloud topic datetimes
  • PARENT_ID:父级组织、文件夹或项目的 ID,以 organizations/123folders/456projects/789 格式指定。
  • CONFIG_ID:忽略规则的名称。ID 必须使用字母数字字符和连字符,且长度介于 1 到 63 个字符之间。

如需详细了解如何修改发现结果查询,请参阅在信息中心内创建或修改发现结果查询

停止已忽略的发现结果的通知和导出

如果您启用发现结果通知,则与通知过滤条件匹配的新的或更新的已忽略发现结果仍会导出到 Pub/Sub。

如需停止已忽略的发现结果的导出和通知,请在 NotificationConfig 过滤条件中使用 mute 属性来排除已忽略的发现结果。 例如,以下过滤条件仅发送有关未忽略或未设置忽略特性的有效发现结果的通知:

FILTER="state=\"ACTIVE\" AND -mute=\"MUTED\""