Skip to content

Commit

Permalink
fix critical DDL check return
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmin committed Jan 21, 2019
1 parent f4499ae commit e85c0bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sql/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def criticalDDL(self, sqlContent):
map(lambda x: re.compile(r'(^--\s+.*|^/\*.*\*/;\s*$)').sub('', x, count=1),sqlContent.splitlines(1))).strip()
for row in sqlContent.rstrip(';').split(';'):
if re.match(r"([\s\S]*)drop(\s+)database(\s+.*)|([\s\S]*)drop(\s+)table(\s+.*)|([\s\S]*)truncate(\s+.*)|([\s\S]*)truncate(\s+)partition(\s+.*)|([\s\S]*)truncate(\s+)table(\s+.*)", row.lower()):
result = ('', '', 2, '驳回高危SQL', '不能包含【DROP DATABASE】|【DROP TABLE】|【TRUNCATE PARTITION】|【TRUNCATE TABLE】关键字!', row, '', '', '', '')
result = ('', '', 2, '驳回高危SQL', '不能包含【DROP DATABASE】|【DROP TABLE】|【TRUNCATE PARTITION】|【TRUNCATE TABLE】关键字!', row, '', '', '', '', '')
criticalSqlFound = 1
else:
result = ('', '', 0, '', 'None', row, '', '', '', '')
Expand Down

0 comments on commit e85c0bd

Please sign in to comment.