Skip to content

Commit c07de6e

Browse files
author
patched.codes[bot]
committed
Patched patchwork/common/utils/step_typing.py
1 parent 6f30c0b commit c07de6e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

patchwork/common/utils/step_typing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,13 @@ def validate_step_type_config_with_inputs(
106106

107107

108108
def validate_step_with_inputs(input_keys: Set[str], step: Type[Step]) -> Tuple[Set[str], Dict[str, str]]:
109+
ALLOWED_MODULES = {"module1.typed", "module2.typed"} # Define allowed modules
109110
module_path, _, _ = step.__module__.rpartition(".")
110111
step_name = step.__name__
112+
113+
if f"{module_path}.typed" not in ALLOWED_MODULES:
114+
raise ValueError("Attempted to import a module not in the allowed list.")
115+
111116
type_module = importlib.import_module(f"{module_path}.typed")
112117
step_input_model = getattr(type_module, f"{step_name}Inputs", __NOT_GIVEN)
113118
step_output_model = getattr(type_module, f"{step_name}Outputs", __NOT_GIVEN)

0 commit comments

Comments
 (0)