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

数据库查询字段不区分大小写,脱敏失败问题 #2332

Closed
wants to merge 18 commits into from
Closed

数据库查询字段不区分大小写,脱敏失败问题 #2332

wants to merge 18 commits into from

Conversation

woshiyanghai
Copy link
Contributor

@woshiyanghai woshiyanghai commented Oct 13, 2023

fix #2328

解决数据库脱敏失败问题,mysql,sqlserver,oracle 列名不区分大小写,pg区分,所以考虑在脱敏表中新添加一个字段标记是否区分大小写。

@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c8fac7e) 75.75% compared to head (ffff3f8) 75.75%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2332   +/-   ##
=======================================
  Coverage   75.75%   75.75%           
=======================================
  Files         108      108           
  Lines       15681    15687    +6     
=======================================
+ Hits        11879    11884    +5     
- Misses       3802     3803    +1     
Files Coverage Δ
sql/admin.py 92.85% <ø> (ø)
sql/models.py 96.59% <100.00%> (+0.01%) ⬆️
sql/utils/data_masking.py 89.70% <100.00%> (-0.45%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@LeoQuote LeoQuote left a comment

Choose a reason for hiding this comment

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

如果是数据库的特性的话, 在 engine 部分实现比较好

@woshiyanghai
Copy link
Contributor Author

如果是数据库的特性的话, 在 engine 部分实现比较好
不算是一种特性,更多的和我们写sql语句的时候大小写关系更多一些。

@woshiyanghai woshiyanghai reopened this Oct 20, 2023
@LeoQuote

This comment was marked as off-topic.

@LeoQuote
Copy link
Collaborator

看一下 CI, 必须要过才能合并, 可以先 rebase 下 master 谢谢

@woshiyanghai
Copy link
Contributor Author

如果你这个功能放在instance字段里, 那添加数据库实例的时候就要思考是否大小写敏感, 但实际上大小写敏感还是不敏感, 只需要确认他是什么数据库就可以, 如你所说 mysql,sqlserver,oracle 列名不区分大小写,pg区分 , 那为什么不在各自的 engine 里写就行了呢, 还需要录入的人自己去确认是否区分大小写, 是不是没有必要了?

脱敏这个功能不是很通用,有的时候不会去配置脱敏规则,如果在需要配置脱敏规则的时候,标注下当前规则是否区分大小写,更方便一些感觉。

src/init_sql/v1.10.0.sql Outdated Show resolved Hide resolved
src/init_sql/v1.10.0.sql Outdated Show resolved Hide resolved
@hhyo
Copy link
Owner

hhyo commented Oct 20, 2023

这块是不是匹配时直接不区分大小写就可以了

没有太大的必要单独配置

@woshiyanghai
Copy link
Contributor Author

这块是不是匹配时直接不区分大小写就可以了

没有太大的必要单独配置

直接不区分大小写的话其实大部分时候是可以的,就是对于配置规则的人来说,如果他有个字段他真的是大写或者大小写混合,最后也会被脱敏掉,可能稍微有一点点奇怪, 对于区分大小写的pg数据库,如果大写的字段被小写的规则命中脱敏掉,好像不是很合理。

@hhyo
Copy link
Owner

hhyo commented Oct 24, 2023

既然除了大小写都一样,理论上存储内容也不应该有太大差别,先做最小化调整在匹配时忽略大小写吧

@woshiyanghai
Copy link
Contributor Author

重新修改代码!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

脱敏后发现,如果对敏感字段中大小写修改,与配置脱敏不一致,将导致脱敏失效
3 participants