Fine-Grained Access Control in Spark 4 in Cloudera Data Engineering

Fine-grained access control protects sensitive data when you work in an interactive session on a secure Cloudera Data Engineering Compute running Spark 4. The administrator sets central policies that decide which tables you can read or change, which columns are hidden or partially masked and which rows you can view.

These policies apply automatically to every query you run, whether you write SQL or build queries in Python with DataFrames. You do not need to enable these policies, and you cannot disable them.

Supported operations

Viewing data

  • Masked columns

Columns can display a masked or partially masked value instead of the original value. For example, only the last four digits of an ID number, or a scrambled email address.

Different users might see different values in the same table based on their assigned policies.

  • Masking styles

Your administrator can configure how a column is masked using any of the following methods:

  • Display only the last four characters

  • Display only the first four characters

  • Replace with a fixed pattern

  • Replace with a scrambled value

  • Display nothing

  • Display only the year of a date

  • Apply a custom rule

  • Display the full, unmasked value in full for authorized users

  • Filtered rowsWith row-level filters, you can view only a subset of rows, such as rows belonging to your region. Counts and totals include only the rows you are allowed to view.

  • Blocked columns

    The administrator can block access to a single column. You can still read and query the rest of the table, but queries that select all columns fail if the blocked column is included.

  • Query-level mask enforcementYou cannot bypass column masks within a query. Masking applies in the following ways:

    • Searching or filtering on a masked column only matches the masked value.

    • Views, joins, totals, and built-in text functions all work on the masked value, never the original.

    • Python DataFrames enforce the same masking rules, including on data downloaded to your local machine.

  • Storage-level mask enforcement

You cannot bypass masks by reading a table's underlying storage files directly. Direct file access is denied or displays only the masked values.

  • Masked data copies

    When you are allowed to copy data into a new table, the copy contains the masked values, not the original values.

Changing data

  • Adding, changing and deleting dataYou can add, change or delete rows only if the administrator has granted permission to do so. Otherwise, you receive a “permission denied” message.

  • Changing table settings

    Changing a table's settings requires explicit permission, which is separate from permission to change the data.

  • Creating tables

    Creating a new table, including copying data into one, requires explicit permission from your administrator. Without it, the copy is denied, so data cannot be copied out to an unprotected table.

Code and settings in a Spark 4 session

  • Built-in functions: Standard SQL functions are available and operate normally.

  • User-defined functions and JAR files are not allowed

    To prevent your own code from reading protected data, the following actions are blocked:

    • Registering or calling user-defined functions, whether temporary or permanent, and whether written in SQL or Python. Registration is refused, or the function fails when called, and it never returns original values.

    • Adding JAR files to load your own code libraries.

    • Uploading files, such as JARs or Python files, from the client to the session.

    • Running external scripts from a query.

  • Ordinary settings can be changedYou can adjust everyday performance settings in your session.

  • Security settings are locked

    Settings that control data protection cannot be changed, cleared or disabled while the session runs.

    • This applies in both SQL and the programmatic client.

    • Data stays masked after any such attempt.

  • Protection cannot be disabled when a session starts

    Security settings sent when the session is created are ignored or corrected automatically.

  • Protection cannot be weakened for an entire Spark Compute Weaker security settings applied at compute level are overridden and new sessions stay protected.

Identity and privacy

You cannot impersonate another user

A session runs queries only as its owner. A request claiming another user's identity is refused, and so is a request with no identity.

  • Your session is private

    Only you can connect to your session, and you cannot connect to someone else's session.

  • Sessions cannot read the platform credentials

    Sessions run with a limited identity, and attempts to read system credentials from a session are refused.

Policy changes

  • Changes apply without a restart

    When your administrator changes a policy, your running session picks up the change within approximately a minute. You do not need to start a new session. This includes the following changes:

    • Adding or changing a row filter

    • Changing a mask style

    • Adding a mask to a new column or user

    • Turning a mask off and back on

    • Blocking a column

    • Granting or removing access

This also applies to tables or views you cached before the change. They display data under the updated policy, not the previous policy.

  • Role-based access

    Your administrator can grant policies to a role. If you belong to that role, its policies apply to you.

Reliability and safety in Spark 4

  • Spark 4 sessions do not start unprotected

    A new session that cannot load its policies fails to start.

  • Protection continues during a policy service outage

    • If the policy service becomes unavailable, running sessions continue applying the policies they already have without weakening data protection.

    • New sessions cannot start during the outage, so no session ever runs without policies.

    • When the service is available again, new sessions start normally with all protections, and new policy changes reach running sessions again.

  • Secure Spark Computes run only protected workloads

    • A secure Spark Compute accepts only protected interactive sessions.

    • It refuses batch Jobs and other session types, even when a Job is assigned to that Spark Compute after creation.

    • This restriction still holds after Spark Compute services restart.

  • The Spark Compute's security configuration recovers automatically

    • If the security configuration of a Spark Compute is removed or damaged, the valid configuration is restored automatically within seconds.

    • This recovery applies to configurations that cannot be read, configurations with protection disabled, and configurations with weakened security settings.

    • If a damaged configuration is not restored in time, new sessions fail to start rather than run unprotected.

    • New sessions started after recovery are protected normally.

Auditing and lineage

  • Access is logged

    • Data access, and refused actions such as blocked code or locked settings, are recorded.

    • Your administrator can review them in the policy service's audit view and the session logs.

    • Data lineage can run alongside. Lineage tracking can be turned on in protected sessions. Access control keeps working as usual when it is.

  • Data lineage can run alongside access control

    You can enable lineage tracking in protected sessions and access control continues working as usual.

Known limitations and unsupported features

Known limitations

  • Group-based policies

    A policy granted to a user group has no effect on group members. Policies granted to you by user name, or to a role you belong to, work as expected. Consequently, administrators must assign policies directly to individual users or roles instead of user groups.

  • Built-in functions that call internal system routines

    A small number of built-in functions that can call internal system routines are not blocked. However, masked data remains masked when you call those functions.

  • Lineage delivery

    Lineage events are sent, but delivery to the lineage store is not confirmed.

  • Lineage content

    The content of lineage records for masked columns is not confirmed.

Unsupported features

  • Batch jobs

    A secure Spark Compute runs only interactive Spark 4 sessions. Batch jobs require a Spark Compute without fine-grained access control.

  • Other session types

    Only the protected interactive Spark 4 session type is available on a secure Spark Compute.

  • User-defined functions and JAR files

    • You cannot create or use user-defined functions in SQL or Python.

    • You cannot add JAR files or upload code files to the session.

    • You cannot run external scripts.

    Use standard built-in functions instead. If a Job requires custom user-defined functions or JARs, run it on a Spark Compute without fine-grained access control.

  • Tag-based policies

    Policies based on data classification tags are not supported.

  • Instant policy updates

    Policy changes take up to approximately a minute to reach a running session.

  • Command-line tool

    The Cloudera Data Engineering command-line tool is not available for secure Spark Computes. Use the interactive session clients instead.