@@ -36,6 +36,30 @@ def _safe_getattr(obj, name, *default): return getattr(obj, name, *default) if default else getattr(obj, name) +_SANDBOX_BLOCKED_ATTRS = frozenset({+ '__subclasses__', '__bases__', '__mro__', '__globals__',+ '__code__', '__class__', '__dict__', '__builtins__',+ '__import__', '__loader__', '__spec__', '__init_subclass__',
Show 18 hidden lines
+ '__set_name__', '__reduce__', '__reduce_ex__',+ '__traceback__', '__qualname__', '__module__',+ '__wrapped__', '__closure__', '__annotations__',+ '__self__', # C builtins leak real builtins module (GHSA-4mr5-g6f9-cfrh)+ # Frame/code object introspection+ 'gi_frame', 'gi_code', 'cr_frame', 'cr_code',+ 'ag_frame', 'ag_code', 'tb_frame', 'tb_next',+ 'f_globals', 'f_locals', 'f_builtins', 'f_code',+ 'co_consts', 'co_names',+ '__getattribute__', '__getattr__', '__setattr__', '__delattr__',+ '__dir__', '__get__', '__set__', '__delete__',+})++_SANDBOX_BLOCKED_CALLS = frozenset({+ 'exec', 'eval', 'compile', '__import__',+ 'open', 'input', 'breakpoint',+ 'setattr', 'delattr', 'dir', 'vars',+})
The repair lengthens that list with the leaking attribute and the helper call, blocks attribute-style calls too, and moves the same scan into the sandboxed execution path.