Commit graph

22619 commits

Author SHA1 Message Date
Eric Eastwood 4b2a5fe74f Merge branch 'develop' into madlittlemods/re-use-work-to-grab-state-from-previous-group 2023-05-18 15:00:07 -05:00
Jonathan de Jong e5b4d93770
Update Mutual Rooms (MSC2666) implementation (#15621)
To track changes in MSC2666:

- The change from `/mutual_rooms/{user_id}` to `/mutual_rooms?user_id={user_id}`.
- The addition of `next_batch_token` (and logic).
- Unstable flag now being `uk.half-shot.msc2666.query_mutual_rooms`.
- The error code when your own user is requested.
2023-05-18 12:49:12 -04:00
Patrick Cloke 5dc1f25c53
Fix olddeps build (#15626)
Do an `apt update` before install packages.
2023-05-18 10:53:57 -04:00
axel simon 4ec40b16ac
flake.nix: start synapse automatically, add space usage warning (#15613)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2023-05-18 15:44:28 +01:00
Sean Quah 68dcd2cbcb
Re-type config paths in ConfigErrors to be StrSequences (#15615)
Part of #14809.

Signed-off-by: Sean Quah <seanq@matrix.org>
2023-05-18 11:11:30 +01:00
Sean Quah e15aa00bc0
Fix error message when app_service_config_files validation fails (#15614)
The second argument of `ConfigError` is a path, passed as an optional
`Iterable[str]` and not a `str`. If a string is passed directly,
Synapse unhelpfully emits "Error in configuration at
a.p.p._.s.e.r.v.i.c.e._.c.o.n.f.i.g._.f.i.l.e.s'" when the config
option has the wrong data type.

Signed-off-by: Sean Quah <seanq@matrix.org>
2023-05-18 10:58:13 +01:00
Eric Eastwood 79e6d61141 Fix typo 2023-05-18 02:49:39 -05:00
Eric Eastwood 7abb745003 Fix lint 2023-05-18 02:32:05 -05:00
Eric Eastwood 17aeee764d More comments 2023-05-18 02:31:12 -05:00
Eric Eastwood 333fc51e6c Replace sketchy string manip with placeholders 2023-05-18 02:20:31 -05:00
Eric Eastwood 1f60fcb1af Remove debug logs 2023-05-18 02:06:24 -05:00
Eric Eastwood ab576b6b6b Fix when the state_filter prevented us from returning any rows before 2023-05-18 01:59:34 -05:00
Eric Eastwood 3d80449d6b Fix empty case 2023-05-17 21:57:13 -05:00
Eric Eastwood 5704e3b0fd Fix lints 2023-05-17 20:37:19 -05:00
Eric Eastwood 02a9959a6f Add changelog 2023-05-17 20:24:51 -05:00
Eric Eastwood 6a19afcdad Re-use work from previous state_groups 2023-05-17 20:03:28 -05:00
Eric Eastwood 4676e53e65 Start of idea to re-use work of getting state for a given state_group 2023-05-17 18:57:59 -05:00
Quentin Gliech 41b9def9f2
Add a new admin API to create a new device for a user. (#15611)
This allows an external service (e.g. the matrix-authentication-service)
to create devices for users.
2023-05-17 14:39:06 +00:00
Patrick Cloke 4ee82c0576
Apply url_preview_url_blacklist to oEmbed and pre-cached images (#15601)
There are two situations which were previously not properly checked:

1. If the requested URL was replaced with an oEmbed URL, then the
   oEmbed URL was not checked against url_preview_url_blacklist.
2. Follow-up URLs (either via autodiscovery of oEmbed or to pre-cache
   images) were not checked against url_preview_url_blacklist.
2023-05-16 16:25:01 -04:00
Patrick Cloke 375b0a8a11
Update code to refer to "workers". (#15606)
A bunch of comments and variables are out of date and use
obsolete terms.
2023-05-16 15:56:38 -04:00
Eric Eastwood 7148c2a0d6
Run mypy type checking with the minimum supported Python version (#15602)
We use the oldest Python version because later Python versions can include some overloads which don't work in the older versions which we still support.

We're using Python 3.8 instead of 3.7 which is our actual minimum support version because it's EOL is in a matter of weeks so can avoid the extra effort. And in any case, minimum Python 3.8 support is better than winging it on Python 3.11.
2023-05-16 13:27:47 -05:00
Shay 9f6ff6a0eb
Add not null constraint to column full_user_id of tables profiles and user_filters (#15537) 2023-05-16 10:57:39 -07:00
Eric Eastwood 77cda342be traceback.format_exception(...) usage that is compatible with Python 3.7 and 3.11 (#15599)
* Usage that is compatible with Python 3.8 and 3.11

> Since Python 3.10, instead of passing value and tb, an exception object can
  be passed as the first argument. If value and tb are provided, the first
  argument is ignored in order to provide backwards compatibility.
>
> -- https://docs.python.org/3/library/traceback.html

* Add changelog
2023-05-16 12:33:18 -05:00
Eric Eastwood c51d2e6199
Fix subscriptable type usage in Python <3.9 (#15604)
Fix the following `mypy` errors when running `mypy` with Python 3.7:
```
synapse/storage/controllers/stats.py:58: error: "Counter" is not subscriptable, use "typing.Counter" instead  [misc]

tests/test_state.py:267: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
```

Part of https://github.com/matrix-org/synapse/issues/15603

In Python 3.9, `typing` is deprecated and the types are subscriptable (generics) by default, https://peps.python.org/pep-0585/#implementation
2023-05-16 12:19:46 -05:00
Olivier Wilkinson (reivilibre) 0ccfb9318c Tweak changelog 2023-05-16 11:57:29 +01:00
Olivier Wilkinson (reivilibre) 3ec9f3b0cc 1.84.0rc1 2023-05-16 11:23:05 +01:00
Eric Eastwood c97198ee14 Revert "Fix subscriptable dict type"
This reverts commit 55b08534a4.
2023-05-15 17:44:26 -05:00
Eric Eastwood 55b08534a4 Fix subscriptable dict type
Fix:
```
tests/test_state.py:267: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
```

In Python 3.9, `typing` is deprecated and the types are subscriptable (generics) by default,
https://peps.python.org/pep-0585/#implementation
2023-05-15 17:40:10 -05:00
Shay ba572647b2
Export run_as_background_process from the module API (#15577) 2023-05-15 13:11:21 -07:00
Patrick Cloke f2905d827f
Implement MSC3821 to update redaction rules (third_party_invite.signed) (#15563)
Updates the redaction rules to protect enough information that the
event can still be properly verified.
2023-05-15 15:02:24 -04:00
Patrick Cloke eb3c1823d8
Reject instead of erroring on invalid membership events. (#15564)
Instead of resulting in an internal server error for invalid events,
return that the event is invalid.
2023-05-15 15:01:29 -04:00
Patrick Cloke ba6b21c81e
Implement MSC3389 to protect relations from redaction. (#15565)
MSC3389 proposes protecting the relation type & parent event ID
from redaction. This keeps the relation information intact after
redaction which helps with some UX flaws (e.g. deleting an
event causes it to no longer be in a thread, which is confusing).
2023-05-15 12:58:09 +00:00
Mathieu Velten 8583346335 Revert "Bump pillow from 9.4.0 to 9.5.0 (#15593)"
This reverts commit 34ab801379.
2023-05-15 14:22:07 +02:00
icp b3ada9bfb4
Allow poetry-core 1.6.0 (#15588) 2023-05-15 11:19:11 +02:00
villepeh aa5c0592e7
Update Mastodon SSO instructions (#15587) 2023-05-15 11:17:24 +02:00
Michael Weimann 3690d5bd89
Add an unstable feature flag for MSC3981 to the /versions endpoint (#15558)
Signed-off-by: Michael Weimann <michaelw@matrix.org>
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2023-05-15 10:54:49 +02:00
dependabot[bot] 7b6c9f4c04
Bump phonenumbers from 8.13.7 to 8.13.11 (#15590) 2023-05-15 10:45:34 +02:00
dependabot[bot] 2e8a2bda52
Bump types-psycopg2 from 2.9.21.9 to 2.9.21.10 (#15591) 2023-05-15 10:45:15 +02:00
dependabot[bot] 3fd8eb81de
Bump types-commonmark from 0.9.2.2 to 0.9.2.3 (#15592) 2023-05-15 10:44:47 +02:00
dependabot[bot] 1b4782a37d
Bump types-setuptools from 67.7.0.1 to 67.7.0.2 (#15594) 2023-05-15 10:44:31 +02:00
dependabot[bot] 34ab801379
Bump pillow from 9.4.0 to 9.5.0 (#15593) 2023-05-15 10:44:06 +02:00
dependabot[bot] bcd2495469
Bump serde from 1.0.162 to 1.0.163 (#15589) 2023-05-15 10:42:51 +02:00
Patrick Cloke def480442d
Declare support for Matrix 1.6 (#15559)
Adds logging for key server requests which include a key ID.
This is technically in violation of the 1.6 spec, but is the only
way to remain backwards compatibly with earlier versions of
Synapse (and possibly other homeservers) which *did* include
the key ID.
2023-05-12 07:31:50 -04:00
Erik Johnston 808105bd31
Revert "Set thread_id column to non-null for event_push_{actions,actions_staging,summary} (#15437)" (#15580)
This reverts commit a7b3e9ce65.
2023-05-12 11:38:16 +01:00
David Robertson c96a1d2a27
Relax poetry-core lower bound to 1.1.0 (#15571)
See https://github.com/matrix-org/synapse/pull/15566#issuecomment-1543844104

Also check you can `pip install` in the old-deps CI job
2023-05-12 11:21:11 +01:00
helix-loop 08297f2f18
Add pkg-config package to Stage 0 (#15567) 2023-05-12 11:32:09 +02:00
David Robertson 7c76514f1e
Deal with more GHA deprecations (#15576)
* Bump netlify PR

* Manually cache mypy cache dir

cache cache cache cache cache cache cache cache cache cache

* Changelog
2023-05-11 18:24:32 +00:00
Eric Eastwood d19d1edbcf
Print full startup/initialization error (#15569)
I found the error in the **Before** really vague and obtuse and didn't realize port `5432` corresponded to the Postgres port until searching the codebase. It says to check the logs but that wasn't my first instinct. It's just more obvious if we just print the full thing which gives context of the error type and the traceback to the relevant area of code.

#### Before

```
$ poetry run python -m synapse.app.homeserver -c homeserver.yaml
**********************************************************************************
 Error during initialisation:
    connection to server at "localhost" (::1), port 5432 failed: Connection refused
 	Is the server running on that host and accepting TCP/IP connections?
 connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
 	Is the server running on that host and accepting TCP/IP connections?
 
 There may be more information in the logs.
**********************************************************************************
```

#### After

```sh
$ poetry run python -m synapse.app.homeserver -c homeserver.yaml
**********************************************************************************
 Error during initialisation:
     Traceback (most recent call last):
       File "/home/eric/Documents/github/element/synapse/synapse/app/homeserver.py", line 352, in setup
         hs.setup()
       File "/home/eric/Documents/github/element/synapse/synapse/server.py", line 337, in setup
         self.datastores = Databases(self.DATASTORE_CLASS, self)
       File "/home/eric/Documents/github/element/synapse/synapse/storage/databases/__init__.py", line 65, in __init__
         with make_conn(database_config, engine, "startup") as db_conn:
       File "/home/eric/Documents/github/element/synapse/synapse/storage/database.py", line 161, in make_conn
         native_db_conn = engine.module.connect(**db_params)
       File "/home/eric/.cache/pypoetry/virtualenvs/matrix-synapse-xCtC9ulO-py3.10/lib/python3.10/site-packages/psycopg2/__init__.py", line 122, in connect
         conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
     psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: Connection refused
     	Is the server running on that host and accepting TCP/IP connections?
     connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
     	Is the server running on that host and accepting TCP/IP connections?
 
 
 There may be more information in the logs.
**********************************************************************************
```
2023-05-11 11:50:46 -05:00
David Robertson 5a7742a833
Allow pip install to use setuptools_rust 1.6.0 (#15570)
* Allow `pip install` to use setuptools_rust 1.6.0

This was bumped by dependabot in #15512, but we didn't bump also raise
the version guard here. I don't know how we can avoid this happening in
the future.

Closes #15461.

Spotted in [1] by @landryb.

[1]: https://github.com/matrix-org/synapse/issues/15461#issuecomment-1543513934

* Changelog
2023-05-11 16:22:47 +00:00
Roel ter Maat 2611433b70
Add redis SSL configuration options (#15312)
* Add SSL options to redis config

* fix lint issues

* Add documentation and changelog file

* add missing . at the end of the changelog

* Move client context factory to new file

* Rename ssl to tls and fix typo

* fix lint issues

* Added when redis attributes were added
2023-05-11 13:02:51 +01:00