Modify test

This commit is contained in:
jorgectf
2023-07-24 17:50:22 +02:00
parent 3ac94c33b2
commit 8f8c064632

View File

@@ -1,13 +1,9 @@
import os
import subprocess
import shlex
def unsafe_shell_one(name):
os.system("ping " + name) # $result=BAD
# shlex.quote sanitizer
os.system("ping " + shlex.quote(name)) # $result=OK
# f-strings
os.system(f"ping {name}") # $result=BAD
@@ -50,4 +46,8 @@ def subprocess_flag (name):
subprocess.Popen("ping " + name, shell=unknownValue) # OK - shell assumed to be False
def intentional(command):
os.system("fish -ic " + command) # $result=OK - intentional
os.system("fish -ic " + command) # $result=OK - intentional
import shlex
def unsafe_shell_sanitized(name):
os.system("ping " + shlex.quote(name)) # $result=OK - sanitized