Ensuring data protection · Topic 1 of 5

Sensitive Data Protection, De-identification and Pseudonymization

Use Sensitive Data Protection to discover and inspect PII on Google Cloud, then redact, mask, tokenize or apply format preserving encryption.

  • 5 min
In a nutshell
  • Discovery profiles whole organizations; inspection jobs scan specific stores in depth.
  • infoTypes detect data; custom infoTypes use dictionaries or regex.
  • Redaction, masking, hashing and bucketing are one way; deterministic encryption and FPE are reversible.

What it is

Sensitive Data Protection (SDP), which includes the Cloud Data Loss Prevention (DLP) API, finds sensitive data such as names, card numbers and national IDs, and transforms it so it is safe to use. It works on data at rest in Google Cloud and on content you send to the API.

Its two jobs are finding sensitive data (discovery and inspection) and reducing risk (de-identification).

Data storesBigQuery, Cloud Storage, Cloud SQLDiscoverydata profilesInspectioninfoTypesDe identificationredact, mask, tokenizeSafe dataanalytics, ML

How it works

Finding sensitive data

FeatureWhat it doesUse
DiscoveryContinuously profiles BigQuery tables, Cloud SQL and Cloud Storage across an organization, folder or projectKnow where sensitive data lives and its risk level
Inspection jobsScan a specific table or bucket, once or on a schedule with job triggersDeep scan of known stores
Content inspectionInspect text or images sent in the API requestCheck data inline in an app or pipeline
Risk analysisk-anonymity and l-diversity measuresCheck whether de-identified data could still identify people

Detection uses infoTypes. Built-in ones include EMAIL_ADDRESS, CREDIT_CARD_NUMBER, PHONE_NUMBER and many country-specific IDs. Custom infoTypes use a dictionary or regular expression, for example employee IDs, and likelihood thresholds trade false positives against misses.

Findings and profiles can be sent to Security Command Center, BigQuery, Pub/Sub or Dataplex Universal Catalog. Saving settings as inspect templates keeps detection consistent across jobs.

De-identification methods

MethodReversibleKeeps formatTypical use
RedactionNoNoRemove the value entirely from text or logs
Replace with infoType nameNoNoShow [EMAIL_ADDRESS] instead of the value
Character maskingNoPartlyShow only the last four card digits
Cryptographic hashingNoNoConsistent one-way token for joining
Deterministic encryptionYes, with the keyNoJoinable tokens that authorised users can re-identify
Format preserving encryption (FPE)Yes, with the keyYesTokens that pass format checks in legacy systems
BucketingNoNoAges into ranges, salaries into bands
Date shiftingNoYesKeep intervals between dates, hide real dates

Pseudonymization means replacing identifiers with consistent tokens, using hashing, deterministic encryption or FPE. The same input always gives the same token, so analysts can count and join without seeing real values.

Reversible methods need a key; use a key wrapped by Cloud KMS rather than a raw key in the request. Re-identification calls the reidentify method with the same configuration and needs access to that key.

Example: tokenizing card numbers and hiding emails

{
  "item": {"value": "Card 4111111111111111 paid by ana@example.com"},
  "inspectConfig": {
    "infoTypes": [{"name": "CREDIT_CARD_NUMBER"}, {"name": "EMAIL_ADDRESS"}]
  },
  "deidentifyConfig": {
    "infoTypeTransformations": {
      "transformations": [
        {
          "infoTypes": [{"name": "EMAIL_ADDRESS"}],
          "primitiveTransformation": {"replaceWithInfoTypeConfig": {}}
        },
        {
          "infoTypes": [{"name": "CREDIT_CARD_NUMBER"}],
          "primitiveTransformation": {
            "cryptoReplaceFfxFpeConfig": {
              "cryptoKey": {
                "kmsWrapped": {
                  "wrappedKey": "BASE64_WRAPPED_KEY",
                  "cryptoKeyName": "projects/sec-keys/locations/global/keyRings/sdp/cryptoKeys/fpe"
                }
              },
              "commonAlphabet": "NUMERIC",
              "surrogateInfoType": {"name": "CARD_TOKEN"}
            }
          }
        }
      ]
    }
  }
}

The email becomes [EMAIL_ADDRESS]. The card number becomes a numeric token of the same length, prefixed with the surrogate name so it can be found and re-identified later. Save this as a de-identify template so every pipeline applies the same rules.

Where de-identification runs

PatternHow
Streaming or batch pipelineDataflow calls SDP before writing to BigQuery
Cloud Storage filesAn inspection job's action writes de-identified copies to another bucket
Application logs or chatCall content de-identify before storing
Prompts to AI modelsSDP or Model Armor screening before data reaches the model

A worked example

An insurer's data lake has unknown PII. The engineer turns on discovery for the organization, which profiles every BigQuery table and flags 60 tables with high sensitivity, published to Security Command Center.

New data flows through Dataflow, which calls a de-identify template: emails replaced, policy numbers tokenized with deterministic encryption, birth dates bucketed to years. Only the fraud team can re-identify, because only it has access to the KMS key.

DiscoveryorganizationHigh risk tablesSCC findingsDataflowde identify templateBigQuerytokens onlyFraud teamreidentify with key

How the exam asks about this

  • "Analysts must join customer records across tables without seeing real customer IDs, and a small team must be able to recover them." Deterministic encryption or FPE with a KMS-wrapped key.
  • "A legacy system validates that account numbers are 16 digits, but real numbers must not be stored there." Format preserving encryption.
  • "Find which BigQuery datasets across the organization contain sensitive data." Sensitive Data Protection discovery with data profiles.

What to remember for the exam

  • Discovery profiles whole organizations; inspection jobs scan specific stores in depth.
  • infoTypes detect data; custom infoTypes use dictionaries or regex.
  • Redaction, masking, hashing and bucketing are one way; deterministic encryption and FPE are reversible.
  • FPE keeps length and character set; use it when formats must survive.
  • Use KMS-wrapped keys and templates so tokens are consistent and re-identification is controlled.
Watch out

Hashing is not encryption. Hashed tokens cannot be re-identified, so choose deterministic encryption or FPE when the requirement says authorised users must recover the original value.

Common mistakes

Choosing masking when values must be recovered. Masking destroys data. Use a reversible cryptographic method instead.

Putting a raw key in the request. Anyone who sees the request or template can reverse the tokens. Wrap the key with Cloud KMS and restrict that key.

Scanning only known stores. Sensitive data often hides in tables nobody listed. Use discovery to find it first.

Check yourself

  • Which de-identification method keeps a 16-digit number as 16 digits and is reversible?

    Format preserving encryption, using CryptoReplaceFfxFpeConfig with a numeric alphabet and a KMS-wrapped key.

  • What is the difference between discovery and an inspection job?

    Discovery continuously profiles data across an organization, folder or project, while an inspection job scans a chosen table or bucket in detail.

  • Why use a surrogate infoType with FPE?

    It marks the token in the output so Sensitive Data Protection can find and re-identify it later.

Topic 1 of 5 in Ensuring data protection

Test yourself on Ensuring data protection

The full Google Cloud Professional Cloud Security Engineer question bank has 749 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.