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

Commit d9f44fd

Browse files
authored
Clarify security note regarding the domain Synapse is hosted on. (#9221)
1 parent dcbfec9 commit d9f44fd

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

README.rst

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,45 @@ For details on having Synapse manage your federation TLS certificates
149149
automatically, please see `<docs/ACME.md>`_.
150150

151151

152-
Security Note
152+
Security note
153153
=============
154154

155-
Matrix serves raw user generated data in some APIs - specifically the `content
156-
repository endpoints <https://matrix.org/docs/spec/client_server/latest.html#get-matrix-media-r0-download-servername-mediaid>`_.
155+
Matrix serves raw, user-supplied data in some APIs -- specifically the `content
156+
repository endpoints`_.
157157

158-
Whilst we have tried to mitigate against possible XSS attacks (e.g.
159-
https://github.com/matrix-org/synapse/pull/1021) we recommend running
160-
matrix homeservers on a dedicated domain name, to limit any malicious user generated
161-
content served to web browsers a matrix API from being able to attack webapps hosted
162-
on the same domain. This is particularly true of sharing a matrix webclient and
163-
server on the same domain.
158+
.. _content repository endpoints: https://matrix.org/docs/spec/client_server/latest.html#get-matrix-media-r0-download-servername-mediaid
164159

165-
See https://github.com/vector-im/riot-web/issues/1977 and
166-
https://developer.github.com/changes/2014-04-25-user-content-security for more details.
160+
Whilst we make a reasonable effort to mitigate against XSS attacks (for
161+
instance, by using `CSP`_), a Matrix homeserver should not be hosted on a
162+
domain hosting other web applications. This especially applies to sharing
163+
the domain with Matrix web clients and other sensitive applications like
164+
webmail. See
165+
https://developer.github.com/changes/2014-04-25-user-content-security for more
166+
information.
167+
168+
.. _CSP: https://github.com/matrix-org/synapse/pull/1021
169+
170+
Ideally, the homeserver should not simply be on a different subdomain, but on
171+
a completely different `registered domain`_ (also known as top-level site or
172+
eTLD+1). This is because `some attacks`_ are still possible as long as the two
173+
applications share the same registered domain.
174+
175+
.. _registered domain: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-2.3
176+
177+
.. _some attacks: https://en.wikipedia.org/wiki/Session_fixation#Attacks_using_cross-subdomain_cookie
178+
179+
To illustrate this with an example, if your Element Web or other sensitive web
180+
application is hosted on ``A.example1.com``, you should ideally host Synapse on
181+
``example2.com``. Some amount of protection is offered by hosting on
182+
``B.example1.com`` instead, so this is also acceptable in some scenarios.
183+
However, you should *not* host your Synapse on ``A.example1.com``.
184+
185+
Note that all of the above refers exclusively to the domain used in Synapse's
186+
``public_baseurl`` setting. In particular, it has no bearing on the domain
187+
mentioned in MXIDs hosted on that server.
188+
189+
Following this advice ensures that even if an XSS is found in Synapse, the
190+
impact to other applications will be minimal.
167191

168192

169193
Upgrading an existing Synapse

changelog.d/9221.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clarify security note regarding hosting Synapse on the same domain as other web applications.

0 commit comments

Comments
 (0)