Merge pull request #619 from Unrud/log_unsafe_paths

Log unsafe paths
This commit is contained in:
Unrud 2017-06-01 12:55:45 +02:00 committed by GitHub
commit ac230efa57
4 changed files with 5 additions and 4 deletions

View File

@ -484,7 +484,8 @@ class Collection(BaseCollection):
filesystem_path = path_to_filesystem(folder, sane_path)
except ValueError as e:
# Path is unsafe
cls.logger.info(e)
cls.logger.debug("Collection with unsafe path %r requested: %s",
sane_path, e, exc_info=True)
return
# Check if the path exists and if it leads to a collection or an item

View File

@ -26,7 +26,6 @@ import shutil
import tempfile
import pytest
from radicale import Application, config
from .test_base import BaseTest

View File

@ -26,7 +26,6 @@ import shutil
import tempfile
import pytest
from radicale import Application, config
from . import BaseTest

View File

@ -84,7 +84,9 @@ class Web(BaseWeb):
try:
filesystem_path = storage.path_to_filesystem(
self.folder, path[len("/.web"):])
except ValueError:
except ValueError as e:
self.logger.debug("Web content with unsafe path %r requested: %s",
path, e, exc_info=True)
return NOT_FOUND
if os.path.isdir(filesystem_path) and not path.endswith("/"):
location = posixpath.basename(path) + "/"