Skip to content

Commit

Permalink
feat: add additional allowed imports (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
beaugunderson authored Jan 22, 2025
1 parent b5276d7 commit 518c62c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugin_runner/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#
ALLOWED_MODULES = frozenset(
[
"__future__",
"_strptime",
"arrow",
"base64",
Expand All @@ -49,8 +50,10 @@
"canvas_sdk.value_set",
"canvas_sdk.views",
"contextlib",
"dataclasses",
"datetime",
"dateutil",
"decimal",
"django.db.models",
"django.utils.functional",
"enum",
Expand All @@ -63,6 +66,7 @@
"math",
"operator",
"pickletools",
"pydantic",
"random",
"rapidfuzz",
"re",
Expand Down Expand Up @@ -136,7 +140,10 @@ def check_import_names(self, node: ast.ImportFrom) -> ast.AST:
return self.node_contents_visit(node)

def check_name(
self, node: ast.ImportFrom, name: str | None, allow_magic_methods: bool = False
self,
node: ast.ImportFrom,
name: str | None,
allow_magic_methods: bool = False,
) -> None:
"""Check names if they are allowed.
Expand Down

0 comments on commit 518c62c

Please sign in to comment.