-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix remove unsafe path joins #913
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Thank you @porcupineyhairs!
| @@ -629,7 +623,7 @@ def pipeline_set_notebook_kernels(pipeline_json, pipeline_directory, project_uui | |||
|
|
|||
| if "ipynb" == step["file_path"].split(".")[-1]: | |||
|
|
|||
| notebook_path = os.path.join(pipeline_directory, step["file_path"]) | |||
| notebook_path = safe_join(pipeline_directory, step["file_path"]) | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect this to cause problems because file paths can be relative and point to files above the pipeline directory. We should find all similar resolves of paths that use the pipeline step file path in particular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, will take a look
52f70de to
77574c4
Compare
|
|
||
|
|
||
| def is_valid_data_path(path: str): | ||
| return os.path.abspath(os.path.normpath(path)).startswith("/data") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fruttasecca Isn't this line always returning false? os.path.abspath(os.path.normpath(path)) most likely would start with /userdir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose changing it to
| return os.path.abspath(os.path.normpath(path)).startswith(_config.USERDIR_DATA) |
Related: #907
Fixes: #906
Credits to @porcupineyhairs for discovery and fix proposal
There are a couple of regressions on
devthat make it not possible to test all edge cases, it's something we will have to look into next week.