mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Merge pull request #13782 from jorgectf/jorgectf/shlex-quote
Python: Add `shlex.quote` as `py/shell-command-constructed-from-input` sanitizer
This commit is contained in:
@@ -46,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