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 fbc5f41 commit 5e6d5d6Copy full SHA for 5e6d5d6
label_studio_ml/examples/timeseries_segmenter/model.py
@@ -87,7 +87,12 @@ def _get_model(
87
return _models[project_id]
88
89
# Try to load from disk
90
- model_path = os.path.join(self.MODEL_DIR, f"model_project_{project_id}.pt")
+ raw_model_path = os.path.join(self.MODEL_DIR, f"model_project_{project_id}.pt")
91
+ model_path = os.path.normpath(raw_model_path)
92
+
93
+ # Ensure the normalized path is within the intended directory
94
+ if not model_path.startswith(os.path.abspath(self.MODEL_DIR)):
95
+ raise ValueError(f"Invalid model path: {model_path}")
96
97
if not blank and os.path.exists(model_path):
98
logger.info(f"Loading saved model for project {project_id} from {model_path}")
0 commit comments