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

fix(data-security): data masking failed when using nesting case-when clause #1410

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

smallsheeeep
Copy link
Contributor

What type of PR is this?

type-bug
module-data security

What this PR does / why we need it:

When executing following SQL (with nesting case-when), then masking failed due to extract sensitive column failed:

SELECT
  id,
  name,
  CASE
    WHEN birthday < '1990-01-01' THEN 1
    WHEN birthday < '2010-01-01' THEN CASE
      WHEN birthday < '2005-01-01' THEN 21
      WHEN birthday < '2010-01-01' THEN 22
    END
    WHEN birthday < '2020-01-01' THEN 3
    ELSE 4
  END AS decade
FROM
  test_data_masking_1;

The root cause is that the column extractor does not consider syntactic scenarios where case-when is nested within case-when. This PR fix it and add unit test.

By the way, the incorrect file formatting in .editconfig causing indentation configuration to not take effect, incidentally fixed.

Which issue(s) this PR fixes:

Fixes #1391

Special notes for your reviewer:

Self-test passed.

Additional documentation e.g., usage docs, etc.:


@smallsheeeep smallsheeeep added type-bug Something isn't working priority-medium module-Data security Parent module of data-masking, sensitive rule, masking algorithm, etc. labels Jan 17, 2024
@smallsheeeep smallsheeeep added this to the ODC 4.2.4 milestone Jan 17, 2024
@smallsheeeep smallsheeeep self-assigned this Jan 17, 2024
Copy link
Contributor

@yhilmare yhilmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@yhilmare yhilmare merged commit 051c0af into dev/4.2.x Jan 17, 2024
11 checks passed
@yhilmare yhilmare deleted the bugfix/gaoda_42x_fix_data_masking_case_when branch January 17, 2024 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-Data security Parent module of data-masking, sensitive rule, masking algorithm, etc. priority-medium type-bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: nested case...when... constructs,Causing desensitization to fail
2 participants