Merge PR #233: fix(security): add re.DOTALL to prevent multiline bypass of dangerous command detection
Authored by Farukest. Fixes #232.
This commit is contained in:
commit
4faf2a6cf4
2 changed files with 25 additions and 1 deletions
|
|
@ -60,7 +60,7 @@ def detect_dangerous_command(command: str) -> tuple:
|
|||
"""
|
||||
command_lower = command.lower()
|
||||
for pattern, description in DANGEROUS_PATTERNS:
|
||||
if re.search(pattern, command_lower, re.IGNORECASE):
|
||||
if re.search(pattern, command_lower, re.IGNORECASE | re.DOTALL):
|
||||
pattern_key = pattern.split(r'\b')[1] if r'\b' in pattern else pattern[:20]
|
||||
return (True, pattern_key, description)
|
||||
return (False, None, None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue