Don't reject everybody from "/" with owner_only
Fix 407.
This commit is contained in:
parent
6bfdcbafec
commit
b517818749
@ -80,6 +80,10 @@ permission:r
|
|||||||
user:.+
|
user:.+
|
||||||
collection:%(login)s(/.*)?
|
collection:%(login)s(/.*)?
|
||||||
permission:rw
|
permission:rw
|
||||||
|
[r]
|
||||||
|
user:.+
|
||||||
|
collection:
|
||||||
|
permission:r
|
||||||
"""}
|
"""}
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +112,7 @@ class Rights(BaseRights):
|
|||||||
if user and not storage.is_safe_path_component(user):
|
if user and not storage.is_safe_path_component(user):
|
||||||
# Prevent usernames like "user/calendar.ics"
|
# Prevent usernames like "user/calendar.ics"
|
||||||
raise ValueError("Unsafe username")
|
raise ValueError("Unsafe username")
|
||||||
collection_url = collection.path.rstrip("/") or "/"
|
collection_url = collection.path.rstrip("/")
|
||||||
if collection_url in (".well-known/carddav", ".well-known/caldav"):
|
if collection_url in (".well-known/carddav", ".well-known/caldav"):
|
||||||
return permission == "r"
|
return permission == "r"
|
||||||
# Prevent "regex injection"
|
# Prevent "regex injection"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user