mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Modify test
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user