Skip to content

Commit 9cb4a7b

Browse files
committed
Add a few additional DISALLOW_FUNCTIONS
1 parent 0425898 commit 9cb4a7b

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

simpleeval.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104

105105
import ast
106106
import operator as op
107+
import os
107108
import sys
108109
import warnings
109110
from random import random
@@ -136,7 +137,21 @@
136137
# their functionality is required, then please wrap them up in a safe container. And think
137138
# very hard about it first. And don't say I didn't warn you.
138139
# builtins is a dict in python >3.6 but a module before
139-
DISALLOW_FUNCTIONS = {type, isinstance, eval, getattr, setattr, repr, compile, open, exec}
140+
DISALLOW_FUNCTIONS = {
141+
type,
142+
isinstance,
143+
eval,
144+
getattr,
145+
setattr,
146+
repr,
147+
compile,
148+
open,
149+
exec,
150+
globals,
151+
locals,
152+
os.popen,
153+
os.system,
154+
}
140155
if hasattr(__builtins__, "help") or (
141156
hasattr(__builtins__, "__contains__") and "help" in __builtins__ # type: ignore
142157
):

0 commit comments

Comments
 (0)