我正在开发使用数据泄露防护(GCP)的 PII 识别应用程序。我正在使用去识别模板作为去识别规则。
问题:我无法弄清楚如何在去识别模板中使用自定义信息类型。
以下是去识别化模板示例:
{
"deidentifyTemplate":{
"displayName":"Email and id masker",
"description":"De-identifies emails and ids with a series of asterisks.",
"deidentifyConfig":{
"infoTypeTransformations":{
"transformations":[
{
"infoTypes":[
{
"name":"EMAIL_ADDRESS"
}
],
"primitiveTransformation":{
"characterMaskConfig":{
"maskingCharacter":"*"
}
}
}
]
}
}
}
}
在上面的示例中,它是一个 bool 信息类型(电子邮件),在文档中自定义信息类型片段如下所示:
"inspect_config":{
"custom_info_types":[
{
"info_type":{
"name":"CUSTOM_ID"
},
"regex":{
"pattern":"[1-9]{2}-[1-9]{4}"
},
"likelihood":"POSSIBLE"
}
]
}
去识别模板的其余文档中没有有效的inspect_config
对象定义,它仅在检查模板中有效。
是否可以在识别模板中使用自定义信息类型(infoTypeTransformations
)?
这是link用于其余文档。
最佳答案
是的,可以使用自定义信息类型。需要做的是创建一个去识别模板和一个检查模板。
然后,当您调用 API 时,您将这两个模板作为参数发送。 对于使用 dlp 客户端库的 python,这里是一些示例伪代码
from google.cloud import dlp_v2
dlp_client = dlp_v2.DlpServiceClient()
dlp_client.deidentify_content(
request={
inspect_template_name = "projects/<project>/locations/global/inspectTemplates/<templateId>,
deidentify_template_name = "projects/<project>/locations/global/deidentifyTemplates/<templateId>,
parent = <parent>,
item = <item>
}
)
关于google-cloud-platform - 如何在防数据泄露(谷歌云平台)去识别模板中使用自定义信息类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65093584/