google-cloud-platform - 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 ?
解决方案
您可以使用以下方法执行此操作: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 被替换为字符串“#####”。
- 首先创建“<em> DeidentifyConfig ”资源,如下所示,
- 配置“<em>recordTransformations.fieldTransformations”字段,该字段将列名作为输入,让我们将转换应用于表中的该列。
- 接下来,配置“<em>infoTypeTransformations.transformations.primitiveTransformation”字段,该字段采用转换值的规则。我们想用字符串“#####”替换电子邮件 ID,因此我们使用“<em>replaceConfig”字段并为其分配一个值来替换列数据中的电子邮件 ID。有关更多信息,请参阅DeidentifyConfig。
接下来,创建“<em> item ”资源。因为我们的输入是一个表格,所以用标题(列名)和行(每列对应的值)配置“<em>item.table”字段。有关更多信息,请参阅ContentItem。
最后,创建具有扫描过程配置描述的“<em> inspectConfig ”资源。“<em>inspectConfig.infoTypes”字段的输入是我们想要去识别的信息类型,在我们的例子中是“<em>EMAIL_ADDRESS” 。有关详细信息,请参阅InspectConfig。
推荐阅读
- android - 尝试访问日志或打开监视器时 adb 卡住了
- angular - Spring Websocket 不适用于 ssl (wss)
- javascript - Realm.objects() 在 React Native 上返回空对象
- python - 使用pip时发生Tensorflow安装
- google-cloud-platform - auth0 和 Google Identity Platform 有什么区别?
- angularjs - 量角器失败:“url”参数必须是字符串类型。接收类型未定义
- python - 求和和比较数组两侧的函数
- html - 是否可以在背景中使用 svg 图像作为精灵图像?
- swift - Swift 通过条件传递两个代表
- python - Flask+PyMongo 的 JSON 解码器