Inspecting structured text for sensitive data

Cloud Data Loss Prevention (DLP) can detect and classify sensitive data within structured content such as CSV or JSON. By inspecting or de-identifying as a table, the structure and columns provide Cloud DLP with additional clues that may enable it to provide better results for some use cases.

Inspecting a table

The code samples below demonstrate how to check a table of data for sensitive content. Tables support a variety of types.

See the JSON quickstart for more information about using the Cloud DLP API with JSON.

JSON Input:

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

{
  "item":{
    "table":{
      "headers": [{"name":"name"}, {"name":"phone"}],
      "rows": [{
        "values":[
          {"string_value": "John Doe"},
          {"string_value": "(206) 555-0123"}
        ]}
      ],
    }
  },
  "inspectConfig":{
    "infoTypes":[
      {
        "name":"PHONE_NUMBER"
      }
    ],
    "includeQuote":true
  }
}

JSON Output:

{
  "result": {
    "findings": [
     {
      "quote": "(206) 555-0123",
      "infoType": {
       "name": "PHONE_NUMBER"
      },
      "likelihood": "VERY_LIKELY",
      "location": {
         "byteRange": {
          "end": "14"
         },
         "codepointRange": {
          "end": "14"
         },
         "contentLocations": [
          {
           "recordLocation": {
              "fieldId": {
               "name": "phone"
              },
              "tableLocation": {
              }
           }
          }
         ]
      },
      "createTime": "2019-03-08T23:55:10.980Z"
     }
    ]
  }
}

Text versus structured text

Structuring text can help provide context. The same request as the one in the previous example, if inspected as a string—that is, as just "John Doe, (206) 555-0123"—would provide less accurate findings. That's because Cloud DLP has fewer contextual clues about what the purpose of the number might be. When possible, consider parsing your strings into a table object for the most accurate scan results.

หน้านี้มีประโยชน์ไหม โปรดแสดงความคิดเห็น