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

[ bug ]使用快捷键查询能绕过脱敏 #1106

Closed
DB-wang2 opened this issue May 31, 2021 · 7 comments · Fixed by #1178
Closed

[ bug ]使用快捷键查询能绕过脱敏 #1106

DB-wang2 opened this issue May 31, 2021 · 7 comments · Fixed by #1178
Labels
wontfix This will not be worked on

Comments

@DB-wang2
Copy link
Contributor

重现步骤

sql查询只选择实例不选择数据库,sql语句里表名前带上库名即dbname.tablename,用鼠标点击sql查询会提示选择数据库,但是如果使用键盘快捷键alt+回车(我的是mac,用的是command+回车)就会直接返回数据而且是未脱敏的。
QUERY_CHECK设置的是OFF

期待结果和实际结果

期待结果:对查询快捷键进行限制,提示必须选择数据库才能查询。

实际结果:

啊啊啊,图传不上来,反正就是通过快捷键可以不选库名进行查询并且使脱敏失效。

错误日志

[2021-05-31 14:52:23,781][DummyThread-350:140269294314312][task_id:default][data_masking.py:37][WARNING]- 数据脱敏异常,错误信息:Traceback (most recent call last):
File "/opt/archery/sql/utils/data_masking.py", line 32, in data_masking
query_tree = inception_engine.query_print(instance=instance, db_name=db_name, sql=sql)
File "/opt/archery/sql/engines/inception.py", line 178, in query_print
raise RuntimeError(f"Inception Error: {print_info['errmsg']}")
RuntimeError: Inception Error: 请使用USE DB来指定数据库

[2021-05-31 14:52:23,781][DummyThread-350:140269294314312][task_id:default][query.py:125][WARNING]- 数据脱敏异常,按照配置放行,查询语句:select * from dbname.t_user limit 100;,错误信息:Inception Error: 请使用USE DB来指定数据库

版本信息

应用版本/分支:版本v1.7.13

部署方式:Docker

@DB-wang2
Copy link
Contributor Author

经过测试QUERY_CHECK设置为ON再这样查询页面会显示【数据脱敏异常:Inception Error: 请使用USE DB来指定数据库】的错误。我们一般是设置为OFF的,因为Inception对一些语句无法脱敏设置为ON会影响正常使用。

@LeoQuote
Copy link
Collaborator

LeoQuote commented Jun 7, 2021

这个bug 应该是存在的, 应该是

<form id="form-sqlquery" action="/sqlquery/" method="post" class="form-horizontal" role="form">
这个 form 被快捷键触发, 自动提交了, 估计是之前的遗留代码, 你把这个form 的 action="/sqlquery/" method="post" 去掉再试试, 应该就不会触发bug了. 我这边基本没开发环境, 如果方便的话也麻烦你提个 pr 修复下吧

@DB-wang2
Copy link
Contributor Author

DB-wang2 commented Jun 7, 2021

image
改了容器里的代码并且重启了容器,还是没有用。

[2021-06-07 13:52:41,485][DummyThread-2:140207184134984][task_id:default][data_masking.py:37][WARNING]- 数据脱敏异常,错误信息:Traceback (most recent call last):
File "/opt/archery/sql/utils/data_masking.py", line 32, in data_masking
query_tree = inception_engine.query_print(instance=instance, db_name=db_name, sql=sql)
File "/opt/archery/sql/engines/inception.py", line 178, in query_print
raise RuntimeError(f"Inception Error: {print_info['errmsg']}")
RuntimeError: Inception Error: 请使用USE DB来指定数据库

[2021-06-07 13:52:41,485][DummyThread-2:140207184134984][task_id:default][query.py:125][WARNING]- 数据脱敏异常,按照配置放行,查询语句:select * from db.t_user limit 100;,错误信息:Inception Error: 请使用USE DB来指定数据库

@LeoQuote
Copy link
Collaborator

LeoQuote commented Jun 8, 2021

这个报错是什么报错, 是脱敏的配置问题吧, 我们现在只谈快捷键绕过脱敏的问题

@DB-wang2
Copy link
Contributor Author

DB-wang2 commented Jun 8, 2021

image
这样操作之后archery的log里就是上面那个报错,QUERY_CHECK设置的是OFF,设置为ON时这样查询页面会显示【数据脱敏异常:Inception Error: 请使用USE DB来指定数据库】的错误。

@DB-wang2
Copy link
Contributor Author

DB-wang2 commented Jun 8, 2021

给我的感觉是使用快捷键没有去检测用户选没选具体的库来查询,直接造成了脱敏异常,然后按照QUERY_CHECK=OFF给把sql放行了

@stale
Copy link

stale bot commented Jun 23, 2021

你已经很久没有回复这个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 Jun 23, 2021
@stale stale bot closed this as completed Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants