Closed camjac251 closed 4 years ago
I've created a fix for this here #4.
Basically, the script would use realpath
to check if the current folder was above the directory of the indexer.php
, this is an attempt to avoid backwards directory traversal.
Problem is that the realpath also returns the real path of any symbolic links. I tried using is_link
which would work for the directory but not any subdirectories inside of it.
So, instead i added a path_checking
option, which when set to weak
will check if the directory is a symbolic link, if it isn't, then it'll use a similar function to realpath
that just works with strings instead of actual file paths, thus not resolving the symbolic link.
Let me know if it works for you.
It didn't work for me sadly. I double checked to make sure I had the right code downloaded too
I noticed a mistake I made with obfuscating the paths in the last code snippet so hopefully this one is less confusing. I have a base folder as the root in nginx, and inside that are symlinked folders
Fatal error: Uncaught Exception: requested path (is_dir) is below the public working directory. (1) in /directory/to/folder/userfolder/indexer.php:92 Stack trace: #0 /directory/to/folder/userfolder/indexer.php(441): Indexer->__construct('/symlinkedfolder/', Array) #1 {main} thrown in /directory/to/folder/userfolder/indexer.php on line 92
Did you remember to set the path_checking
option to weak
after updating the code? That error code tells me that it was still set to strict
.
I completely missed that part. I should have read it closer. setting it to weak
and it works flawlessly. Thank you very much.
Is it possible to use this script with symlinked folders? I get this error when trying to enter a folder
/directory/to/folder/symlink
that is linked to/directory/to/mount/FOLDER/foldername
. Althoughsymlink
andfoldername
are the same foldername on disk. In this example it's just to hopefully clarify which is which.