You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes two issues and adds two improvements:
* FileProvider would read files outside the root if the root were
a prefix of the file path string-wise. Consider a root path
`/tmp/sample/root` and a relative path `../root.txt`, resulting in
reading a file `/tmp/sample/root.txt`.
* The "inside root" check was performed after checking if file existed.
This would expose information about files outside the root through the
exception. While an exploit would be difficult (if possible at all),
it is better to fix this weakness anyway.
* The exception type is changed from the most generic `Exception` to
`ValueError` to make it easier to distinguish it from
`ContentException` that is raised in other cases.
* The `"/"` literal in path operations is changed to `os.sep` to improve
portability.
Signed-off-by: Jan Holeček <71874510+jholecek-rh@users.noreply.github.com>
0 commit comments