Privacy, security and AI
Data masking and access control: deciding who sees what
Contents
Most people who work with data do not need to see all of it. An analyst studying payment patterns does not need card numbers; a developer testing a new feature does not need real customers. Access control decides who may reach which data, and masking makes data useful without revealing what should stay hidden. Together they put the principle of least privilege into practice.
In short
- Decide access per role and per data class, not person by person and table by table.
- Distinguish environments: what is acceptable in production is rarely acceptable in test.
- Masking hides sensitive values: redaction, partial masking, substitution, generalization, tokenization, keyed hashing or synthetic data.
- Pseudonymized data is still personal data under the GDPR; only truly anonymized data is not.
- Review access regularly (recertification), and record why each role has the access it has.
Access control, the basics
| Concept | Meaning |
|---|---|
| Least privilege | Everyone gets the access their work needs, and no more |
| Need to know | Access to sensitive data requires a business reason, not only a position |
| Role-based access (RBAC) | Access is given to roles, people are given roles |
| Attribute-based access (ABAC) | Access depends on attributes of the person, the data and the context, such as department, classification or location |
| Row-level security | People see only the rows they may see, such as their own region’s customers |
| Column-level security | Sensitive columns are hidden or masked for some roles |
| Segregation of duties | No single person controls a sensitive process from start to end |
Deciding access per data class
The most manageable approach combines roles with the data classification:
| Role | Public and internal | Confidential | Personal data | Special categories |
|---|---|---|---|---|
| Customer service agent | Read | Read | Read | Masked |
| Marketing analyst | Read | Read | Masked | No access |
| Data scientist (production) | Read | Masked | Masked | No access |
| Developer (test environment) | Read | Masked | Synthetic | No access |
| Outside auditor | Read | Read, by request | Read, by request | By request |
Each cell is a decision with a reason that a data owner approved. Recording the justification makes access reviews and audits much easier.
Masking techniques
| Technique | What it does | Example | Reversible? |
|---|---|---|---|
| Redaction | Replaces the value entirely | ***** | No |
| Nulling | Removes the value | empty | No |
| Partial masking | Keeps part of the value visible | **** **** **** 4821 | No |
| Substitution | Replaces with a realistic fake value | A random name from a list | No |
| Shuffling | Moves real values between records | Birth dates swapped between customers | No, but real values remain |
| Generalization | Reduces precision | Age band 30–39 instead of a birth date | No |
| Tokenization | Replaces with a token; a protected vault holds the mapping | TKN-8F3A21 | Yes, through the vault |
| Keyed hashing | A one-way function with a secret key | A fixed code per customer, for joining data sets | Not without the key |
| Encryption | Reversible with the key; format-preserving variants keep the shape | An account number that still looks like one | Yes, with the key |
| Synthetic data | Generated data with similar statistical properties | A test database with no real people | No real records |
Two cautions. A plain hash of a value with few possibilities, such as a national identification number or a phone number, can be reversed by hashing every possible value; use a secret key. And shuffled or substituted data can still reveal real information if a few rare values remain.
Static and dynamic masking
- Static masking changes the data in a copy, for example when production data is copied to a test environment. The copy never holds the original values.
- Dynamic masking hides values at query time, depending on who asks. The data is unchanged; different roles see different results.
Test and development environments should normally receive statically masked or synthetic data. Copying production data into test as it is turns every test environment into a production-grade risk.
Pseudonymization and anonymization
Under the GDPR, pseudonymization means processing personal data so that it can no longer be attributed to a person without additional information kept separately and protected (Article 4(5)). Pseudonymized data is still personal data, but pseudonymization is a recognized safeguard (Articles 25 and 32).
Anonymized data, from which a person can no longer be identified by any means reasonably likely to be used, is not personal data (Recital 26). True anonymization is harder than it looks: rare combinations of values can identify people even without names.
Keeping access under control
- Define roles around how people work, each with an owner who approves membership.
- Set rules per role, data class and environment, with a justification.
- Implement them in each platform: database grants, row and column security, masking policies.
- Recertify regularly: the role owner confirms who still needs access, for example every six or twelve months.
- Log and monitor access to restricted data.
Common mistakes
- Access granted person by person. Nobody can say any more why someone has access.
- Production data in test. The weakest environment holds the most sensitive data.
- Plain hashing as anonymization. Hashed identifiers can often be reversed or linked.
- Masking only in one tool. Data exported to a spreadsheet loses the masking of the report.
- No recertification. People change jobs and keep their access.
- Role explosion. Hundreds of nearly identical roles are as unmanageable as individual grants.
Frequently asked questions
What is data masking?
Data masking replaces sensitive values with modified or fictitious ones, so that data can be used for testing, analysis or support without revealing what should stay protected. Techniques include redaction, partial masking, substitution, generalization, tokenization, keyed hashing and synthetic data.
What is the difference between static and dynamic data masking?
Static masking changes the values in a copy of the data, for example a test database, so the copy never holds the originals. Dynamic masking leaves the data unchanged and hides values at query time depending on who is asking.
Is pseudonymized data still personal data?
Yes. Under the GDPR, pseudonymized data can still be attributed to a person with additional information kept separately, so it remains personal data, although pseudonymization is a recognized safeguard. Only anonymized data, from which people can no longer be identified by reasonably likely means, falls outside the GDPR.
How often should access rights be reviewed?
Regularly and in proportion to the sensitivity of the data: commonly every six to twelve months for access to confidential and personal data, and more often for restricted data and privileged technical accounts. Changes of job should trigger a review straight away.