Add data masking framework for dataset fields - #1813
Open
medhwu wants to merge 1 commit into
Open
Conversation
Implements a lightweight data masking (data desensitization) framework:
7 built-in masking rules:
- SHOW_LAST_4 / SHOW_FIRST_4: partial reveal
- HASH_SHA256: one-way cryptographic hash
- REDACT: full character replacement
- EMAIL_MASK: j***@example.com
- PHONE_MASK: 138****1234
- ID_CARD_MASK: 310**********1234
New REST API under /api/masking:
- GET /rules, GET /dataset-fields/{id}, GET /datasets/{id}
- POST /dataset-fields/{id}?ruleId=, DELETE /dataset-fields/{id}
New permissions: DATA_MASKING_RULE_MANAGE, DATA_MASKING_FIELD_MANAGE
Database (V0_0_103):
- masking_rule: rules with type, replacement, pattern
- dataset_field_masking: per-field binding, UNIQUE(field_id)
Design: display-only masking (original data untouched), reusable rules,
per-field granularity. Uses raw JOOQ DSL.field()/DSL.table() throughout
to avoid compile dependency on generated table classes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements a lightweight data masking framework for dataset fields, enabling organizations to protect sensitive metadata in compliance with GDPR, PIPL, HIPAA, PCI-DSS.
7 Built-in Masking Rules
SHOW_LAST_46222021234567890************7890SHOW_FIRST_4138123456781381*******HASH_SHA256test@example.coma7ffc6f8...(64 hex)REDACTSensitive Data**************EMAIL_MASKjohn@example.comj***@example.comPHONE_MASK13812345678138****5678ID_CARD_MASK310101199001011234310**********1234New REST API (
/api/masking/*)GET/rulesGET/dataset-fields/{fieldId}GET/datasets/{datasetId}POST/dataset-fields/{fieldId}?ruleId=DELETE/dataset-fields/{fieldId}New Permissions
DATA_MASKING_RULE_MANAGEandDATA_MASKING_FIELD_MANAGEadded to MANAGEMENT permissions.Why
ODD Platform currently has zero data masking capabilities. Organizations handling PII, financial data, or healthcare data have no way to protect sensitive column names or sample values in the data catalog. This blocks adoption in regulated industries.
How
Database
V0_0_103:masking_ruletable +dataset_field_maskingtable with foreign keys todataset_field(id)andowner(id).Backend: Full layered architecture -- DTOs (
MaskingRuleDto,DatasetFieldMaskingDto,MaskingRuleType), Repository (reactive JOOQ with soft-delete), Service (7 masking algorithms), Controller (5 REST endpoints).Design: Display-only masking (original data untouched), reusable rules, per-field granularity, raw JOOQ
DSL.field()/DSL.table()to avoid compile-time dependency.Checklist
ON CONFLICT DO NOTHING