HANA DBadvanced

HANA Security: Roles, Privileges & Data Masking

Catalog and analytic privileges, role-based access control, and dynamic data anonymization/masking in HANA.

HANA security is a distinct topic from ABAP's PFCG authorization concept, and interviewers who ask about it specifically want to confirm a candidate understands database-level access control as its own discipline - relevant for BW/4HANA administrators, HANA-native application developers, and anyone responsible for a side-by-side HANA system where ABAP's authorization layer doesn't apply at all.

Object privileges are like a building's master keys controlling which rooms (tables/views) you can enter at all; analytic privileges are like a shared open-plan office where everyone has room access but each desk's monitor only displays that specific employee's own assigned files; dynamic data masking is a privacy screen over specific sensitive documents on every desk, blurring only the sensitive parts even for people who are otherwise allowed in the room.

Key Concepts

1
HANA's privilege model has several distinct privilege types serving different purposes: system privileges control administrative actions (creating schemas, managing users) at the instance level; object privileges (SELECT, INSERT, UPDATE, EXECUTE) control access to specific catalog objects like tables, views, and procedures, analogous to standard relational database GRANT semantics; and analytic privileges are HANA-specific, restricting access to specific rows/data ranges within a calculation view (e.g., a sales rep can query the same view as everyone else but only sees rows for their own assigned sales region) - functionally similar in spirit to row-level security in other databases but implemented as its own HANA-native privilege type tied specifically to calculation view consumption.
2
Roles bundle these privilege types together into a reusable, assignable package, and HANA supports both catalog roles (created and maintained directly via SQL, the traditional approach) and the more modern, source-code-controlled repository roles (.hdbrole design-time artifacts, deployable via HDI/HALM, version-controlled alongside the rest of an XSA/Cloud Foundry HANA application's artifacts) - a distinction worth explicitly calling out since it mirrors the general shift across SAP toward version-controlled, deployable design-time artifacts over manually-maintained runtime objects.
.hdbrole
3
A senior-level answer covers dynamic data masking and data anonymization views, which let sensitive columns (PII like national ID numbers, salary data) be selectively obscured (partial masking, full masking, or anonymization techniques like k-anonymity) for users without a specific unmask privilege, without needing separate masked and unmasked copies of the same table - directly relevant to compliance requirements like GDPR - and should be able to contrast analytic privileges (row-level access restriction) against dynamic masking (column-value obscuring for otherwise-permitted rows) as two complementary but distinct security mechanisms addressing different risks.