This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
🚀 | Normalize use of files IO & prevent path traversal #1198
Labels
enhancement
New feature or request
Describe your use case
Is your feature request related to a problem ?
No response
Describe the solution you'd like
If possible, wrap everything under FileUtils, add tests for this class and handle path traversal in it.
Most of the time, we know the path in which we are working. So a simple idea to prevent path traversal should be to check the parent path to the expected parent.
Something like
Paths.get(STORE_PATH + File.separator + USER_INPUT_PART).normalize().getParent().equals(Paths.get(STORE_PATH).normalize())
Link to examples
No response
The text was updated successfully, but these errors were encountered: