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

[ 问题咨询 ]oracle查询在没有配置脱敏规则、字段的情况下几乎所有字段都会被动态脱敏掉 #525

Closed
dbcmp opened this issue Nov 20, 2019 · 11 comments
Labels
area/oracle enhancement New feature or request question Further information is requested

Comments

@dbcmp
Copy link

dbcmp commented Nov 20, 2019

问题描述

oracle查询在没有配置脱敏规则、字段的情况下几乎所有字段都会被动态脱敏掉,关闭DATA_MASKING后正常。
DATA_MASKING关闭后,脱敏规则和脱敏字段配置是否都会失效?
image

版本信息

  • 应用版本/分支:Release v1.7.1
  • 部署方式:Docker
@dbcmp dbcmp added the question Further information is requested label Nov 20, 2019
@dbcmp
Copy link
Author

dbcmp commented Nov 20, 2019

DATA_MASKING关闭后,单独配置的别的mysql的脱敏规则和脱敏字段配置是否都会失效?

@dbcmp dbcmp changed the title [ 问题咨询 ] [ 问题咨询 ]oracle查询在没有配置脱敏规则、字段的情况下几乎所有字段都会被动态脱敏掉 Nov 20, 2019
@LeoQuote
Copy link
Collaborator

没有看到你的异常脱敏的情况, 可以截图看一下吗?

@dbcmp
Copy link
Author

dbcmp commented Nov 20, 2019

image
修改时间会被脱敏

@LeoQuote
Copy link
Collaborator

LeoQuote commented Nov 20, 2019

def brute_mask(sql_result):
"""输入的是一个resultset
sql_result.full_sql
sql_result.rows 查询结果列表 List , list内的item为tuple
返回同样结构的sql_result , error 中写入脱敏时产生的错误.
"""
# 读取所有的脱敏表达
masking_rules = DataMaskingRules.objects.all()
for reg in masking_rules:
compiled_r = re.compile(reg.rule_regex, re.I)

再确认一下 DataMaskingRules 表中有没有脱敏规则

@dbcmp
Copy link
Author

dbcmp commented Nov 20, 2019

这个数据库是新增的配置,确认没有在后台配置任何脱敏字段

@hhyo
Copy link
Owner

hhyo commented Nov 20, 2019

@LeoQuote oracle和mssql一样是直接匹配所有规则的,忽略了脱敏字段的配置,对整个查询结果生效,脱敏的正则规则尽量不要通配,匹配指定格式应该可以缓解这个问题

后面这一块可以调整

@dbcmp
Copy link
Author

dbcmp commented Nov 20, 2019

image
image
image

看了源码sql.engines.oracle.py 和 sql.engines.mysql.py

@dbcmp
Copy link
Author

dbcmp commented Nov 20, 2019

脱敏调用的方法不一样,oracle直接匹配所有规则,不走脱敏字段配置

@dbcmp
Copy link
Author

dbcmp commented Nov 20, 2019

尝试一整天严格的分组正则,做不到不误伤oracle的字段值。。。
坐等大佬调整代码,死等...

@stale
Copy link

stale bot commented Nov 23, 2019

你已经很久没有回复这个issue了,如果没有进一步的信息的话, 会作为不活跃issue关闭, 感谢你对本项目的贡献。
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 23, 2019
@hhyo hhyo added enhancement New feature or request and removed wontfix This will not be worked on labels Nov 24, 2019
@hhyo
Copy link
Owner

hhyo commented Dec 1, 2019

#145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oracle enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants