test: add additional multiline bypass tests for find patterns
Extra test coverage for newline bypass detection (DOTALL fix). Inspired by Bartok9's PR #245.
This commit is contained in:
parent
4faf2a6cf4
commit
7862e7010c
1 changed files with 10 additions and 0 deletions
|
|
@ -179,3 +179,13 @@ class TestMultilineBypass:
|
||||||
is_dangerous, _, desc = detect_dangerous_command(cmd)
|
is_dangerous, _, desc = detect_dangerous_command(cmd)
|
||||||
assert is_dangerous is True, f"multiline chmod bypass not caught: {cmd!r}"
|
assert is_dangerous is True, f"multiline chmod bypass not caught: {cmd!r}"
|
||||||
|
|
||||||
|
def test_find_exec_rm_with_newline(self):
|
||||||
|
cmd = "find /tmp \\\n-exec rm {} \\;"
|
||||||
|
is_dangerous, _, desc = detect_dangerous_command(cmd)
|
||||||
|
assert is_dangerous is True, f"multiline find -exec rm bypass not caught: {cmd!r}"
|
||||||
|
|
||||||
|
def test_find_delete_with_newline(self):
|
||||||
|
cmd = "find . -name '*.tmp' \\\n-delete"
|
||||||
|
is_dangerous, _, desc = detect_dangerous_command(cmd)
|
||||||
|
assert is_dangerous is True, f"multiline find -delete bypass not caught: {cmd!r}"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue