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

修改默认的正则表达式,添加Redis的高危操作命令 #2580

Merged
merged 10 commits into from
Apr 12, 2024
10 changes: 8 additions & 2 deletions 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 All @@ -227,7 +228,12 @@ def is_auto_review(self) -> bool:
# 匹配成功, 代表需要人工复核
return False
# 影响行数加测, 总语句影响行数超过指定数量则需要人工审核
all_affected_rows += int(review_result.affected_rows)
# 很多时候预测影响行数为0,影响行数规模判断。如果为0行,则改为1行。
feiazifeiazi marked this conversation as resolved.
Show resolved Hide resolved
all_affected_rows += (
1
if int(review_result.affected_rows) == 0
else int(review_result.affected_rows)
)
if all_affected_rows > int(
self.sys_config.get("auto_review_max_update_rows", 50)
):
Expand Down
Loading