fix: approval DELETE pattern DOTALL flag allows newline bypass
This commit is contained in:
@@ -314,7 +314,9 @@ DANGEROUS_PATTERNS = [
|
||||
(r'\bdd\s+.*if=', "disk copy"),
|
||||
(r'>\s*/dev/sd', "write to block device"),
|
||||
(r'\bDROP\s+(TABLE|DATABASE)\b', "SQL DROP"),
|
||||
(r'\bDELETE\s+FROM\b(?!.*\bWHERE\b)', "SQL DELETE without WHERE"),
|
||||
# Use [^\n]* instead of .* so DOTALL mode does not cause a WHERE clause on the
|
||||
# *next* line to satisfy the negative lookahead, silently allowing DELETE without WHERE.
|
||||
(r'\bDELETE\s+FROM\b(?![^\n]*\bWHERE\b)', "SQL DELETE without WHERE"),
|
||||
(r'\bTRUNCATE\s+(TABLE)?\s*\w', "SQL TRUNCATE"),
|
||||
(r'>\s*/etc/', "overwrite system config"),
|
||||
(r'\bsystemctl\s+(-[^\s]+\s+)*(stop|restart|disable|mask)\b', "stop/restart system service"),
|
||||
|
||||
Reference in New Issue
Block a user