Skip to content

exec Function Allowed in Restricted Python Environment #284

@Abdullahsecuriti

Description

@Abdullahsecuriti

BUG/PROBLEM REPORT / FEATURE REQUEST

Description:

In a restricted Python package environment, the following code snippet:

python 3.10.0

try:
  exec("import os; os.system('ls'); print('**')")
except:
  pass

successfully executes without throwing an error, despite exec being expected to be undefined in such a restricted environment.

However, when the code is run without the try-except block:

exec("import os; os.system('ls'); print('**')")
an error is thrown as expected.

Expected Behavior:

The restricted environment should prevent the execution of exec and throw an error when it is invoked, regardless of the surrounding try-except block.

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