mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Add shlex.quote as sanitizer
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user