Skip to content

Commit eab7cb1

Browse files
committed
wimpy security patch
1 parent 14ec2b6 commit eab7cb1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎v3/pg_logger.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ def __restricted_import__(*args):
158158
setattr(imported_mod, 'setCSS', setCSS)
159159
setattr(imported_mod, 'setJS', setJS)
160160

161+
# somewhat weak protection against imported modules that contain one
162+
# of these troublesome builtins. again, NOTHING is foolproof ...
163+
# just more defense in depth :)
164+
for mod in ('os', 'sys', 'posix', 'gc'):
165+
if hasattr(imported_mod, mod):
166+
delattr(imported_mod, mod)
167+
161168
return imported_mod
162169
else:
163170
raise ImportError('{0} not supported'.format(args[0]))

0 commit comments

Comments
 (0)