file_manager: always deny access to .git folders
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
d490796da9
commit
a8018afd46
|
@ -251,6 +251,8 @@ class FileManager:
|
||||||
if isinstance(req_path, str):
|
if isinstance(req_path, str):
|
||||||
req_path = pathlib.Path(req_path)
|
req_path = pathlib.Path(req_path)
|
||||||
req_path = req_path.expanduser().resolve()
|
req_path = req_path.expanduser().resolve()
|
||||||
|
if ".git" in req_path.parts:
|
||||||
|
return True
|
||||||
for name, (res_path, can_read) in self.reserved_paths.items():
|
for name, (res_path, can_read) in self.reserved_paths.items():
|
||||||
if (
|
if (
|
||||||
(res_path == req_path or res_path in req_path.parents) and
|
(res_path == req_path or res_path in req_path.parents) and
|
||||||
|
@ -543,6 +545,9 @@ class FileManager:
|
||||||
path = pathlib.Path(path)
|
path = pathlib.Path(path)
|
||||||
real_path = path.resolve()
|
real_path = path.resolve()
|
||||||
fstat = path.stat()
|
fstat = path.stat()
|
||||||
|
if ".git" in real_path.parts:
|
||||||
|
permissions = ""
|
||||||
|
else:
|
||||||
permissions = "rw"
|
permissions = "rw"
|
||||||
if (
|
if (
|
||||||
root not in self.full_access_roots or
|
root not in self.full_access_roots or
|
||||||
|
|
Loading…
Reference in New Issue