Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Disable directory listing for StaticResource #15438

Merged
merged 6 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15438.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable directory listing for static resources in `/_matrix/static/`.
5 changes: 5 additions & 0 deletions synapse/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
from twisted.internet.defer import CancelledError
from twisted.python import failure
from twisted.web import resource
from twisted.web.pages import notFound
dklimpel marked this conversation as resolved.
Show resolved Hide resolved
from twisted.web.resource import IResource
from twisted.web.server import NOT_DONE_YET, Request
from twisted.web.static import File
from twisted.web.util import redirectTo
Expand Down Expand Up @@ -569,6 +571,9 @@ def render_GET(self, request: Request) -> bytes:
set_clickjacking_protection_headers(request)
return super().render_GET(request)

def directoryListing(self) -> IResource:
return notFound()


class UnrecognizedRequestResource(resource.Resource):
"""
Expand Down