Skip to content

Commit

Permalink
脱敏规则不区分大小写 (#2347)
Browse files Browse the repository at this point in the history
* 修改脱敏不区分大小写

* 如果脱敏规则配置时大小写混用转成小写匹配
  • Loading branch information
woshiyanghai authored Oct 25, 2023
1 parent fa2bb13 commit 2411ca0
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 2411ca0

Please sign in to comment.