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 74e503f commit b4a0740Copy full SHA for b4a0740
src/gitingest/query_parser.py
@@ -327,7 +327,10 @@ def _parse_local_dir_path(path_str: str) -> IngestionQuery:
327
A dictionary containing the parsed details of the file path.
328
329
"""
330
+ root_path = TMP_BASE_PATH.resolve()
331
path_obj = Path(path_str).resolve()
332
+ if os.path.commonpath([root_path, path_obj]) != str(root_path):
333
+ raise InvalidPatternError(f"Path {path_str} escapes the allowed root directory.")
334
slug = path_obj.name if path_str == "." else path_str.strip("/")
335
return IngestionQuery(local_path=path_obj, slug=slug, id=str(uuid.uuid4()))
336
0 commit comments