Erik Johnston
41d9ebb8d5
WIP
2026-04-16 12:35:03 +01:00
Erik Johnston
c31a342fe8
Fixup
2026-04-16 11:10:32 +01:00
Erik Johnston
dc7b482871
WIP
2026-04-16 11:04:13 +01:00
Erik Johnston
b9110931a0
WIP
2026-04-16 11:01:58 +01:00
Erik Johnston
02333ef4b9
Fix redaction
2026-04-16 11:01:58 +01:00
Erik Johnston
f3dac4729c
WIP
2026-04-16 11:01:57 +01:00
Erik Johnston
75577aab05
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
61b71dffa0
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
3fc8480135
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
14eb2a4e83
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
722cb29a6d
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
bf2fd53b4f
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
c03505bc8b
Make room versions a diff
2026-04-16 11:01:42 +01:00
Erik Johnston
69eb374475
Delta room versions
2026-04-16 11:01:42 +01:00
Erik Johnston
8338077bf2
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
c1cbd8cf40
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
9056570daa
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
a5121cdaed
Fixup after rebase
2026-04-16 11:01:42 +01:00
Erik Johnston
665f108c82
Fixups
2026-04-16 11:01:42 +01:00
Erik Johnston
7eb485f8d6
Use assert_never for EventRedactBehaviour
2026-04-16 11:01:42 +01:00
Erik Johnston
ee2c77dad8
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
34e6cbd1b8
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
dd65e3f053
EventID
2026-04-16 11:01:42 +01:00
Erik Johnston
f176bffb5c
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
fdc3d97e49
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
2631c7454f
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
6de35a7ee8
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
0276c52ff4
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
aeb99c65cc
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
853734e30f
WIP
2026-04-16 11:01:42 +01:00
Erik Johnston
2d015f78ea
Convert EventInternalMetadata to use Arc<RwLock<_>> ( #19669 )
...
This moves the reference counting from PyO3 into standard Rust types,
allowing the class to be used natively from Rust without needing a
Python runtime.
2026-04-16 10:59:39 +01:00
Erik Johnston
71781de707
Add a FilteredEvent type to handle per-user data on events ( #19640 )
...
When we return events to clients we need to annotate them with the
membership of the user at the time of the event, in the `unsigned`
section. We already check the membership at the event during the
visibility checks, and so we annotate events there. However, since this
a per-user field we end up having to clone the event in question.
Instead, let's add a `FilteredEvent` class that is returned by the
visibility checks, which allows returning the membership without editing
the event. This has three benefits:
1. Avoids the clones of the event.
2. Allows us to statically check that we have filtered events before
returning them to clients.
3. We no longer edit `unsigned` data after event deserialization, this
makes it easier to port the event class to Rust.
The last benefit is why we're doing this *now*, however IMV it shouldn't
affect whether we want this change or not.
Reviewable commit-by-commit
---------
Co-authored-by: Olivier 'reivilibre' <oliverw@element.io >
2026-04-16 09:47:08 +01:00
Olivier 'reivilibre
943da0ace8
Fix database migrations failing on platforms where SQLite is configured with SQLITE_DBCONFIG_DEFENSIVE by default, such as macOS. ( #19690 )
...
Fixes : #19616
This caused 2+ people trouble now, so worth batting away with a
low-effort change if we can.
Only seen on macOS so far, but nothing stops SQLite being configured in
defensive mode by default on other platforms, so it is not necessarily
entirely specific to macOS.
We *could* also do this for Python < 3.12 but it'd be more effort and I
don't know if it's worth it.
(For context @kegsay says the interpreter with this problem was
installed through `pyenv install`.)
---------
Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org >
2026-04-15 16:55:46 +01:00
Olivier 'reivilibre
52c05c5ca4
Introduce spam_checker_spammy internal event metadata. ( #19453 )
...
Follows: #19365
Part of: MSC4354 Sticky Events (experimental feature #19409 )
This PR introduces a `spam_checker_spammy` flag, analogous to
`policy_server_spammy`, as an explicit flag
that an event was decided to be spammy by a spam-checker module.
The original Sticky Events PR (#18968 ) just reused
`policy_server_spammy`, but it didn't sit right with me
because we (at least appear to be experimenting with features that)
allow users to opt-in to seeing
`policy_server_spammy` events (presumably for moderation purposes).
Keeping these flags separate felt best, therefore.
As for why we need this flag: soon soft-failed status won't be
permanent, at least for sticky events.
The spam checker modules currently work by making events soft-failed.
We want to prevent spammy events from getting
reconsidered/un-soft-failed, so it seems like we need
a flag to track spam-checker spamminess *separately* from soft-failed.
Should be commit-by-commit friendly, but is also small.
---------
Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org >
2026-04-15 16:53:23 +01:00
Quentin Gliech
bed00bb766
Allow resigning of events with a new signing key ( #19668 )
...
This adds a way to re-sign all locally-created events with a new signing
key, which is useful when rotating server signing keys.
This doesn't trigger automatically, instead needs to be triggered when
needed via the admin API.
c.f.
https://github.com/matrix-org/internal-config/issues/1670#issuecomment-4206020126
for internal discussion.
---------
Co-authored-by: Kegan Dougall <kegan@element.io >
Co-authored-by: Erik Johnston <erikj@element.io >
2026-04-14 16:44:58 +00:00
Eric Eastwood
1a949608d5
Re-usable Complement GitHub CI workflow ( #19533 )
...
Docs: https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows
2026-04-13 17:03:46 -05:00
Erik Johnston
8c1ac41cea
Small simplifications to the events class ( #19680 )
...
This is to make it easier to port to Rust, as well as making things
conceptually simpler.
Two changes:
1. Remove the `__getitem__` interface on events
2. Remove `.user_id` as an alias of `.sender`.
2026-04-13 17:52:13 +01:00
Quentin Gliech
784a28bbc8
Reject device_keys: null in POST /keys/upload ( #19637 )
...
The spec says `device_keys` may be omitted, but not set to `null`.
This was temporarily allowed as a workaround for misbehaving clients
(see #19023 ), which have since been fixed.
Fixes #19030
2026-04-13 15:33:19 +02:00
Eric Eastwood
0e3e947bd6
Fix docstring for limit argument in _maybe_backfill_inner(...) ( #19630 )
...
Incorrectly labeled in https://github.com/matrix-org/synapse/pull/13535 .
`maybe_backfill` already accurately describes `limit` (introduced in
https://github.com/matrix-org/synapse/pull/8349 )
Spotted in
https://github.com/element-hq/synapse/pull/19611#discussion_r3011259710
2026-04-10 13:58:30 -05:00
dependabot[bot]
62523d89ba
Bump cryptography from 46.0.6 to 46.0.7 ( #19674 )
2026-04-10 18:09:54 +01:00
dependabot[bot]
2390116e94
Bump sqlglot from 29.0.1 to 30.2.1 ( #19656 )
2026-04-10 18:09:21 +01:00
dependabot[bot]
aceb081771
Bump actions/setup-go and actions/cache. ( #19654 )
2026-04-10 18:06:39 +01:00
dependabot[bot]
3a30ca66c7
Bump sentry-sdk, hiredis and pygithub ( #19655 )
2026-04-10 18:06:08 +01:00
Will Hunt
2439990efc
Allow 'article' and 'profile' opengraph fields on URL previews. ( #19659 )
2026-04-10 18:04:11 +01:00
Travis Ralston
a7b87e26ab
Switch list quarantined media API to use max to_id instead of current ( #19677 )
...
Following up on
https://github.com/element-hq/synapse/pull/19558#discussion_r3054831510
Changelog for this PR is intended to overlap with the above PR.
`get_current_quarantined_media_stream_id` wasn't being used anywhere
else, so we can replace it like we do in this PR.
### Pull Request Checklist
<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->
* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog ).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
- Use markdown where necessary, mostly for `code blocks`.
- End with either a period (.) or an exclamation mark (!).
- Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html ) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters ))
---------
Co-authored-by: Eric Eastwood <erice@element.io >
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com >
2026-04-09 22:06:28 +00:00
Travis Ralston
fe742653ff
Add an API to list changes to quarantine state of media ( #19558 )
...
Fixes https://github.com/element-hq/synapse/issues/19352
(See issue for history of this feature and previous PRs)
> First, a [naive
implementation](https://github.com/element-hq/synapse/pull/19268 ) of the
endpoint was introduced, but it quickly ran into [performance issues on
query](https://github.com/element-hq/synapse/pull/19312 ) and [long
startup times](https://github.com/element-hq/synapse/issues/19349 ),
leading to its
[removal](https://github.com/element-hq/synapse/pull/19351 ). It also
didn't actually work, and would fail to expose media when it was
"unquarantined", so a [partial
fix](https://github.com/element-hq/synapse/pull/19308 ) was attempted,
where the suggested direction is to use a
[stream](https://element-hq.github.io/synapse/latest/development/synapse_architecture/streams.html#cheatsheet-for-creating-a-new-stream )
instead of a timestamp column.
This PR re-introduces the API building on the previous feedback:
* Adds a stream which tracks when media becomes (un)quarantined.
* Runs a background update to capture already-quarantined media.
* Adds a new admin API to return rows from the stream table.
We track both quarantine and unquarantine actions in the stream to allow
downstream consumers to process the records appropriately. Namely, to
allow our Synapse exchange in HMA to remove hashes for unquarantined
media (use case further explained in the
[issue](https://github.com/element-hq/synapse/issues/19352 )).
**Note**: This knowingly does not capture all cases of media being
quarantined. Other call sites are lower priority for T&S, and can be
addressed in a future PR. ~~An issue will be created after this PR is
merged to track those sites.~~
https://github.com/element-hq/synapse/issues/19672
### Pull Request Checklist
<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->
* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog ).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
- Use markdown where necessary, mostly for `code blocks`.
- End with either a period (.) or an exclamation mark (!).
- Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html ) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters ))
---------
Co-authored-by: turt2live <1190097+turt2live@users.noreply.github.com >
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com >
Co-authored-by: Eric Eastwood <erice@element.io >
2026-04-09 11:41:31 -06:00
Eric Eastwood
f7c8967604
Update developer stream docs to point out _setup_sequence(...) in portdb ( #19675 )
...
Part of https://github.com/element-hq/synapse/issues/19671
Spawning from [discussion in
`#synapse-dev:matrix.org`](https://matrix.to/#/!i5D5LLct_DYG-4hQprLzrxdbZ580U9UB6AEgFnk6rZQ/$Z3nqbH0Qy21FWC3qJOim6LSRCRpJ3pxV5DLXm98IA6I?via=element.io&via=matrix.org&via=beeper.com )
with roots in
https://github.com/element-hq/synapse/pull/19558#discussion_r3013184415 .
As trialed/discovered by @turt2live alongside @reivilibre and @clokep
❤️
### Why is this necessary?
If you forget to add `_setup_sequence(...)`, you can run into the
following error if there is 1 row in SQLite and then you use the
`portdb` script to try to migrate to Postgres (as
[explained](https://matrix.to/#/!i5D5LLct_DYG-4hQprLzrxdbZ580U9UB6AEgFnk6rZQ/$mHU6dcTNL7NMfKBCJUekCh7vDj1lr1GDjriZQl7oeeU?via=element.io&via=matrix.org&via=beeper.com )
by @reivilibre)
```
Postgres sequence 'quarantined_media_id_seq' is inconsistent with associated stream position
of 'quarantined_media' in the 'stream_positions' table.
```
2026-04-09 09:49:25 -05:00
Eric Eastwood
35b55e962a
Advertise MSC4445 sync timeline order ( #19642 )
...
Synapse uses topological ordering for initial sync (first time a room is
sent down `/sync`), https://github.com/element-hq/synapse/blob/2e9b8202f0a1a8ceba9f02bb5ec227498d51dcbd/synapse/handlers/sync.py#L768-L805
2026-04-08 10:47:13 -05:00
Eric Eastwood
15662db095
Fix Docker image link typo in worker docs ( #19645 )
...
Fix https://github.com/element-hq/synapse/issues/19521
2026-04-08 10:14:58 -05:00
Quentin Gliech
a778497acb
Merge branch 'master' into develop
2026-04-07 15:43:26 +02:00