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
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Changes
8.3 (unreleased)
----------------

- Nothing changed yet.
- Also validate positional-only argument names (parameters before ``/``) so
they cannot start with an underscore, closing a sandbox escape where a
positional-only parameter could shadow an injected protected name such as
``_getattr_``, ``_getitem_``, ``_write_`` or ``_print_``.


8.3a1.dev0 (2026-05-29)
Expand Down
3 changes: 3 additions & 0 deletions src/RestrictedPython/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ def check_name(self, node, name, allow_magic_methods=False):
self.error(node, f'"{name}" is a reserved name.')

def check_function_argument_names(self, node):
for arg in node.args.posonlyargs:
self.check_name(node, arg.arg)

for arg in node.args.args:
self.check_name(node, arg.arg)

Expand Down
Loading