File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
aikido_zen/vulnerabilities/code_injection Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
2
from .detect_code_injection import detect_code_injection
3
+
4
+
5
+ def is_injection (statement , user_input = None ):
6
+ if user_input == None :
7
+ assert detect_code_injection (statement , statement ) is True
8
+ else :
9
+ assert detect_code_injection (statement , user_input ) is True
10
+
11
+
12
+ def is_not_injection (statement , user_input = None ):
13
+ if user_input == None :
14
+ assert detect_code_injection (statement , statement ) is False
15
+ else :
16
+ assert detect_code_injection (statement , user_input ) is False
17
+
18
+
19
+ def test_not_dangerous_comments ():
20
+ is_not_injection ("# Hello! This (Might) Be Dangerous" )
21
+ is_not_injection (
22
+ """# Well hello
23
+ # Hello there !"""
24
+ )
25
+ is_not_injection (' """Hello again!""" ' )
26
+
27
+
28
+ def test_newline_and_indent_not_dangerous ():
29
+ is_not_injection ("\n \n \n \n \n \n \n \n " )
30
+ is_not_injection ("\r \n \r \n \r \n " )
31
+ is_not_injection (" " )
32
+ is_not_injection (" " )
33
+ is_not_injection (" \r \n \n \n \t " )
You can’t perform that action at this time.
0 commit comments