InfoType 及 infoType 偵測工具

Sensitive Data Protection 會使用資訊類型 (或 infoType) 定義要掃描的內容。infoType 是一種機密資料類型,例如姓名、電子郵件地址、電話號碼、身分證字號、信用卡號碼等。infoType 偵測工具是相應的偵測機制,可比對 infoType 的比對條件。

選取 infoType 的最佳做法

瞭解資料是保護資料的重要第一步。最佳做法是只收集、儲存及處理業務所需的資訊。識別處理的資料後,您就能做出明智決策,保障業務、使用者、資料安全性與隱私權的資安態勢。

部分商業用途可能需要特定機密資訊,其他用途則不需要。沒有任何單一解決方案能支援所有用途。因此,Sensitive Data Protection 提供彈性控制項,可讓您指定要掃描的資料類型。如果您使用 infoType 進行去識別化或遮蓋,也可以控管資料轉換的時間和方式。

一般指南

選取 infoType 時,請參考下列一般準則。

使用一般 infoType 取代特定 infoType

如果掃描結果不需顯示偵測到的特定 infoType,建議您在檢查設定中使用一般 infoType,而非特定 infoType。如要瞭解在要求中使用一般 infoType 偵測工具的優點,請參閱本頁的「一般和特定 infoType 偵測工具」一節。

如需一般 infoType 及其包含的特定 infoType 完整清單,請參閱「一般 infoType」。

不需收集的機密資訊

貴商家中的每項服務都應只收集該服務所需的資料。舉例來說,貴公司的某些服務不需要收集財務資訊。針對這些服務,建議啟用 infoType 偵測工具,例如 CREDIT_CARD_NUMBER、FINANCIAL_ACCOUNT_NUMBER 和產業類別 FINANCE 中的其他 infoType。

需要收集,但不想與團隊廣泛分享的資訊

收集個人資訊可能有正當用途,但您不應與團隊廣泛分享這類資訊。舉例來說,提交支援單的客戶可能會提供聯絡資訊,方便您聯絡他們解決問題。您不希望團隊中查看票證的所有人都能看到個人識別資訊 (PII)。建議您啟用 infoType 偵測工具,例如 PHONE_NUMBER、EMAIL_ADDRESS 和 PII 類型類別中的其他 infoType。

受產業、資料隱私權或管轄區法規規範的機密資料類別

某些資訊類型因核發方式或用途,會被視為機密資訊。在其他情況下,情境和客層資訊會視為受保護類別。這類資訊在收集、使用和管理方面可能會有額外限制。建議啟用下列類別的 infoType 偵測工具:

選擇類似的 infoType

選擇類似的 infoType 偵測工具時,請考量下列事項。

護照

如果不需要掃描特定國家/地區的護照 ID,請選擇一般偵測工具:PASSPORT。

我們提供特定國家/地區的護照偵測工具,例如 UK_PASSPORT。不過,部分國家/地區專屬的護照偵測工具只能識別特定格式或含有情境線索的護照。

人名

掃描使用者姓名時,請在多數用途中使用 PERSON_NAME,而非 FIRST_NAME 或 LAST_NAME。

PERSON_NAME 是人名偵測工具。包括單字名稱和全名。這項偵測工具會嘗試使用各種技術 (包括自然語言理解),偵測 Jane、Jane Smith 和 Jane Marie Smith 等名稱。FIRST_NAME 和 LAST_NAME 是這個偵測工具的子集,會嘗試識別名稱的部分。這些偵測工具的發現項目一律是 PERSON_NAME 發現項目的子集。

日期和時間

如果不需要掃描所有日期,建議使用 DATE_OF_BIRTH 等指定日期偵測工具。這項偵測工具會嘗試找出表示日期與某人出生日期相關的內容。

DATE 偵測工具會嘗試找出所有日期,無論背景資訊為何。此外,也會標記相對日期,例如「今天」或「昨天」。同樣地,TIME 會嘗試找出所有時間戳記。

位置

如果不需要掃描所有位置,建議使用 STREET_ADDRESS,而非 LOCATION 偵測工具。STREET_ADDRESS 偵測工具會嘗試找出完整位址,這類位址通常比大概位置更精確,因此可視為更敏感的資訊。

LOCATION infoType 偵測工具會嘗試找出任何位置,無論內容為何,例如「Paris」或「Canada」。

需要情境資訊的 infoType 偵測工具

許多 infoType 偵測工具需要有情境線索,才能找出相符項目。如果內建 infoType 偵測工具未標記您預期標記的項目,因為這些項目附近沒有出現情境線索,請考慮改用 GENERIC_ID 或自訂 infoType 偵測工具。

缺乏業界通用定義的資訊類型

部分資訊類型缺乏通用的業界定義。例如病歷號碼、帳號、PIN 碼和安全碼。針對這些類型,建議使用 GENERIC_ID、FINANCIAL_ACCOUNT_NUMBER 和 MEDICAL_RECORD_NUMBER 等 infoType。這些偵測工具會結合實體偵測和情境,找出可能含有機密資訊的元素。

延遲時間較長的 infoType 偵測工具

  • 請避免啟用不需要的 infoType 偵測工具。雖然下列 infoType 在某些情況下很有用,但與不含這些 infoType 的要求相比,這些 infoType 會大幅降低要求的執行速度:

    • PERSON_NAME
    • FEMALE_NAME
    • MALE_NAME
    • FIRST_NAME
    • LAST_NAME
    • DATE_OF_BIRTH
    • LOCATION
    • STREET_ADDRESS
    • ORGANIZATION_NAME
  • 請一律明確指定 infoType 偵測工具。請勿使用空白的 infoTypes 清單。

如何使用 infoType

Sensitive Data Protection 會在掃描設定中使用 infoType 偵測工具,判斷要檢查的內容及如何轉換發現項目。顯示或回報掃描結果時,也會使用 infoType 名稱。

舉例來說,如要在文字區塊中尋找電子郵件地址,請在檢查設定中指定 EMAIL_ADDRESS infoType 偵測工具。如要從文字區塊中遮蓋電子郵件地址,請在檢查設定和去識別化設定中指定 EMAIL_ADDRESS,指出如何遮蓋或轉換該類型。

此外,您也可以結合使用內建和自訂 infoType 偵測工具,從掃描結果中排除部分電子郵件地址。首先,建立名為 INTERNAL_EMAIL_ADDRESS 的自訂 infoType,並設定排除內部測試電子郵件地址。接著,您可以設定掃描作業,納入 EMAIL_ADDRESS 的發現項目,但加入排除規則,排除任何符合 INTERNAL_EMAIL_ADDRESS 的發現項目。如要進一步瞭解排除規則和自訂 infoType 偵測工具的其他功能,請參閱「建立自訂 infoType 偵測工具」。

Sensitive Data Protection 提供一組內建的 infoType 偵測工具,您可以依名稱指定,每個偵測工具都列在「InfoType 偵測工具參考資料」中。這些偵測工具會使用各種技術,探索及分類各種類型。舉例來說,某些類型需要模式比對、某些類型可能需要數學核對和、某些類型有特殊數字限制,而其他類型則可能具有特定前置字元或發現項目周圍的內容。

範例

設定 Sensitive Data Protection 掃描內容時,請在掃描設定中加入要使用的 infoType 偵測工具。

舉例來說,下列 JSON 和程式碼範例示範了向 DLP API 提出的簡單掃描要求。請注意,PHONE_NUMBER 偵測工具是在 inspectConfig 中指定,這會指示 Sensitive Data Protection 掃描指定字串中的電話號碼。

C#

如要瞭解如何安裝及使用 Sensitive Data Protection 的用戶端程式庫,請參閱「Sensitive Data Protection 用戶端程式庫」。

如要向 Sensitive Data Protection 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


using System;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dlp.V2;

public class InspectPhoneNumber
{
    public static InspectContentResponse Inspect(
        string projectId,
        string text,
        Likelihood minLikelihood = Likelihood.Possible)
    {
        // Instantiate a client.
        var dlp = DlpServiceClient.Create();

        // Set content item.
        var contentItem = new ContentItem { Value = text };

        // Construct inspect config.
        var inspectConfig = new InspectConfig
        {
            InfoTypes = { new InfoType { Name = "PHONE_NUMBER" } },
            IncludeQuote = true,
            MinLikelihood = minLikelihood
        };

        // Construct a request.
        var request = new InspectContentRequest
        {
            ParentAsLocationName = new LocationName(projectId, "global"),
            InspectConfig = inspectConfig,
            Item = contentItem,
        };

        // Call the API.
        var response = dlp.InspectContent(request);

        // Inspect the results.
        var resultFindings = response.Result.Findings;

        Console.WriteLine($"Findings: {resultFindings.Count}");

        foreach (var f in resultFindings)
        {
            Console.WriteLine("\tQuote: " + f.Quote);
            Console.WriteLine("\tInfo type: " + f.InfoType.Name);
            Console.WriteLine("\tLikelihood: " + f.Likelihood);
        }

        return response;
    }
}

Go

如要瞭解如何安裝及使用 Sensitive Data Protection 的用戶端程式庫,請參閱「Sensitive Data Protection 用戶端程式庫」。

如要向 Sensitive Data Protection 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import (
	"context"
	"fmt"
	"io"

	dlp "cloud.google.com/go/dlp/apiv2"
	"cloud.google.com/go/dlp/apiv2/dlppb"
)

// inspectPhoneNumber demonstrates a simple scan request to the Cloud DLP API.
// Notice that the PHONE_NUMBER detector is specified in inspectConfig,
// which instructs Cloud DLP to scan the given string for a phone number.
func inspectPhoneNumber(w io.Writer, projectID, textToInspect string) error {
	// projectID := "my-project-id"
	// textToInspect := "My phone number is (123) 555-6789"

	ctx := context.Background()

	// Initialize a client once and reuse it to send multiple requests. Clients
	// are safe to use across goroutines. When the client is no longer needed,
	// call the Close method to cleanup its resources.
	client, err := dlp.NewClient(ctx)
	if err != nil {
		return err
	}
	// Closing the client safely cleans up background resources.
	defer client.Close()

	// Create and send the request.
	req := &dlppb.InspectContentRequest{
		Parent: fmt.Sprintf("projects/%s/locations/global", projectID),
		Item: &dlppb.ContentItem{
			DataItem: &dlppb.ContentItem_Value{
				Value: textToInspect,
			},
		},
		InspectConfig: &dlppb.InspectConfig{
			// Specify the type of info the inspection will look for.
			// See https://cloud.google.com/dlp/docs/infotypes-reference
			// for complete list of info types
			InfoTypes: []*dlppb.InfoType{
				{Name: "PHONE_NUMBER"},
			},
			IncludeQuote: true,
		},
	}

	// Send the request.
	resp, err := client.InspectContent(ctx, req)
	if err != nil {
		fmt.Fprintf(w, "receive: %v", err)
		return err
	}

	// Process the results.
	result := resp.Result
	fmt.Fprintf(w, "Findings: %d\n", len(result.Findings))
	for _, f := range result.Findings {
		fmt.Fprintf(w, "\tQuote: %s\n", f.Quote)
		fmt.Fprintf(w, "\tInfo type: %s\n", f.InfoType.Name)
		fmt.Fprintf(w, "\tLikelihood: %s\n", f.Likelihood)
	}
	return nil
}

Java

如要瞭解如何安裝及使用 Sensitive Data Protection 的用戶端程式庫,請參閱「Sensitive Data Protection 用戶端程式庫」。

如要向 Sensitive Data Protection 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。


import com.google.cloud.dlp.v2.DlpServiceClient;
import com.google.privacy.dlp.v2.ContentItem;
import com.google.privacy.dlp.v2.Finding;
import com.google.privacy.dlp.v2.InfoType;
import com.google.privacy.dlp.v2.InspectConfig;
import com.google.privacy.dlp.v2.InspectContentRequest;
import com.google.privacy.dlp.v2.InspectContentResponse;
import com.google.privacy.dlp.v2.Likelihood;
import com.google.privacy.dlp.v2.LocationName;
import java.io.IOException;

public class InspectPhoneNumber {

  public static void main(String[] args) throws Exception {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String textToInspect = "My name is Gary and my email is gary@example.com";
    inspectString(projectId, textToInspect);
  }

  // Inspects the provided text.
  public static void inspectString(String projectId, String textToInspect) 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. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (DlpServiceClient dlp = DlpServiceClient.create()) {
      // Specify the type and content to be inspected.
      ContentItem item = ContentItem.newBuilder().setValue(textToInspect).build();

      // Specify the type of info the inspection will look for.
      // See https://cloud.google.com/dlp/docs/infotypes-reference for complete list of info types
      InfoType infoType = InfoType.newBuilder().setName("PHONE_NUMBER").build();

      // Construct the configuration for the Inspect request.
      InspectConfig config =
          InspectConfig.newBuilder()
              .setIncludeQuote(true)
              .setMinLikelihood(Likelihood.POSSIBLE)
              .addInfoTypes(infoType)
              .build();

      // Construct the Inspect request to be sent by the client.
      InspectContentRequest request =
          InspectContentRequest.newBuilder()
              .setParent(LocationName.of(projectId, "global").toString())
              .setItem(item)
              .setInspectConfig(config)
              .build();

      // Use the client to send the API request.
      InspectContentResponse response = dlp.inspectContent(request);

      // Parse the response and process results
      System.out.println("Findings: " + response.getResult().getFindingsCount());
      for (Finding f : response.getResult().getFindingsList()) {
        System.out.println("\tQuote: " + f.getQuote());
        System.out.println("\tInfo type: " + f.getInfoType().getName());
        System.out.println("\tLikelihood: " + f.getLikelihood());
      }
    }
  }
}

Node.js

如要瞭解如何安裝及使用 Sensitive Data Protection 的用戶端程式庫,請參閱「Sensitive Data Protection 用戶端程式庫」。

如要向 Sensitive Data Protection 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

// Imports the Google Cloud Data Loss Prevention library
const DLP = require('@google-cloud/dlp');

// Instantiates a client
const dlp = new DLP.DlpServiceClient();

// The project ID to run the API call under
// const projectId = 'my-project';

// The string to inspect
// const string = 'My email is gary@example.com and my phone number is (223) 456-7890.';

// The minimum likelihood required before returning a match
// const minLikelihood = 'LIKELIHOOD_UNSPECIFIED';

// The maximum number of findings to report per request (0 = server maximum)
// const maxFindings = 0;

// The infoTypes of information to match
// See https://cloud.google.com/dlp/docs/concepts-infotypes for more information
// about supported infoTypes.
// const infoTypes = [{ name: 'PHONE_NUMBER' }];

// The customInfoTypes of information to match
// const customInfoTypes = [{ infoType: { name: 'DICT_TYPE' }, dictionary: { wordList: { words: ['foo', 'bar', 'baz']}}},
//   { infoType: { name: 'REGEX_TYPE' }, regex: {pattern: '\\(\\d{3}\\) \\d{3}-\\d{4}'}}];

// Whether to include the matching string
// const includeQuote = true;

async function inspectPhoneNumber() {
  // Construct item to inspect
  const item = {value: string};

  // Construct request
  const request = {
    parent: `projects/${projectId}/locations/global`,
    inspectConfig: {
      infoTypes: infoTypes,
      customInfoTypes: customInfoTypes,
      minLikelihood: minLikelihood,
      includeQuote: includeQuote,
      limits: {
        maxFindingsPerRequest: maxFindings,
      },
    },
    item: item,
  };

  // Run request
  const [response] = await dlp.inspectContent(request);
  const findings = response.result.findings;
  if (findings.length > 0) {
    console.log('Findings:');
    findings.forEach(finding => {
      if (includeQuote) {
        console.log(`\tQuote: ${finding.quote}`);
      }
      console.log(`\tInfo type: ${finding.infoType.name}`);
      console.log(`\tLikelihood: ${finding.likelihood}`);
    });
  } else {
    console.log('No findings.');
  }
}
inspectPhoneNumber();

PHP

如要瞭解如何安裝及使用 Sensitive Data Protection 的用戶端程式庫,請參閱「Sensitive Data Protection 用戶端程式庫」。

如要向 Sensitive Data Protection 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

use Google\Cloud\Dlp\V2\Client\DlpServiceClient;
use Google\Cloud\Dlp\V2\ContentItem;
use Google\Cloud\Dlp\V2\InfoType;
use Google\Cloud\Dlp\V2\InspectConfig;
use Google\Cloud\Dlp\V2\InspectContentRequest;
use Google\Cloud\Dlp\V2\Likelihood;

/**
 * Inspect data for phone numbers
 * Demonstrates a simple scan request to the Cloud DLP API. Notice that the PHONE_NUMBER detector is specified in inspectConfig, which instructs Cloud DLP to scan the given string for a phone number.
 *
 * @param string $projectId         The Google Cloud project id to use as a parent resource.
 * @param string $textToInspect     The string to inspect.
 */
function inspect_phone_number(
    // TODO(developer): Replace sample parameters before running the code.
    string $projectId,
    string $textToInspect = 'My name is Gary and my phone number is (415) 555-0890'
): void {
    // Instantiate a client.
    $dlp = new DlpServiceClient();

    $parent = "projects/$projectId/locations/global";

    // Specify what content you want the service to Inspect.
    $item = (new ContentItem())
        ->setValue($textToInspect);

    $inspectConfig = (new InspectConfig())
        // The infoTypes of information to match
        ->setInfoTypes([
            (new InfoType())->setName('PHONE_NUMBER'),
        ])
        // Whether to include the matching string
        ->setIncludeQuote(true)
        ->setMinLikelihood(Likelihood::POSSIBLE);

    // Run request
    $inspectContentRequest = (new InspectContentRequest())
        ->setParent($parent)
        ->setInspectConfig($inspectConfig)
        ->setItem($item);
    $response = $dlp->inspectContent($inspectContentRequest);

    // Print the results
    $findings = $response->getResult()->getFindings();
    if (count($findings) == 0) {
        printf('No findings.' . PHP_EOL);
    } else {
        printf('Findings:' . PHP_EOL);
        foreach ($findings as $finding) {
            printf('  Quote: %s' . PHP_EOL, $finding->getQuote());
            printf('  Info type: %s' . PHP_EOL, $finding->getInfoType()->getName());
            printf('  Likelihood: %s' . PHP_EOL, Likelihood::name($finding->getLikelihood()));
        }
    }
}

Python

如要瞭解如何安裝及使用 Sensitive Data Protection 的用戶端程式庫,請參閱「Sensitive Data Protection 用戶端程式庫」。

如要向 Sensitive Data Protection 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

import google.cloud.dlp


def inspect_phone_number(
    project: str,
    content_string: str,
) -> None:
    """Uses the Data Loss Prevention API to analyze strings for protected data.
    Args:
        project: The Google Cloud project id to use as a parent resource.
        content_string: The string to inspect phone number from.
    """

    # Instantiate a client.
    dlp = google.cloud.dlp_v2.DlpServiceClient()

    # Prepare info_types by converting the list of strings into a list of
    # dictionaries (protos are also accepted).
    info_types = [{"name": "PHONE_NUMBER"}]

    # Construct the configuration dictionary.
    inspect_config = {
        "info_types": info_types,
        "include_quote": True,
    }

    # Construct the `item`.
    item = {"value": content_string}

    # Convert the project id into a full resource id.
    parent = f"projects/{project}"

    # Call the API.
    response = dlp.inspect_content(
        request={"parent": parent, "inspect_config": inspect_config, "item": item}
    )

    # Print out the results.
    if response.result.findings:
        for finding in response.result.findings:
            print(f"Quote: {finding.quote}")
            print(f"Info type: {finding.info_type.name}")
            print(f"Likelihood: {finding.likelihood}")
    else:
        print("No findings.")

REST

JSON 輸入:

POST https://dlp.googleapis.com/v2/projects/[PROJECT-ID]/content:inspect?key={YOUR_API_KEY}

{
  "item":{
    "value":"My phone number is (415) 555-0890"
  },
  "inspectConfig":{
    "includeQuote":true,
    "minLikelihood":"POSSIBLE",
    "infoTypes":{
      "name":"PHONE_NUMBER"
    }
  }
}

將上述要求傳送至指定端點時,Sensitive Data Protection 會傳回下列內容:

JSON 輸出內容:

{
  "result":{
    "findings":[
      {
        "quote":"(415) 555-0890",
        "infoType":{
          "name":"PHONE_NUMBER"
        },
        "likelihood":"VERY_LIKELY",
        "location":{
          "byteRange":{
            "start":"19",
            "end":"33"
          },
          "codepointRange":{
            "start":"19",
            "end":"33"
          }
        },
        "createTime":"2018-10-29T23:46:34.535Z"
      }
    ]
  }
}

您必須在檢查設定中指定參考資料列出的特定 infoType。如未指定任何 infoType,Sensitive Data Protection 會使用預設的 infoType 清單,但僅供測試用途。預設清單可能不適用於您的用途。

要進一步瞭解如何使用 infoType 偵測工具掃描您的內容,請參閱有關檢查、遮蓋或去識別化的操作教學主題。

確定性和測試

系統會以稱為「可能性」的確定性分數回報發現項目。可能性分數代表發現項目與相應類型相符的可能性。舉例來說,如果某個類型只符合模式,則可能傳回較低的可能性;如果符合模式且周圍有正向情境,則可能傳回較高的可能性。因此,您可能會發現單一發現項目可能與多個類型相符,但可能性較低。此外,如果發現項目不相符,或周圍有負面背景資訊,可能就不會顯示或確定度較低。舉例來說,如果發現項目符合指定 infoType 的結構,但未通過 infoType 的核對和,系統可能就不會回報該發現項目。或者,發現項目可能符合多個 infoType,但有背景資訊可提升其中一個 infoType 的可能性,因此只會回報該類型。

測試各種偵測工具時,您可能會發現系統未回報假資料或樣本資料,因為這類資料未通過足夠的檢查,無法回報。

infoType 偵測工具的種類

Sensitive Data Protection 包含多種 infoType 偵測工具,以下是所有工具的摘要:

  • 內建 infoType 偵測工具內建於 Sensitive Data Protection。包括國家/地區或區域專屬敏感資料類型,以及全球適用的資料類型。您也可以使用一般 infoType,簡化設定。
  • 自訂 infoType 偵測工具是您自行建立的偵測工具。自訂 infoType 偵測工具分為三種:
    • 小型自訂字典偵測工具是 Sensitive Data Protection 比對的簡單字詞清單。如果字詞或詞組清單最多只有數萬個,請使用小型自訂字典偵測工具。如果您預期字詞清單不會有大幅變動,建議使用小型自訂字典偵測工具。
    • 大型自訂字典偵測工具是由 Sensitive Data Protection 產生,使用儲存在 Cloud Storage 或 BigQuery 中的大型字詞或詞組清單。如果您有大量字詞或詞組 (最多數千萬個),請使用大型自訂字典偵測工具。
    • 規則運算式 (regex) 偵測工具可讓 Sensitive Data Protection 根據規則運算式模式偵測相符項目。

如要修正掃描結果,可以建立檢查規則。

內建 InfoType 偵測工具

內建 infoType 偵測工具內建於 Sensitive Data Protection,包括特定國家/地區機密資料類型的偵測工具,例如法國 Numéro d'Inscription au Répertoire (NIR) (FRANCE_NIR)、英國駕照號碼 (UK_DRIVERS_LICENSE_NUMBER) 和美國身分證字號 (US_SOCIAL_SECURITY_NUMBER)。此外,也包含全球適用的資料類型,例如人名 (PERSON_NAME)、電話號碼 (PHONE_NUMBER)、電子郵件地址 (EMAIL_ADDRESS) 和信用卡號 (CREDIT_CARD_NUMBER)。

內建 infoType 偵測工具的清單會隨時更新。如需目前支援的內建 infoType 偵測工具的完整清單,請參閱 InfoType 偵測工具參考資料。

您也可以呼叫 Sensitive Data Protection 的 infoTypes.list 方法,查看所有內建 infoType 偵測工具的完整清單。

偵測技術

為偵測與內建 infoType 相應的內容,Sensitive Data Protection 會運用各種技術,包括模式比對、核對和驗證、機器學習和情境分析。舉例來說,如要偵測 CREDIT_CARD_NUMBER infoType,Sensitive Data Protection 會檢查已知的發卡機構前置字元、驗證核對和、分析字元長度,並考量潛在卡號出現的背景資訊。

Sensitive Data Protection 示範是網頁式應用程式,可用來測試內建的 infoType 偵測工具。

語言支援

特定國家/地區的 infoType 支援英文和該國家/地區的語言。大多數全域 infoType 都支援多種語言。使用您的資料測試 Sensitive Data Protection,確認符合需求。

一般和特定 infotype 偵測工具

一般 infoType 偵測工具的定義比一般 infoType 偵測工具更廣泛,可比對多種潛在私密資訊類型。一般 infoType 偵測工具是特定 infoType 偵測工具的超集,具有共同屬性或用途。舉例來說,DRIVERS_LICENSE_NUMBER infoType 偵測工具可以偵測與 GERMANY_DRIVERS_LICENSE_NUMBER 和 CANADA_DRIVERS_LICENSE_NUMBER infoType 相符的內容。

在許多情況下,一般 infoType 偵測工具也能找到特定 infoType 偵測工具無法找到的比對結果。舉例來說,PASSPORT 偵測工具比特定國家/地區的護照偵測工具更擅長找出護照號碼,後者有時需要有內容線索或特定格式的內容。

在檢查設定中,您可以使用一般 infoType 偵測工具,取代特定 infoType 偵測工具。Sensitive Data Protection 會根據您在要求中指定的偵測工具顯示結果。舉例來說,如果您檢查的字串符合 GERMANY_DRIVERS_LICENSE_NUMBER infoType,且您在要求中同時掃描 DRIVERS_LICENSE_NUMBER 和 GERMANY_DRIVERS_LICENSE_NUMBER,則會針對同一個字串取得兩項發現項目,一項是 DRIVERS_LICENSE_NUMBER,另一項是 GERMANY_DRIVERS_LICENSE_NUMBER。不過,如果您在要求中只掃描 DRIVERS_LICENSE_NUMBER,檢查結果就只會顯示 DRIVERS_LICENSE_NUMBER 的發現項目。

使用一般 infoType 偵測工具具有下列優點:

  • 在許多情況下,一般 infoType 偵測工具的喚回度高於特定 infoType 偵測工具。召回率是指真陽性例項數量占相關例項總數的比例。

  • 您不必指定要掃描的每個 infoType,因此可以簡化 Sensitive Data Protection 要求。舉例來說,光是 GOVERNMENT_ID infoType 偵測工具就包含超過 100 種不同的 infoType 偵測工具。

  • 您不太可能達到每項要求 150 個 infoType 偵測工具的上限。

  • 如果 Sensitive Data Protection 發布新的 infoType,並將其新增至現有設定中已指定的一般 infoType,則 Sensitive Data Protection 會自動將新的 infoType 納入掃描範圍。您不必手動將新發布的 infoType 新增至現有設定。

一般和特定 infoType 之間為多對多關係。也就是說,一般 infoType 可以包含多個特定 infoType,而特定 infoType 可以屬於多個一般 infoType。如需一般 infoType 的完整清單,以及其中包含的特定 infoType,請參閱「一般 infoType」。

自訂 infoType 偵測工具

自訂 infoType 偵測工具分為三種:

如要修正掃描結果,可以建立檢查規則。

小型自訂字典偵測工具

使用小型自訂字典偵測工具 (也稱為「一般自訂字典偵測工具」),比對簡短 (最多數萬個) 的字詞或詞組清單。小型自訂字典可做為專屬的偵測工具。

如果您要掃描的字詞或詞組清單不易使用規則運算式或內建偵測工具進行比對時,即適合使用自訂字典偵測工具。例如,假設您要掃描會議室,一般會使用指定名稱而非號碼來稱呼會議室,如州或地區名稱、地標、虛構角色等。您可以建立小型自訂字典偵測工具,其中包含這些會議室名稱的清單。Sensitive Data Protection 可掃描內容中的每個會議室名稱,並在內容中遇到其中一個名稱時傳回相符項目。如要進一步瞭解 Sensitive Data Protection 如何比對字典字詞和詞組,請參閱「建立一般自訂字典偵測工具」的「字典比對細節」一節。

如要進一步瞭解小型字典自訂 infoType 偵測工具的運作方式,以及實際範例,請參閱「建立一般自訂字典偵測工具」。

大型自訂字典偵測工具

如果您要掃描的字詞或詞組不只幾個,或字詞/詞組清單經常變更,請使用大型自訂字典偵測工具 (也稱為「儲存的自訂字典偵測工具」)。大型自訂字典偵測工具最多可比對數千萬個字詞或詞組。

大型自訂字典偵測工具的建立方式,與規則運算式自訂偵測工具和小型自訂字典偵測工具不同。每個大型自訂字典都有兩個元件:

  • 建立及定義的詞組清單。這份清單會儲存為 Cloud Storage 中的文字檔案,或 BigQuery 資料表中的資料欄。
  • 產生的字典檔案,由 Sensitive Data Protection 根據您的詞組清單建立。字典檔案儲存在 Cloud Storage 中,包含來源詞組資料的副本和布隆篩選器,有助於搜尋和比對。您無法直接編輯這些檔案。

建立字詞清單並使用 Sensitive Data Protection 產生自訂字典後,您可以使用大型自訂字典偵測工具,以類似其他 infoType 偵測工具的方式啟動或排定掃描。

如要進一步瞭解大型自訂字典偵測工具的運作方式,以及實際範例,請參閱「建立儲存的自訂字典偵測工具」。

規則運算式

您可以使用規則運算式 (regex) 自訂 infoType 偵測工具,建立自己的 infoType 偵測工具,讓 Sensitive Data Protection 根據規則運算式模式偵測相符項目。舉例來說,假設您有 ###-#-##### 格式的病歷號碼。您可以定義類似以下的規則運算式模式:

[1-9]{3}-[1-9]{1}-[1-9]{5}

Sensitive Data Protection 接著會比對如下項目:

123-4-56789

您也可以指定要指派給每個自訂 infoType 比對項目的可能性。也就是說,當 Sensitive Data Protection 比對到您指定的序列時,就會指派您指定的可能性。這項功能非常實用,因為如果自訂規則運算式定義的序列很常見,就很容易與其他隨機序列相符,您不會希望 Sensitive Data Protection 將每個相符項目都標示為 VERY_LIKELY。否則會降低掃描結果的可信度,並可能導致錯誤資訊遭到比對或去識別化。

如要進一步瞭解規則運算式自訂 infoType 偵測工具,並查看實際運作情形,請參閱「建立自訂規則運算式偵測工具」。

檢查規則

您可使用檢查規則來微調現有的內建或自訂 infoType 偵測工具傳回的結果。如果需要以某種方式擴增 Sensitive Data Protection 傳回的結果,無論是新增或排除現有的 infoType 偵測工具,檢查規則都能派上用場。

如要進一步瞭解檢查規則,請參閱「修改 infoType 偵測工具以精細調整掃描結果」。

排除規則

排除規則可讓您將規則新增到內建或自訂 infoType 偵測工具中,藉此減少傳回的發現項目數或精確度。排除規則可以協助您降低 infoType 偵測工具傳回的雜訊或其他不需要的發現項目。

舉例來說,如果您掃描資料庫中的電子郵件地址,可以新增自訂規則運算式形式的排除規則,指示 Sensitive Data Protection 排除任何結尾為「@example.com」的發現項目。

如要進一步瞭解排除規則,請參閱「修改 infoType 偵測工具以精細調整掃描結果」。

啟動字詞規則

啟動字詞規則可讓您將規則新增到內建或自訂 infoType 偵測工具中,藉此提高傳回的發現項目數量或準確性。啟動字詞規則可以有效協助您放寬現有 infoType 偵測工具的規則。

例如,假設您要掃描醫療資料庫中的患者姓名,您可以使用 Sensitive Data Protection 內建的 PERSON_NAME infoType 偵測工具,但這會導致 Sensitive Data Protection 比對所有人名,而不只是病患姓名。如要修正這個問題,您可以加入熱字規則,形式為規則運算式自訂 infoType,在潛在相符項目的第一個字元附近,尋找「病患」一詞。接著,您可以將符合這個模式的發現項目指派為「極可能」可能性,因為這些項目符合您的特殊條件。

如要進一步瞭解啟動字詞規則,請參閱「修改 infoType 偵測工具以精細調整掃描結果」。

範例

如要進一步瞭解 infoType 如何比對發現項目,請參考下列範例,瞭解如何比對一連串數字,判斷這些數字是否構成美國社會安全號碼或美國個人納稅人識別號碼。請注意,這些範例適用於內建 infoType 偵測工具。建立自訂 infoType 偵測工具時,您必須指定條件,決定掃描相符的可能性。

範例 1

"SSN 222-22-2222"

回報 US_SOCIAL_SECURITY_NUMBER 的高可能性分數為 VERY_LIKELY,原因如下:

  • 這組號碼採用標準社會安全號碼格式,因此確定性較高。
  • 附近有「SSN」這個情境,因此會提高 US_SOCIAL_SECURITY_NUMBER 的分數。

範例 2

"999-99-9999"

US_SOCIAL_SECURITY_NUMBER 的可能性分數偏低 (VERY_UNLIKELY),原因如下:

  • 採用標準格式,因此可信度較高。
  • 開頭為 9,這不是社會安全號碼,因此降低了確定性。
  • 缺少背景資訊,因此確定性較低。

範例 3

"999-98-9999"

回報US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER的可能性分數為 POSSIBLE,US_SOCIAL_SECURITY_NUMBER的可能性分數為 VERY_UNLIKELY,原因如下:

  • US_SOCIAL_SECURITY_NUMBER 和 US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER 均採用標準格式。
  • 開頭為 9,並有另一個數字檢查,可提高 US_INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER 的確定性。
  • 缺乏任何背景資訊,因此兩者的確定性都較低。

調整規則

調整規則可根據發現項目出現的情境,提高 (也稱為「提升」) 或降低發現項目的可能性值,進而提高偵測準確度。

舉例來說,您可以使用調整規則,提高 GENERIC_ID 發現項目出現在符合 DOCUMENT_TYPE/CONTEXT/FINANCE 的文件中時的可能性值。

詳情請參閱「調整規則」。

後續步驟

Sensitive Data Protection 團隊會定期發布新的 infoType 偵測工具和群組。如要瞭解如何取得最新的內建 infoType 清單,請參閱「列出內建 infoType 偵測工具」。