Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

repyportability should not override Python builtins  #35

@aaaaalbert

Description

@aaaaalbert

repyportability exists so that Python code can make use of Repy modules. Therefore, the portability module must make the Repy API functions available in the global context. However, it is not necessary at this point to ensure performance isolation (i.e. non nannying) nor namespace separation (so that what would usually be sandboxed code cannot access the internals of the sandbox).

The current repyportability module does the former (see code), but has issues with the latter (see more code). In particular, lines 204-211 seem to allow all the builtins, but the program flow in safe.py indicates that builtins are replaced preferrably even if they are considered OK.

Patching this behavior should be as simple as

@@ -205,6 +205,8 @@ def initialize_safe_module():
     for builtin_type in dir(__builtins__):
       if builtin_type not in safe._BUILTIN_OK:
         safe._BUILTIN_OK.append(builtin_type)
+      if builtin_type in safe._BUILTIN_REPLACE:
+        del safe._BUILTIN_REPLACE[builtin_type]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions