We are implementing a dynamic data masking solution on Azure Databricks using Unity Catalog ABAC policies and SQL UDFs for deterministic masking.
Our masking functions retrieve a secret key from a Databricks-backed secret scope using the secret() function.
The issue is that when users query a masked table, they appear to require READ permission on the secret scope, even though they are not the owners of the masking UDF.
Granting users READ permission defeats our security objective, as users who should only see masked data would also be able to retrieve the masking key.
My questions are:
Is this the expected behavior of secret() within Unity Catalog SQL UDFs?
Is there a supported way for a masking UDF to access a secret without granting the querying user direct access to it?
Would Unity Catalog Secrets or Unity Catalog External Secrets address this limitation?
Has anyone encountered a similar issue or found a recommended solution?
Any guidance would be greatly appreciated. Thanks!