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

Set Referrer-Policy to no-referrer for media #7009

Merged
merged 1 commit into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all 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/7009.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set `Referrer-Policy` header to `no-referrer` on media downloads.
3 changes: 3 additions & 0 deletions synapse/rest/media/v1/download_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ async def _async_render_GET(self, request):
b" media-src 'self';"
b" object-src 'self';",
)
request.setHeader(
b"Referrer-Policy", b"no-referrer",
)
server_name, media_id, name = parse_media_id(request)
if server_name == self.server_name:
await self.media_repo.get_local_media(request, media_id, name)
Expand Down