首页 > 解决方案 > GCP Data Loss Prevention API How to deindentify free text column in table

问题描述

I have a scenario where, a table contains comments column which is free text. The comments column store user feedback and comments. I want to mask/deidentify it using Google Cloud Data Loss prevention API. While trying to deIdentify, I am observing that DLP API is deindetifying whole content of comment column and not sensitive content only. Example - if column contains 'My eamil id is xyz@abc.com' then I am get out as '** **** ** **...'

Here while sampling DLP api identifies email address as sensitive data in comments column.

I went through following example - Free text - https://cloud.google.com/dlp/docs/deidentify-sensitive-data and Table - https://cloud.google.com/dlp/docs/examples-deid-tables However I am looking for example where free text is part of column of specific table and while submitting DLP request I want to submit as whole table only and not separate free text only. Is there any kind of special handling required to achieve this ?

标签: google-cloud-platformgoogle-cloud-dlp

解决方案


  • 您可以使用以下方法执行此操作:projects.content.deidentify

  • 例如:以下是包含 2 列的示例表,其中一列是自由文本列。

S_No 自由文本栏
1 我的电子邮件是 aaaa@email.com
2 没有反馈
3 john@emai.co

要从 Free_text_column 中识别电子邮件 ID 信息,请执行以下步骤。

是配置了以下所有资源的示例 REST API 调用。将“<em>parent”字段中的“<em>project-ID”值替换为您的项目 ID 并执行调用。在输出中,我们可以看到 Free_text_column 中的电子邮件 ID 被替换为字符串“#####”。

  1. 首先创建“<em> DeidentifyConfig ”资源,如下所示,
  • 配置“<em>recordTransformations.fieldTransformations”字段,该字段将列名作为输入,让我们将转换应用于表中的该列。
  • 接下来,配置“<em>infoTypeTransformations.transformations.primitiveTransformation”字段,该字段采用转换值的规则。我们想用字符串“#####”替换电子邮件 ID,因此我们使用“<em>replaceConfig”字段并为其分配一个值来替换列数据中的电子邮件 ID。有关更多信息,请参阅DeidentifyConfig
  1. 接下来,创建“<em> item ”资源。因为我们的输入是一个表格,所以用标题(列名)和行(每列对应的值)配置“<em>item.table”字段。有关更多信息,请参阅ContentItem

  2. 最后,创建具有扫描过程配置描述的“<em> inspectConfig ”资源。“<em>inspectConfig.infoTypes”字段的输入是我们想要去识别的信息类型,在我们的例子中是“<em>EMAIL_ADDRESS” 有关详细信息,请参阅InspectConfig


推荐阅读