# Data Security and Privacy

> Protect data with access control, masking, encryption and retention, and handle personal data in line with India's DPDP Act and global laws like GDPR. Free...

Canonical: https://www.internhack.in/roadmaps/tracks/data-engineer/data-security-privacy
Last updated: 2026-11-28

Protect data with access control, masking, encryption and retention, and handle personal data in line with India's DPDP Act and global laws like GDPR.

Intermediate · about 4 hours · difficulty 3/5

Learn first: [Data Catalogs and Governance](https://www.internhack.in/roadmaps/tracks/data-engineer/catalogs-governance), [Cloud Fundamentals for Data Engineers](https://www.internhack.in/roadmaps/tracks/data-engineer/cloud-fundamentals)

Data engineers hold the keys to the most sensitive data in a company: names, phone numbers, Aadhaar-linked details, payment data, health records. Mistakes here become headlines and legal problems.

### Access control

- **Role-based access control (RBAC)**: grant access to roles, not individuals.
- **Least privilege**: analysts get gold tables, not raw PII.
- **Row-level security** (a regional manager sees only their state) and **column-level security** or **dynamic masking** (show only the last 4 digits of a phone number).
- Service accounts per pipeline with only the permissions they need.

### Protecting PII

- **Classify** sensitive columns early and tag them.
- **Pseudonymise** with hashing or tokenisation where analysis does not need raw values. Hash with a salt; unsalted hashes of phone numbers are easy to reverse.
- **Minimise**: do not copy PII into tables that do not need it.
- **Retention**: delete data you no longer need; lifecycle rules and scheduled purges.
- **Deletion requests**: table formats with DELETE support (Delta, Iceberg) and lineage make "erase this user" feasible.

### The law

- India's **Digital Personal Data Protection Act, 2023 (DPDP Act)** and its rules set obligations on consent, purpose limitation, security safeguards, breach notification and data principal rights.
- Sector rules apply too, such as RBI's payment data localisation requirements.
- **GDPR** applies when handling EU residents' data, common in GCCs serving global clients.

Legal teams interpret the law; your job is to build systems that make compliance possible.

### Pitfalls

- Copying production PII into dev environments.
- Sharing data via public links or personal drives.
- Logging full records containing PII in pipeline logs.

You are ready to move on when you can implement role-based access and a masking policy on a PII column in your warehouse, and explain how your pipeline would handle a user's deletion request.

## Key concepts

- **RBAC and least privilege**
- **Row and column level security**
- **Dynamic data masking**
- **Hashing and tokenisation**
- **Retention and deletion requests**
- **DPDP Act 2023 basics**
- **GDPR basics**
- **RBI data localisation**

## Mini project

In your warehouse (or Postgres with views and roles), create analyst and engineer roles, mask phone numbers for analysts, add row-level filtering by state, and write a script that deletes a given user's data across all your tables, verified by lineage.

## Check yourself

Why is an unsalted SHA-256 hash of a 10-digit Indian mobile number not real protection?

## Free resources

- [Ministry of Electronics and IT (DPDP Act)](https://www.meity.gov.in/) (Government of India)
- [PostgreSQL row security policies](https://www.postgresql.org/docs/current/ddl-rowsecurity.html) (PostgreSQL)
- [Snowflake documentation (access control)](https://docs.snowflake.com/) (Snowflake)

Previous: [Data Lineage](https://www.internhack.in/roadmaps/tracks/data-engineer/lineage) · Next: [Cost and Performance Engineering](https://www.internhack.in/roadmaps/tracks/data-engineer/cost-performance)

## More in Governance, Security and Cost

- [Data Catalogs and Governance](https://www.internhack.in/roadmaps/tracks/data-engineer/catalogs-governance)
- [Data Lineage](https://www.internhack.in/roadmaps/tracks/data-engineer/lineage)
- [Data Security and Privacy](https://www.internhack.in/roadmaps/tracks/data-engineer/data-security-privacy)
- [Cost and Performance Engineering](https://www.internhack.in/roadmaps/tracks/data-engineer/cost-performance)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/data-engineer)
