-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathRedacting Sensitive Data with Cloud Data Loss Prevention
23 lines (23 loc) · 1.39 KB
/
Redacting Sensitive Data with Cloud Data Loss Prevention
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
git clone https://github.com/CodingWithHardik/synthtool
cd synthtool/samples/ && npm install
export PROJECT_ID=$DEVSHELL_PROJECT_ID
gcloud config set project $PROJECT_ID
gcloud services enable dlp.googleapis.com cloudkms.googleapis.com \
--project $PROJECT_ID
node inspectString.js $PROJECT_ID "My email address is jenny@somedomain.com and you can call me at 555-867-5309" > inspected-string.txt
cat inspected-string.txt
cat resources/accounts.txt
node inspectFile.js $PROJECT_ID resources/accounts.txt > inspected-file.txt
cat inspected-file.txt
gsutil cp inspected-string.txt gs://$DEVSHELL_PROJECT_ID-bucket
gsutil cp inspected-file.txt gs://$DEVSHELL_PROJECT_ID-bucket
node deidentifyWithMask.js $PROJECT_ID "My order number is F12312399. Email me at anthony@somedomain.com" > de-identify-output.txt
cat de-identify-output.txt
gsutil cp de-identify-output.txt gs://$DEVSHELL_PROJECT_ID-bucket
node redactText.js $PROJECT_ID "Please refund the purchase to my credit card 4012888888881881" CREDIT_CARD_NUMBER > redacted-string.txt
cat redacted-string.txt
node redactImage.js $PROJECT_ID resources/test.png "" PHONE_NUMBER ./redacted-phone.png
node redactImage.js $PROJECT_ID resources/test.png "" EMAIL_ADDRESS ./redacted-email.png
gsutil cp redacted-string.txt gs://$DEVSHELL_PROJECT_ID-bucket
gsutil cp redacted-phone.png gs://$DEVSHELL_PROJECT_ID-bucket
gsutil cp redacted-email.png gs://$DEVSHELL_PROJECT_ID-bucket