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

Commit

Permalink
Merge remote-tracking branch 'origin/release-v1.36' into hs/hacked-to…
Browse files Browse the repository at this point in the history
…gether-event-cache
  • Loading branch information
Half-Shot committed Jun 16, 2021
2 parents dacc395 + 1c8045f commit 7d33ba7
Show file tree
Hide file tree
Showing 233 changed files with 11,287 additions and 4,938 deletions.
6 changes: 2 additions & 4 deletions .buildkite/postgres-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# CI's Docker setup at the point where this file is considered.
server_name: "localhost:8800"

signing_key_path: "/src/.buildkite/test.signing.key"
signing_key_path: ".buildkite/test.signing.key"

report_stats: false

Expand All @@ -16,6 +16,4 @@ database:
database: synapse

# Suppress the key server warning.
trusted_key_servers:
- server_name: "matrix.org"
suppress_key_server_warning: true
trusted_key_servers: []
4 changes: 4 additions & 0 deletions .buildkite/scripts/test_synapse_port_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
echo "+++ Run synapse_port_db against test database"
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml

# We should be able to run twice against the same database.
echo "+++ Run synapse_port_db a second time"
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml

#####

# Now do the same again, on an empty database.
Expand Down
6 changes: 2 additions & 4 deletions .buildkite/sqlite-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# schema and run background updates on it.
server_name: "localhost:8800"

signing_key_path: "/src/.buildkite/test.signing.key"
signing_key_path: ".buildkite/test.signing.key"

report_stats: false

Expand All @@ -13,6 +13,4 @@ database:
database: ".buildkite/test_db.db"

# Suppress the key server warning.
trusted_key_servers:
- server_name: "matrix.org"
suppress_key_server_warning: true
trusted_key_servers: []
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ workflows:
- dockerhubuploadlatest:
filters:
branches:
only: master
only: [ master, main ]

commands:
docker_prepare:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy the documentation

on:
push:
branches:
- develop

workflow_dispatch:

jobs:
pages:
name: GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup mdbook
uses: peaceiris/actions-mdbook@4b5ef36b314c2599664ca107bb8c02412548d79d # v1.1.14
with:
mdbook-version: '0.4.9'

- name: Build the documentation
run: mdbook build

- name: Deploy latest documentation
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
keep_files: true
publish_dir: ./book
destination_dir: ./develop
10 changes: 8 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ jobs:
if: ${{ github.base_ref == 'develop' || contains(github.base_ref, 'release-') }}
runs-on: ubuntu-latest
steps:
# Note: This and the script can be simplified once we drop Buildkite. See:
# https://github.com/actions/checkout/issues/266#issuecomment-638346893
# https://github.com/actions/checkout/issues/416
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-python@v2
- run: pip install tox
- name: Patch Buildkite-specific test script
Expand Down Expand Up @@ -226,9 +232,9 @@ jobs:
- name: Run SyTest
run: /bootstrap.sh synapse
working-directory: /src
- name: Dump results.tap
- name: Summarise results.tap
if: ${{ always() }}
run: cat /logs/results.tap
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
- name: Upload SyTest logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ __pycache__/
/docs/build/
/htmlcov
/pip-wheel-metadata/

# docs
book/
272 changes: 267 additions & 5 deletions CHANGES.md

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,9 @@ Once you have installed synapse as above, you will need to configure it.

### Using PostgreSQL

By default Synapse uses [SQLite](https://sqlite.org/) and in doing so trades performance for convenience.
SQLite is only recommended in Synapse for testing purposes or for servers with
very light workloads.

Almost all installations should opt to use [PostgreSQL](https://www.postgresql.org). Advantages include:
By default Synapse uses an [SQLite](https://sqlite.org/) database and in doing so trades
performance for convenience. Almost all installations should opt to use [PostgreSQL](https://www.postgresql.org)
instead. Advantages include:

- significant performance improvements due to the superior threading and
caching model, smarter query optimiser
Expand All @@ -412,6 +410,10 @@ Almost all installations should opt to use [PostgreSQL](https://www.postgresql.o
For information on how to install and use PostgreSQL in Synapse, please see
[docs/postgres.md](docs/postgres.md)

SQLite is only acceptable for testing purposes. SQLite should not be used in
a production server. Synapse will perform poorly when using
SQLite, especially when participating in large rooms.

### TLS certificates

The default configuration exposes a single HTTP port on the local
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exclude mypy.ini
exclude sytest-blacklist
exclude test_postgresql.sh

include book.toml
include pyproject.toml
recursive-include changelog.d *

Expand Down
46 changes: 35 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,45 @@ For details on having Synapse manage your federation TLS certificates
automatically, please see `<docs/ACME.md>`_.


Security Note
Security note
=============

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

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

See https://github.com/vector-im/riot-web/issues/1977 and
https://developer.github.com/changes/2014-04-25-user-content-security for more details.
Whilst we make a reasonable effort to mitigate against XSS attacks (for
instance, by using `CSP`_), a Matrix homeserver should not be hosted on a
domain hosting other web applications. This especially applies to sharing
the domain with Matrix web clients and other sensitive applications like
webmail. See
https://developer.github.com/changes/2014-04-25-user-content-security for more
information.

.. _CSP: https://github.com/matrix-org/synapse/pull/1021

Ideally, the homeserver should not simply be on a different subdomain, but on
a completely different `registered domain`_ (also known as top-level site or
eTLD+1). This is because `some attacks`_ are still possible as long as the two
applications share the same registered domain.

.. _registered domain: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-2.3

.. _some attacks: https://en.wikipedia.org/wiki/Session_fixation#Attacks_using_cross-subdomain_cookie

To illustrate this with an example, if your Element Web or other sensitive web
application is hosted on ``A.example1.com``, you should ideally host Synapse on
``example2.com``. Some amount of protection is offered by hosting on
``B.example1.com`` instead, so this is also acceptable in some scenarios.
However, you should *not* host your Synapse on ``A.example1.com``.

Note that all of the above refers exclusively to the domain used in Synapse's
``public_baseurl`` setting. In particular, it has no bearing on the domain
mentioned in MXIDs hosted on that server.

Following this advice ensures that even if an XSS is found in Synapse, the
impact to other applications will be minimal.


Upgrading an existing Synapse
Expand Down
11 changes: 4 additions & 7 deletions UPGRADE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ for example:
Upgrading to v1.34.0
====================

`room_invite_state_types` configuration setting
``room_invite_state_types`` configuration setting
-----------------------------------------------

The ``room_invite_state_types`` configuration setting has been deprecated and
Expand All @@ -106,13 +106,10 @@ remove it from your configuration file. The default value used to be:
- "m.room.encryption"
- "m.room.name"
If you have customised this value by adding addition state types, you should
remove ``room_invite_state_types`` and configure ``additional_event_types`` with
your customisations.
If you have customised this value, you should remove ``room_invite_state_types`` and
configure ``room_prejoin_state`` instead.


If you have customised this value by removing state types, you should rename
``room_invite_state_types`` to ``additional_event_types``, and set
``disable_default_event_types`` to ``true``.

Upgrading to v1.33.0
====================
Expand Down
39 changes: 39 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Documentation for possible options in this file is at
# https://rust-lang.github.io/mdBook/format/config.html
[book]
title = "Synapse"
authors = ["The Matrix.org Foundation C.I.C."]
language = "en"
multilingual = false

# The directory that documentation files are stored in
src = "docs"

[build]
# Prevent markdown pages from being automatically generated when they're
# linked to in SUMMARY.md
create-missing = false

[output.html]
# The URL visitors will be directed to when they try to edit a page
edit-url-template = "https://github.com/matrix-org/synapse/edit/develop/{path}"

# Remove the numbers that appear before each item in the sidebar, as they can
# get quite messy as we nest deeper
no-section-label = true

# The source code URL of the repository
git-repository-url = "https://github.com/matrix-org/synapse"

# The path that the docs are hosted on
site-url = "/synapse/"

# Additional HTML, JS, CSS that's injected into each page of the book.
# More information available in docs/website_files/README.md
additional-css = [
"docs/website_files/table-of-contents.css",
"docs/website_files/remove-nav-buttons.css",
"docs/website_files/indent-section-headers.css",
]
additional-js = ["docs/website_files/table-of-contents.js"]
theme = "docs/website_files/theme"
1 change: 0 additions & 1 deletion changelog.d/9881.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9882.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9885.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9886.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9889.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9889.removal

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9895.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9896.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9896.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9902.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9904.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9905.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9910.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9910.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9911.doc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9913.docker

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9915.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9916.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9928.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9930.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9931.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9932.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9935.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9945.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9947.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9950.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9954.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9959.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9961.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9965.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/9966.feature

This file was deleted.

Loading

0 comments on commit 7d33ba7

Please sign in to comment.