Sensitive Data Protection for ML Pipelines on the ML Engineer Exam

GCP Study Hub
October 5, 2026

Protecting personally identifiable information (PII) and protected health information (PHI) in cloud pipelines requires balancing privacy with what downstream systems still need from the data. On Google Cloud, Sensitive Data Protection (formerly Cloud Data Loss Prevention) automates discovering, classifying, redacting, and de-identifying sensitive values as well as performing risk analysis across a wide range of sources. That automation helps prevent accidental exposure or misuse while supporting regulatory compliance requirements such as GDPR and HIPAA. On the Professional Machine Learning Engineer exam, scenarios involving sensitive datasets usually come down to knowing where the service can scan data and choosing the de-identification technique that preserves the property downstream workflows still require.

Inspecting data across storage and pipelines

Sensitive Data Protection is designed to work both through native integrations with Google Cloud services and as a standalone API. One operational detail worth remembering is that although the product name changed, the underlying API was never renamed. When you enable the service in a project or call it from code, it still appears under its former DLP API name.

To tell Sensitive Data Protection what to look for, you configure information types, commonly called infoTypes. Each infoType acts as a detector for a single category of sensitive data, such as a person's name, an email address, or an identification number, and you select the detectors that apply to a given scan. Those scans can inspect and redact data across Cloud Storage, BigQuery, Dataflow, and Pub/Sub. That coverage lets teams protect data sitting in buckets and tables as well as data moving through pipelines.

Masking sensitive values while keeping readable context

Masking replaces part of a sensitive field with asterisks or other characters while leaving selected portions visible. We would lean toward masking when a pipeline needs to protect sensitive information while still keeping enough of the original value readable for analytics, verification, or troubleshooting.

  • Names: Keeping only the first letter of each word in a name such as John Doe and replacing the remaining letters with asterisks hides the person's identity while leaving enough text for general reference.
  • Email addresses: Replacing the middle characters while retaining the first character, the last character, and the full domain leaves the field recognizable as an email address for troubleshooting without exposing who it belongs to.
  • Credit card numbers: Masking every digit except the last four is a common pattern that protects the full number while still letting a customer or agent identify which card was used.
  • Social Security numbers: Keeping only the last four digits visible protects the individual's identity while preserving enough digits for verification.

Format-preserving encryption for downstream compatibility

When downstream workflows do not need human readability for troubleshooting or analytics, but still require the data to keep its original structure, format-preserving encryption (FPE) is the stronger choice. FPE replaces the real value with an encrypted value that matches the shape of the input, and unlike hashing, it preserves a path back to the original value.

Applying FPE to the same four fields illustrates how the structure survives even though the details change:

  • Names: A two-word name such as John Doe is replaced by a different pair of words with capitalized first letters, keeping the two-word format while removing the recognizable name.
  • Email addresses: The original address is swapped for another string that still follows the username and domain pattern of an email address, with all underlying details changed.
  • Credit card numbers: The encrypted output preserves the 16-digit structure divided into groups of four with spaces, changing only the digits themselves.
  • Social Security numbers: The three-digit, two-digit, four-digit pattern stays intact while the underlying numbers are replaced.

The practical advantage of FPE is that downstream systems do not need to change. A validation check that expects 16 digits, a database column with a fixed length, or a form that expects an email pattern all continue working on the encrypted value. Teams gain data protection without rewriting processes that depend on a specific format.

Cryptographic hashing for irreversible record matching

Cryptographic hashing goes further than FPE by giving up the original format entirely. It passes the input through a one-way function with a secret key to produce a fixed-length string. Because the function is one-way, hashing is irreversible, and there is no path back to the original value.

The same input always produces the same hash, which makes hashing useful for joining records rather than for readable analytics. If a customer's email address is hashed in the same way across two different tables, downstream queries can join those tables on the hashed value without either system storing the real email. Whether the input is a short name like John Doe, a longer email address like johndoe@example.com, a credit card number, or a Social Security number, every output has the exact same fixed length. The resulting hash reveals nothing about the content, size, or shape of what went in.

Choosing the right technique on the exam

For the Professional Machine Learning Engineer exam, selecting between these three de-identification methods comes down to identifying what the downstream workload still needs to keep:

  • Masking keeps part of the real value human-readable for analytics, verification, or troubleshooting.
  • Format-preserving encryption discards readability while preserving the format, length, and pattern expected by downstream schemas, validation checks, or forms, and remains reversible.
  • Cryptographic hashing discards readability, format, and length, providing an irreversible fixed-length output that preserves only the ability to match and join records consistently across tables.

Our Professional Machine Learning Engineer course covers Sensitive Data Protection alongside BigQuery and Dataflow data pipelines, with practice questions that drill these distinctions.

Get tips and updates from GCP Study Hub

arrow