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

脱敏规则不区分大小写 #2347

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sql/utils/data_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def analyze_query_tree(select_list, instance):
"""解析select list, 返回命中脱敏规则的列信息"""
# 获取实例全部激活的脱敏字段信息,减少循环查询,提升效率
masking_columns = {
f"{i.instance}-{i.table_schema}-{i.table_name}-{i.column_name}": model_to_dict(
f"{i.instance}-{i.table_schema}-{i.table_name}-{i.column_name.lower()}": model_to_dict(
i
)
for i in DataMaskingColumns.objects.filter(instance=instance, active=True)
Expand All @@ -102,6 +102,7 @@ def analyze_query_tree(select_list, instance):
column.get("table"),
column.get("field"),
)
field = field.lower()
masking_column = masking_columns.get(
f"{instance}-{table_schema}-{table}-{field}"
)
Expand Down