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
Describe the bug
When Butler runs on Windows the library used to manage paths will convert all paths to Windows style back-slash () notation.
For example, if the config file states that deletes should be allowed in directory ./dir1/dir2, this will behind the scenes be converted to .\dir1\dir2 when running Butler on Windows.
Another example would be a UNC path like \\server.my.domain\fileshare\dir1\dir2.
The config file could contain either that UNC string, or //server.my.domain/fileshare/dir1/dir2. Both are allowed (even though the second one is proper UNC syntax, of course!).
Internally both paths would be converted into \\server.my.domain\fileshare\dir1\dir2.
Then there is also code that is responsible for determining if a particular directory is a subdirectory of another directory.
In the example above this code would be used to determine if a file to be deleted \\server.my.domain\fileshare\dir1\dir2\dir3\file1.txt is in a sub-directory of the approved directory \\server.my.domain\fileshare\dir1\dir2.
The problem is that this code does not handle back-slash notation properly.
It does handle these scenarios correctly:
✅ Butler running on Linux, with an approved directory such as /data/dir1/dir2. A file /data/dir1/dir2/dir3/file2.txt is the correctly classified as being in a subdirectory of the approved directory.
✅ Butler running on Windows, with an approved directory such as \\server.my.domain\fileshare\dir1\dir2 or //server.my.domain/fileshare/dir1/dir2. A file \\server.my.domain\fileshare\dir1\dir2\file3.txt is then correctly classified as being in the approved directory. Note that file3.txt is in this case located in the approved directory itself, rather than in a subdirectory of the approved directory.
What does not work as intended is:
❌ Butler running on Windows, with an approved directory such as \\server.my.domain\fileshare\dir1\dir2 or //server.my.domain/fileshare/dir1/dir2. A file \\server.my.domain\fileshare\dir1\dir2\dir3\file4.txt would NOT be classified as residing in a subdirectory of the approved directory. This is a bug.
Expected behavior
Linux and Windows paths should be possible when it comes to determining whether or not a file is in the subdirectory path of some other directory.
Also add test cases for this scenario.
The text was updated successfully, but these errors were encountered:
Describe the bug
When Butler runs on Windows the library used to manage paths will convert all paths to Windows style back-slash () notation.
For example, if the config file states that deletes should be allowed in directory
./dir1/dir2
, this will behind the scenes be converted to.\dir1\dir2
when running Butler on Windows.Another example would be a UNC path like
\\server.my.domain\fileshare\dir1\dir2
.The config file could contain either that UNC string, or
//server.my.domain/fileshare/dir1/dir2
. Both are allowed (even though the second one is proper UNC syntax, of course!).Internally both paths would be converted into
\\server.my.domain\fileshare\dir1\dir2
.Then there is also code that is responsible for determining if a particular directory is a subdirectory of another directory.
In the example above this code would be used to determine if a file to be deleted
\\server.my.domain\fileshare\dir1\dir2\dir3\file1.txt
is in a sub-directory of the approved directory\\server.my.domain\fileshare\dir1\dir2
.The problem is that this code does not handle back-slash notation properly.
It does handle these scenarios correctly:
✅ Butler running on Linux, with an approved directory such as
/data/dir1/dir2
. A file/data/dir1/dir2/dir3/file2.txt
is the correctly classified as being in a subdirectory of the approved directory.✅ Butler running on Windows, with an approved directory such as
\\server.my.domain\fileshare\dir1\dir2
or//server.my.domain/fileshare/dir1/dir2
. A file\\server.my.domain\fileshare\dir1\dir2\file3.txt
is then correctly classified as being in the approved directory. Note thatfile3.txt
is in this case located in the approved directory itself, rather than in a subdirectory of the approved directory.What does not work as intended is:
❌ Butler running on Windows, with an approved directory such as
\\server.my.domain\fileshare\dir1\dir2
or//server.my.domain/fileshare/dir1/dir2
. A file\\server.my.domain\fileshare\dir1\dir2\dir3\file4.txt
would NOT be classified as residing in a subdirectory of the approved directory. This is a bug.The code in question is found here.
Expected behavior
Linux and Windows paths should be possible when it comes to determining whether or not a file is in the subdirectory path of some other directory.
Also add test cases for this scenario.
The text was updated successfully, but these errors were encountered: