Skip to content

Commit

Permalink
dbname is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote committed Aug 8, 2023
1 parent 54ecb4d commit 9f5be70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sql/plugins/sqladvisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def check_args(self, args):
result = super().check_args(args)
if result["status"] != 0:
return result
db_name = args.get("d", "")
db_name = args.get("d")
if not db_name:
return result
# 防止 db_name 注入
db_pattern = r"[a-zA-Z0-9-_]+"
if not re.match(db_pattern, db_name):
return {
Expand Down

0 comments on commit 9f5be70

Please sign in to comment.