We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cc98b5 commit f971e58Copy full SHA for f971e58
patchwork/common/utils/dependency.py
@@ -6,9 +6,13 @@
6
"notification": ["slack_sdk"],
7
}
8
9
+__ALLOWED_MODULES = {module for modules in __DEPENDENCY_GROUPS.values() for module in modules}
10
11
@lru_cache(maxsize=None)
12
def import_with_dependency_group(name):
13
+ if name not in __ALLOWED_MODULES:
14
+ raise ImportError(f"Import of untrusted module '{name}' is not allowed.")
15
+
16
try:
17
return importlib.import_module(name)
18
except ImportError:
@@ -20,6 +24,5 @@ def import_with_dependency_group(name):
20
24
error_msg = f"Please `pip install patchwork-cli[{dependency_group}]` to use this step"
21
25
raise ImportError(error_msg)
22
26
23
-
27
def slack_sdk():
28
return import_with_dependency_group("slack_sdk")
0 commit comments