zopefoundation / RestrictedPython

A restricted execution environment for Python to run untrusted code.
http://restrictedpython.readthedocs.io/
Other
456 stars 38 forks source link

bytearray support? #274

Open jsmith173 opened 5 months ago

jsmith173 commented 5 months ago

It seems bytearray is not supported. How can I fix it myself?

image

loechel commented 5 months ago

@jsmith173 RestrictedPython itself offers several sets of builtins to use with, but you can always add additional elements for your specific use-case. Details: https://github.com/zopefoundation/RestrictedPython/blob/master/src/RestrictedPython/Guards.py#L14-L16

Just extend your globals to use it, if you use the safe_builtins from Guards, add it as another element (extend safe_names and add it to the used builtins: see: https://github.com/zopefoundation/RestrictedPython/blob/master/src/RestrictedPython/Guards.py#L111-L112).