Fix FileExplorer preprocess path traversal#13050
Closed
api2062 wants to merge 3 commits intogradio-app:mainfrom
Closed
Fix FileExplorer preprocess path traversal#13050api2062 wants to merge 3 commits intogradio-app:mainfrom
api2062 wants to merge 3 commits intogradio-app:mainfrom
Conversation
Contributor
|
This PR has been flagged as AI generated and labelled accordingly. |
Collaborator
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/cb5d38e3f848db638fae8c18fba710b402470b9a/gradio-6.9.0-py3-none-any.whlInstall Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@cb5d38e3f848db638fae8c18fba710b402470b9a#subdirectory=client/python"Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/cb5d38e3f848db638fae8c18fba710b402470b9a/gradio-client-2.1.0.tgz |
Collaborator
🦄 change detectedThis Pull Request includes changes to the following packages.
|
Collaborator
|
Hi @api2062 - I closed the issue this PR is targeting since it was not a real issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes: #13043
This PR fixes a path traversal bug in
FileExplorer.preprocess().preprocess()previously used direct path joins on client-provided segments (payload.root) and did not apply the same safety checks already used inls(). This allowed..segments to escaperoot_dir.Changes made:
self._safe_join(...)inpreprocess()for single-file mode.self._safe_join(...)inpreprocess()for multiple-file mode.InvalidPathErrorin both modes.Validation run:
python -m pytest -q test/components/test_file_explorer.py(5 passed)bash scripts/format_backend.shkumquat
AI Disclosure
🎯 PRs Should Target Issues
This PR targets an existing issue: #13043.
Testing and Formatting Your Code