Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes
8.6 (unreleased)
----------------

- Add support for the ``reversed`` builtin in ``safe_builtins``.

- Add a "Security considerations" documentation page. It explains why the guards
only cover attribute access written in the restricted source, and why
providing an ``__import__`` implementation hands the security boundary to the
Expand Down
1 change: 1 addition & 0 deletions src/RestrictedPython/Guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'pow',
'range',
'repr',
'reversed',
'round',
'slice',
'sorted',
Expand Down
5 changes: 5 additions & 0 deletions tests/test_Guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def test_Guards_sorted():
assert restricted_eval('sorted([5, 2, 8, 1])') == sorted([5, 2, 8, 1])


def test_Guards_reversed():
"""It contains reversed"""
assert list(restricted_eval('reversed([5, 2, 8, 1])')) == [1, 8, 2, 5]


def test_Guards__safe_builtins__1():
"""It contains `slice()`."""
assert restricted_eval('slice(1)') == slice(1)
Expand Down
Loading