'Google Cloud DLP - InfoType Detection, no results (Ruby)
I'm able to run inspection against text content without any issues, but am never able to get any positive findings against images. I'm running code that's almost exactly like the example code here: https://cloud.google.com/dlp/docs/inspecting-images#dlp-inspect-file-ruby.
My code:
parent = "projects/xxxxxxxx/locations/global"
inspect_config = {
info_types: [{name: "CREDIT_CARD_NUMBER"}],
min_likelihood: :POSSIBLE,
limits: { max_findings_per_request: 0 },
include_quote: true
}
dlp = Google::Cloud::Dlp.dlp_service
dlp.inspect_content(parent: parent,
inspect_config: inspect_config,
item: {
byte_item: {
type: :BYTES_TYPE_UNSPECIFIED,
data: File.open(credit_card.png, 'rb').read
}
})
I consistently get 0 findings in my results:
<Google::Cloud::Dlp::V2::InspectContentResponse: result: <Google::Cloud::Dlp::V2::InspectResult: findings: [], findings_truncated: false>>
I've tried multiple images of credit cards, including one I pulled from a blog post where the author had a positive finding from it (example #2).
I've also tried using the EMAIL_ADDRESS InfoType and pictures with email addresses in them with the same results. Some of the docs reference sending in a Base64 version of the image and I tried wrapping Base64.encode64(File.open(abs_filename, 'rb').read) with no luck as well. Any help or ideas here appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


