Skip to content

Commit

Permalink
修改默认的正则表达式,添加Redis的高危操作命令 (#2580)
Browse files Browse the repository at this point in the history
* 修改默认的正则表达式,添加redis的高危操作

* 修改影响行数由0改1

* 修改正则表达式

* 扫描/影响行数, 添加tooltip

* 添加tooltip

* 修改影响行数 审核信息

* Redis-Check添加说明-影响行数后续支持

* Redis-Check添加说明-影响行数后续支持

* check时的message显示修改。暂不支持显示影响行数

---------

Co-authored-by: 王飞 <fei.wang@xgo.one>
  • Loading branch information
feiazifeiazi and 王飞 authored Apr 12, 2024
1 parent c036fa3 commit 9477201
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions sql/engines/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def execute_check(self, db_name=None, sql=""):
id=line,
errlevel=0,
stagestatus="Audit completed",
errormessage="None",
errormessage="暂不支持显示影响行数",
sql=cmd,
affected_rows=0,
execute_time=0,
Expand All @@ -204,7 +204,7 @@ def execute_workflow(self, workflow):
id=line,
errlevel=0,
stagestatus="Execute Successfully",
errormessage="None",
errormessage="暂不支持显示影响行数",
sql=cmd,
affected_rows=0,
execute_time=t.cost,
Expand Down
4 changes: 2 additions & 2 deletions sql/engines/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def test_execute_check(self):
id=1,
errlevel=0,
stagestatus="Audit completed",
errormessage="None",
errormessage="暂不支持显示影响行数",
sql=sql,
affected_rows=0,
execute_time=0,
Expand All @@ -440,7 +440,7 @@ def test_execute_workflow_success(self, _execute_command):
id=1,
errlevel=0,
stagestatus="Execute Successfully",
errormessage="None",
errormessage="暂不支持显示影响行数",
sql=sql,
affected_rows=0,
execute_time=0,
Expand Down
3 changes: 2 additions & 1 deletion sql/utils/workflow_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def is_auto_review(self) -> bool:

# 获取正则表达式
auto_review_regex = self.sys_config.get(
"auto_review_regex", "^alter|^create|^drop|^truncate|^rename|^delete"
"auto_review_regex",
"^alter|^create|^drop|^truncate|^rename|^delete|^del|^flushdb|^flushall|^lpop|^rpop",
)
p = re.compile(auto_review_regex, re.I)

Expand Down

0 comments on commit 9477201

Please sign in to comment.