mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #5880 from tausbn/python-limit-builtins
Python: Limit set of globals that may be built-ins
This commit is contained in:
@@ -122,14 +122,18 @@ def redefine_print():
|
||||
print = my_print
|
||||
print("these words")
|
||||
|
||||
def local_redefine_range():
|
||||
range = 5
|
||||
return range
|
||||
def local_redefine_chr():
|
||||
chr = 5
|
||||
return chr
|
||||
|
||||
def global_redefine_range():
|
||||
global range
|
||||
range = 6
|
||||
return range #$ SPURIOUS: use=moduleImport("builtins").getMember("range")
|
||||
def global_redefine_chr():
|
||||
global chr
|
||||
chr = 6
|
||||
return chr
|
||||
|
||||
def what_is_chr_now():
|
||||
# If global_redefine_chr has been run, then the following is _not_ a reference to the built-in chr
|
||||
return chr(123) #$ MISSING: use=moduleImport("builtins").getMember("chr").getReturn()
|
||||
|
||||
def obscured_print():
|
||||
p = print #$ use=moduleImport("builtins").getMember("print")
|
||||
|
||||
Reference in New Issue
Block a user