I read the documentation and vaguely get the idea that RestrictedPython is a restricted subset of Python, but the documentation does not explain what is restricted and why.
The documentation should list what is restricted and give a reason as for why that is restricted, as well as list what is not restricted.
Reading the source code gives some hints:
- Matrix multiplication (
@) is currently not allowed.
nonlocal is not allowed.
- await/async is not allowed.
- There is a
range function with a limit of 1000.
list("string") is not allowed. Why?
tuple("string") is not allowed. Why?
What about...
- infinite loops such as
while True?
- recursion?
- nested for loops?
"foo".zfill(99999999999999999)
"foo".ljust(99999999999999999, ".")
1024**1024**1024
- String repeat
"foo" * 1024**1024
I read the documentation and vaguely get the idea that RestrictedPython is a restricted subset of Python, but the documentation does not explain what is restricted and why.
The documentation should list what is restricted and give a reason as for why that is restricted, as well as list what is not restricted.
Reading the source code gives some hints:
@) is currently not allowed.nonlocalis not allowed.rangefunction with a limit of 1000.list("string")is not allowed. Why?tuple("string")is not allowed. Why?What about...
while True?"foo".zfill(99999999999999999)"foo".ljust(99999999999999999, ".")1024**1024**1024"foo" * 1024**1024