only access .name for upload component#5515
Merged
adhami3310 merged 1 commit intoJul 3, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
PR Summary
Modified the upload component to improve security and type handling by returning only file names instead of full paths, and adding support for Var[str] type IDs.
- Changed
selected_files()inreflex/components/core/upload.pyto return only file names (f.name) instead of paths for better security - Added support for
Var[str]type ID parameters in upload component functions - Removed path fallback logic (
f.path || f.name) to prevent potential exposure of sensitive file system information
2 files reviewed, no comments
Edit PR Review Bot Settings | Greptile
CodSpeed Performance ReportMerging #5515 will not alter performanceComparing Summary
|
masenf
reviewed
Jul 2, 2025
| id_var = LiteralStringVar.create(id_) if not isinstance(id_, Var) else id_ | ||
| return Var( | ||
| _js_expr=f"(filesById[{id_var!s}] ? filesById[{id_var!s}].map((f) => (f.path || f.name)) : [])", | ||
| _js_expr=f"(filesById[{id_var!s}] ? filesById[{id_var!s}].map((f) => f.name) : [])", |
Collaborator
There was a problem hiding this comment.
why don't we want the path? what if the user drops a big directory?
Member
Author
There was a problem hiding this comment.
https://developer.mozilla.org/en-US/docs/Web/API/File doesn't even document path
masenf
approved these changes
Jul 3, 2025
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.
also fixes #5490