Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional Masking Policy does not need {{masked_column}} in its body #68

Open
Stchena opened this issue Jul 12, 2023 · 0 comments
Open

Comments

@Stchena
Copy link
Contributor

Stchena commented Jul 12, 2023

Conditional Masking Policy does not need {{masked_column}} in its body

Description:

After introducing #62 and using the change for a while I discovered that the masking policies' bodies don't really need the specific column name.

You can quite literally name it whatever and as long as you pass a proper column name during `ALTER TABLE ALTER COLUMN

Example:

I create a masking policy called default_string_mp_pii for the column email. Its signature visible after executing DESCRIBE MASKING POLICY default_string_mp_pii is then seen as containing (EMAIL STRING, ...).

When I then create or replace the exact same masking policy on column vulnerable_last_name, the masking policy's entry is lost, instead being replaced by the new signature containing VULNERABLE_LAST_NAME STRING, ...).

This jinja part is absolutely not needed and I feel it should be removed - instead relying on a generic "variable"-style name which will be the same regardless of column the masking policy is being applied to.

Proposed Solution:

  • Change {{masked_column}} to masked_column in masking policy DDL. This will prevent dbt from overwriting this parameter on each call.
  • remove the use of conditionally_masked_column in create_masking_policy.sql. It is not needed.
  • Remove the setting of conditionally_masked_column in get_masking_policy_list_for.... It is not needed.

Benefits:

Challenges:

  • Removing the parameter might break compatibility, but as far as I remember, I made it an optional parameter...

Additional Information:

When I find some time, I can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant