summary refs log tree commit diff
path: root/synapse/federation (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add some type annotations to the federation base & client classes (#6995)Patrick Cloke2020-02-282-28/+42
|
* Merge remote-tracking branch 'origin/release-v1.11.1' into developPatrick Cloke2020-02-271-6/+8
|\
| * Cast a coroutine into a Deferred in the federation base (#6996)Patrick Cloke2020-02-261-6/+8
| | | | | | | | Properly convert a coroutine into a Deferred in federation_base to fix an error when joining a room.
* | Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-2/+2
|/ | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Add support for putting fed user query API on workers (#6873)Erik Johnston2020-02-071-2/+5
|
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-3/+2
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* Add typing to synapse.federation.sender (#6871)Erik Johnston2020-02-075-105/+128
|
* Pass room_version into `event_from_pdu_json`Richard van der Hoff2020-02-063-58/+46
| | | | It's called from all over the shop, so this one's a bit messy.
* pass room version into FederationClient.send_join (#6854)Richard van der Hoff2020-02-061-28/+32
| | | | ... which allows us to sanity-check the create event.
* Reduce amount of logging at INFO level. (#6862)Erik Johnston2020-02-062-4/+4
| | | | | | | | A lot of the things we log at INFO are now a bit superfluous, so lets make them DEBUG logs to reduce the amount we log by default. Co-Authored-By: Brendan Abolivier <babolivier@matrix.org> Co-authored-by: Brendan Abolivier <github@brendanabolivier.com>
* Simplify `room_version` handling in `FederationClient.send_invite`Richard van der Hoff2020-02-051-10/+6
|
* Pass room version object into `FederationClient.get_pdu`Richard van der Hoff2020-02-051-3/+5
|
* make FederationClient._do_send_invite asyncRichard van der Hoff2020-02-051-10/+7
|
* Apply suggestions from code reviewRichard van der Hoff2020-02-051-2/+4
| | | Co-Authored-By: Erik Johnston <erik@matrix.org>
* make FederationClient.send_invite asyncRichard van der Hoff2020-02-031-6/+5
|
* make FederationClient.get_missing_events asyncRichard van der Hoff2020-02-031-20/+20
|
* make FederationClient._do_send_leave asyncRichard van der Hoff2020-02-031-4/+3
|
* make FederationClient.send_leave.send_request asyncRichard van der Hoff2020-02-031-5/+2
|
* make FederationClient._do_send_join asyncRichard van der Hoff2020-02-031-4/+3
|
* make FederationClient.send_join.send_request asyncRichard van der Hoff2020-02-031-4/+3
|
* make FederationClient.make_membership_event.send_request asyncRichard van der Hoff2020-02-031-4/+3
|
* make FederationClient._try_destination_list asyncRichard van der Hoff2020-02-031-10/+26
|
* make FederationClient.send_leave asyncRichard van der Hoff2020-02-031-10/+9
|
* make FederationClient.send_join asyncRichard van der Hoff2020-02-031-11/+13
|
* make FederationClient.make_membership_event asyncRichard van der Hoff2020-02-031-10/+11
|
* make FederationClient.get_event_auth asyncRichard van der Hoff2020-02-031-6/+4
|
* make FederationClient.get_room_state_ids asyncRichard van der Hoff2020-02-031-4/+5
|
* make FederationClient.get_pdu asyncRichard van der Hoff2020-02-031-15/+17
|
* make FederationClient.backfill asyncRichard van der Hoff2020-02-031-15/+11
|
* Fix `room_version` in `on_invite_request` flow (#6827)Richard van der Hoff2020-02-032-7/+10
| | | | I messed this up a bit in #6805, but fortunately we weren't actually doing anything with the room_version so it didn't matter that it was a str not a RoomVersion.
* Merge pull request #6806 from matrix-org/rav/redact_changes/3Richard van der Hoff2020-01-311-3/+1
|\ | | | | Pass room_version into add_hashes_and_signatures
| * Pass room_version into create_local_event_from_event_dictRichard van der Hoff2020-01-301-3/+1
| |
* | s/get_room_version/get_room_version_id/Richard van der Hoff2020-01-312-13/+13
| | | | | | | | | | ... to make way for a forthcoming get_room_version which returns a RoomVersion object.
* | pass room version into FederationHandler.on_invite_request (#6805)Richard van der Hoff2020-01-301-1/+1
|/
* Fix sending server up commands from workers (#6811)Erik Johnston2020-01-302-12/+19
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Remove unused DeviceRow class (#6800)Erik Johnston2020-01-291-20/+1
|
* Fix race in federation sender that delayed device updates. (#6799)Erik Johnston2020-01-291-29/+3
| | | | | | | | | | | | We were sending device updates down both the federation stream and device streams. This mean there was a race if the federation sender worker processed the federation stream first, as when the sender checked if there were new device updates the slaved ID generator hadn't been updated with the new stream IDs and so returned nothing. This situation is correctly handled by events/receipts/etc by not sending updates down the federation stream and instead having the federation sender worker listen on the other streams and poke the transaction queues as appropriate.
* Add `rooms.room_version` column (#6729)Erik Johnston2020-01-271-17/+33
| | | This is so that we don't have to rely on pulling it out from `current_state_events` table.
* Wake up transaction queue when remote server comes back online (#6706)Erik Johnston2020-01-172-3/+34
| | | | | This will be used to retry outbound transactions to a remote server if we think it might have come back up.
* Add StateMap type alias (#6715)Erik Johnston2020-01-161-1/+2
|
* Port synapse.replication.tcp to async/await (#6666)Erik Johnston2020-01-161-1/+3
| | | | | | | | | | * Port synapse.replication.tcp to async/await * Newsfile * Correctly document type of on_<FOO> functions as async * Don't be overenthusiastic with the asyncing....
* Process EDUs in parallel with PDUs. (#6697)Erik Johnston2020-01-141-12/+58
| | | | This means that things like to device messages don't get blocked behind processing PDUs, which can potentially take *ages*.
* Merge pull request #6349 from matrix-org/babolivier/msc1802Brendan Abolivier2019-12-114-28/+140
|\ | | | | Implement v2 APIs for send_join and send_leave
| * Merge branch 'develop' into babolivier/msc1802Brendan Abolivier2019-12-058-26/+34
| |\
| * | LintBrendan Abolivier2019-11-111-3/+2
| | |
| * | LintBrendan Abolivier2019-11-111-3/+1
| | |
| * | Fix prefix for v2/send_leaveBrendan Abolivier2019-11-111-0/+2
| | |
| * | Add server-side support to the v2 APIBrendan Abolivier2019-11-112-14/+33
| | |
| * | Implement v2 API for send_leaveBrendan Abolivier2019-11-112-5/+56
| | |
| * | Add missing yieldBrendan Abolivier2019-11-111-1/+1
| | |
| * | Implement v2 API for send_joinBrendan Abolivier2019-11-112-8/+51
| | |
* | | Move get_state methods into FederationHandler (#6503)Richard van der Hoff2019-12-101-80/+11
| | | | | | | | | | | | | | | This is a non-functional refactor as a precursor to some other work.
* | | Refactor get_events_from_store_or_dest to return a dict (#6501)Richard van der Hoff2019-12-101-29/+15
| | | | | | | | | | | | | | | There was a bunch of unnecessary conversion back and forth between dict and list going on here. We can simplify a bunch of the code.
* | | Remove fallback for missing /federation/v1/state_ids API (#6488)Richard van der Hoff2019-12-092-96/+17
| |/ |/| | | | | This API was added way back in 0.17.0; the code here is annoying to maintain and entirely redundant.
* | Implementation of MSC2314 (#6176)Amber Brown2019-11-282-12/+20
| |
* | Clean up newline quote marks around the codebase (#6362)Andrew Morgan2019-11-213-5/+5
| |
* | Replace instance variations of homeserver with correct case/spacingAndrew Morgan2019-11-124-9/+9
|/
* Depublish a room from the public rooms list when it is upgraded (#6232)Andrew Morgan2019-11-011-1/+1
|
* Merge branch 'develop' into cross-signing_federationHubert Chathi2019-10-316-25/+32
|\
| * Update black to 19.10b0 (#6304)Amber Brown2019-11-011-5/+6
| | | | | | * update version of black and also fix the mypy config being overridden
| * Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-315-20/+26
| | | | | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* | rename get_devices_by_remote to get_device_updates_by_remoteHubert Chathi2019-10-301-2/+2
| |
* | Merge branch 'develop' into cross-signing_federationHubert Chathi2019-10-305-131/+106
|\|
| * Fix small typo in comment (#6269)Andrew Morgan2019-10-301-1/+1
| |
| * Merge pull request #6280 from matrix-org/erikj/receipts_async_awaitErik Johnston2019-10-301-1/+3
| |\ | | | | | | Port receipt and read markers to async/wait
| | * Port receipt and read markers to async/waitErik Johnston2019-10-291-1/+3
| | |
| * | Don't return coroutinesErik Johnston2019-10-291-6/+6
| |/
| * Port federation_server to async/awaitErik Johnston2019-10-291-118/+87
| |
| * Merge tag 'v1.5.0rc2' into developRichard van der Hoff2019-10-282-5/+9
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 1.5.0rc2 (2019-10-28) ============================= Bugfixes -------- - Update list of boolean columns in `synapse_port_db`. ([\#6247](https://github.com/matrix-org/synapse/issues/6247)) - Fix /keys/query API on workers. ([\#6256](https://github.com/matrix-org/synapse/issues/6256)) - Improve signature checking on some federation APIs. ([\#6262](https://github.com/matrix-org/synapse/issues/6262)) Internal Changes ---------------- - Move schema delta files to the correct data store. ([\#6248](https://github.com/matrix-org/synapse/issues/6248)) - Small performance improvement by removing repeated config lookups in room stats calculation. ([\#6255](https://github.com/matrix-org/synapse/issues/6255))
| | * Improve signature checking on some federation APIs (#6262)Richard van der Hoff2019-10-282-5/+9
| | | | | | | | | | | | | | | Make sure that we check that events sent over /send_join, /send_leave, and /invite, are correctly signed and come from the expected servers.
| * | use %r to __repr__ objectsMichael Kaye2019-10-242-3/+3
| |/ | | | | | | This avoids calculating __repr__ unless we are going to log.
* | Merge branch 'develop' into cross-signing_federationHubert Chathi2019-10-241-1/+1
|\|
| * Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-10-222-49/+0
| |\ | | | | | | | | | erikj/refactor_stores
| * | Move storage classes into a main "data store".Erik Johnston2019-10-211-1/+1
| | | | | | | | | | | | | | | This is in preparation for having multiple data stores that offer different functionality, e.g. splitting out state or event storage.
* | | implement federation parts of cross-signingHubert Chathi2019-10-221-2/+2
| |/ |/|
* | rip out some unreachable codeRichard van der Hoff2019-10-172-49/+0
|/ | | | The only possible rejection reason is AUTH_ERROR, so all of this is unreachable.
* Fix /federation/v1/state for recent room versions (#6170)Richard van der Hoff2019-10-081-13/+0
| | | | | | | * Fix /federation/v1/state for recent room versions Turns out this endpoint was completely broken for v3 rooms. Hopefully this re-signing code is irrelevant nowadays anyway.
* add some metrics on the federation sender (#6160)Richard van der Hoff2019-10-031-5/+6
|
* Land improved room list based on room stats (#6019)Erik Johnston2019-10-021-0/+8
| | | | Use room_stats and room_state for room directory search
* Fix exception when resetting retry timingsRichard van der Hoff2019-09-201-1/+1
| | | | | | | | Fixes: > TypeError: set_destination_retry_timings() missing 1 required positional argument: 'retry_interval' Introduced in #6016.
* Remove origin parameter from add_display_name_to_third_party_invite and add ↵Andrew Morgan2019-09-112-3/+3
| | | | | | | params to docstring (#6010) Another small fixup noticed during work on a larger PR. The `origin` field of `add_display_name_to_third_party_invite` is not used and likely was just carried over from the `on_PUT` method of `FederationThirdPartyInviteExchangeServlet` which, like all other servlets, provides an `origin` argument. Since it's not used anywhere in the handler function though, we should remove it from the function arguments.
* Merge pull request #5984 from ↵Erik Johnston2019-09-052-3/+13
|\ | | | | | | | | matrix-org/joriks/opentracing_link_send_to_edu_contexts Link the send loop with the edus contexts
| * use access methods (duh..)Jorik Schellekens2019-09-051-1/+3
| | | | | | Co-Authored-By: Erik Johnston <erik@matrix.org>
| * Link the send loop with the edus contextsJorik Schellekens2019-09-052-3/+11
| | | | | | | | | | | | The contexts were being filtered too early so the send loop wasn't being linked to them unless the destination was whitelisted.
* | Add opentracing to all client servlets (#5983)Jorik Schellekens2019-09-051-1/+5
|/
* Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-302-15/+15
| | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* Merge pull request #5859 from matrix-org/rei/msc2197reivilibre2019-08-282-15/+67
|\ | | | | MSC2197 Search Filters over Federation
| * Use MSC2197 on stable prefix as it has almost finished FCPOlivier Wilkinson (reivilibre)2019-08-202-26/+4
| | | | | | | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
| * Add support for inbound MSC2197 requests on unstable Federation APIOlivier Wilkinson (reivilibre)2019-08-151-1/+59
| | | | | | | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
| * Support MSC2197 outbound with unstable prefixOlivier Wilkinson (reivilibre)2019-08-151-15/+31
| | | | | | | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
* | Propagate opentracing contexts through EDUs (#5852)Jorik Schellekens2019-08-223-80/+108
| | | | | | | | | | Propagate opentracing contexts through EDUs Co-Authored-By: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* | Opentracing across workers (#5771)Jorik Schellekens2019-08-221-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate opentracing contexts across workers Also includes some Convenience modifications to opentracing for servlets, notably: - Add boolean to skip the whitelisting check on inject extract methods. - useful when injecting into carriers locally. Otherwise we'd always have to include our own servername and whitelist our servername - start_active_span_from_request instead of header - Add boolean to decide whether to extract context from a request to a servlet
* | Opentrace e2e keys (#5855)Jorik Schellekens2019-08-221-0/+3
| | | | | | Add opentracing tags and logs for e2e keys
* | Opentracing misc (#5856)Jorik Schellekens2019-08-161-6/+7
| | | | | | | | | | | | | | | | | | | | | | Add authenticated_entity and servlet_names tags. Functionally: - Add a tag for authenticated_entity - Add a tag for servlet_names Stylistically: Moved to importing methods directly from opentracing.
* | Wrap `get_local_public_room_list` call in `maybeDeferred` because itOlivier Wilkinson (reivilibre)2019-08-141-2/+8
|/ | | | | | | is cached and so does not always return a `Deferred`. `await` does not silently pass-through non-Deferreds like `yield` used to. Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
* Return 502 not 500 when failing to reach any remote server.Erik Johnston2019-08-011-4/+3
|
* Room Complexity Client Implementation (#5783)Amber Brown2019-07-302-7/+60
|
* Merge pull request #5744 from matrix-org/erikj/log_leave_origin_mismatchRichard van der Hoff2019-07-261-2/+2
|\ | | | | Log when we receive a /make_* request from a different origin
| * Log when we receive a /make_* request from a different originRichard van der Hoff2019-07-261-2/+2
| |
* | Merge tag 'v1.2.0rc2' into developAndrew Morgan2019-07-241-1/+3
|\| | | | | | | | | | | | | Bugfixes -------- - Fix a regression introduced in v1.2.0rc1 which led to incorrect labels on some prometheus metrics. ([\#5734](https://github.com/matrix-org/synapse/issues/5734))
| * Fix servlet metric names (#5734)Jorik Schellekens2019-07-241-1/+3
| | | | | | | | | | | | | | | | | | | | * Fix servlet metric names Co-Authored-By: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Remove redundant check * Cover all return paths
* | Replace returnValue with return (#5736)Amber Brown2019-07-236-90/+75
|/
* Convert synapse.federation.transport.server to async (#5689)Richard van der Hoff2019-07-181-242/+188
| | | | | | | | | | | | | | | | * Convert BaseFederationServlet._wrap to async Empirically, this fixes some lost stacktraces. It should be safe because the wrapped function is called from JsonResource._async_render, which is already async. * Convert the rest of synapse.federation.transport.server to async We may as well do the whole file while we're here. * changelog * flake8
* Add basic opentracing support (#5544)Jorik Schellekens2019-07-111-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Configure and initialise tracer Includes config options for the tracer and sets up JaegerClient. * Scope manager using LogContexts We piggy-back our tracer scopes by using log context. The current log context gives us the current scope. If new scope is created we create a stack of scopes in the context. * jaeger is a dependency now * Carrier inject and extraction for Twisted Headers * Trace federation requests on the way in and out. The span is created in _started_processing and closed in _finished_processing because we need a meaningful log context. * Create logcontext for new scope. Instead of having a stack of scopes in a logcontext we create a new context for a new scope if the current logcontext already has a scope. * Remove scope from logcontext if logcontext is top level * Disable tracer if not configured * typo * Remove dependence on jaeger internals * bools * Set service name * :Explicitely state that the tracer is disabled * Black is the new black * Newsfile * Code style * Use the new config setup. * Generate config. * Copyright * Rename config to opentracing * Remove user whitelisting * Empty whitelist by default * User ConfigError instead of RuntimeError * Use isinstance * Use tag constants for opentracing. * Remove debug comment and no need to explicitely record error * Two errors a "s(c)entry" * Docstrings! * Remove debugging brainslip * Homeserver Whitlisting * Better opentracing config comment * linting * Inclue worker name in service_name * Make opentracing an optional dependency * Neater config retreival * Clean up dummy tags * Instantiate tracing as object instead of global class * Inlcude opentracing as a homeserver member. * Thread opentracing to the request level * Reference opetnracing through hs * Instantiate dummy opentracin g for tests. * About to revert, just keeping the unfinished changes just in case * Revert back to global state, commit number: 9ce4a3d9067bf9889b86c360c05ac88618b85c4f * Use class level methods in tracerutils * Start and stop requests spans in a place where we have access to the authenticated entity * Seen it, isort it * Make sure to close the active span. * I'm getting black and blue from this. * Logger formatting Co-Authored-By: Erik Johnston <erik@matrix.org> * Outdated comment * Import opentracing at the top * Return a contextmanager * Start tracing client requests from the servlet * Return noop context manager if not tracing * Explicitely say that these are federation requests * Include servlet name in client requests * Use context manager * Move opentracing to logging/ * Seen it, isort it again! * Ignore twisted return exceptions on context exit * Escape the scope * Scopes should be entered to make them useful. * Nicer decorator names * Just one init, init? * Don't need to close something that isn't open * Docs make you smarter
* remove dead transaction persist code (#5622)Richard van der Hoff2019-07-052-41/+0
| | | | this hasn't done anything for years
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-047-22/+32
|
* Split public rooms directory auth config in twoBrendan Abolivier2019-06-241-4/+4
|
* Fix logging error when a tampered event is detected. (#5500)Richard van der Hoff2019-06-211-1/+0
|
* Run Black. (#5482)Amber Brown2019-06-2011-752/+613
|
* Add experimental option to reduce extremities.Erik Johnston2019-06-181-0/+3
| | | | | | | Adds new config option `cleanup_extremities_with_dummy_events` which periodically sends dummy events to rooms with more than 10 extremities. THIS IS REALLY EXPERIMENTAL.
* Clean up code for sending federation EDUs. (#5381)Richard van der Hoff2019-06-131-14/+26
| | | | This code confused the hell out of me today. Split _get_new_device_messages into its two (unrelated) parts.
* Prevent multiple device list updates from breaking a batch send (#5156)Andrew Morgan2019-06-061-2/+3
| | | fixes #5153
* Associate a request_name with each verify request, for loggingRichard van der Hoff2019-06-052-1/+5
| | | | | | | Also: * rename VerifyKeyRequest->VerifyJsonRequest * calculate key_ids on VerifyJsonRequest construction * refactor things to pass around VerifyJsonRequests instead of 4-tuples
* Add a test room version where we enforce key validity (#5348)Richard van der Hoff2019-06-051-15/+24
|
* Clean up debug logging (#5347)Richard van der Hoff2019-06-051-3/+13
| | | Remove some spurious stuff, clarify some other stuff
* Fix failure to fetch batches of PDUs (#5342)Richard van der Hoff2019-06-041-0/+1
| | | | | FederationClient.get_pdu is called in a loop to fetch a batch of PDUs. A failure to fetch one should not result in a failure of the whole batch. Add the missing `continue`.
* Rename get_events->get_events_from_store_or_dest (#5344)Richard van der Hoff2019-06-041-20/+13
| | | | | We have too many things called get_event, and it's hard to figure out what we mean. Also remove some unused params from the signature, and add some logging.
* Enforce validity period on server_keys for fed requests. (#5321)Richard van der Hoff2019-06-032-3/+5
| | | | | | | | When handling incoming federation requests, make sure that we have an up-to-date copy of the signing key. We do not yet enforce the validity period for event signatures.
* Implement the SHHS complexity API (#5216)Amber Brown2019-05-301-1/+30
|
* Fix error handling for rooms whose versions are unknown. (#5219)Richard van der Hoff2019-05-211-1/+13
| | | | | | | If we remove support for a particular room version, we should behave more gracefully. This should make client requests fail with a 400 rather than a 500, and will ignore individiual PDUs in a federation transaction, rather than the whole transaction.
* Make all the rate limiting options more consistent (#5181)Amber Brown2019-05-151-5/+1
|
* Run `black` on per_destination_queueRichard van der Hoff2019-05-091-35/+39
| | | | ... mostly to fix pep8 fails
* Limit the number of EDUs in transactions to 100 as expected by receiver (#5138)Quentin Dufour2019-05-091-26/+30
| | | Fixes #3951.
* add options to require an access_token to GET /profile and /publicRooms on ↵Matthew Hodgson2019-05-081-0/+10
| | | | | | | | | | | | | | | | | CS API (#5083) This commit adds two config options: * `restrict_public_rooms_to_local_users` Requires auth to fetch the public rooms directory through the CS API and disables fetching it through the federation API. * `require_auth_for_profile_requests` When set to `true`, requires that requests to `/profile` over the CS API are authenticated, and only returns the user's profile if the requester shares a room with the profile's owner, as per MSC1301. MSC1301 also specifies a behaviour for federation (only returning the profile if the server asking for it shares a room with the profile's owner), but that's currently really non-trivial to do in a not too expensive way. Next step is writing down a MSC that allows a HS to specify which user sent the profile query. In this implementation, Synapse won't send a profile query over federation if it doesn't believe it already shares a room with the profile's owner, though. Groups have been intentionally omitted from this commit.
* more logging improvementsRichard van der Hoff2019-04-251-8/+11
|
* remove extraneous exception loggingRichard van der Hoff2019-04-251-2/+2
|
* Clarify logging when PDU signature checking failsRichard van der Hoff2019-04-251-0/+19
|
* Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-014-25/+27
| | | | Collect all the things that make room-versions different to one another into one place, so that it's easier to define new room versions.
* Use event streams to calculate presenceErik Johnston2019-03-272-3/+89
| | | | | | | | | | | | | | | | | Primarily this fixes a bug in the handling of remote users joining a room where the server sent out the presence for all local users in the room to all servers in the room. We also change to using the state delta stream, rather than the distributor, as it will make it easier to split processing out of the master process (as well as being more flexible). Finally, when sending presence states to newly joined servers we filter out old presence states to reduce the number sent. Initially we filter out states that are offline and have a last active more than a week ago, though this can be changed down the line. Fixes #3962
* Make federation endpoints more tolerant of trailing slashes v2 (#4935)Andrew Morgan2019-03-262-8/+8
| | | Redo of https://github.com/matrix-org/synapse/pull/4840
* Remove trailing slashes from outbound federation requests and retry on 400 ↵Andrew Morgan2019-03-211-7/+14
|\ | | | | | | | | (#4840) As per #3622, we remove trailing slashes from outbound federation requests. However, to ensure that we remain backwards compatible with previous versions of Synapse, if we receive a HTTP 400 with `M_UNRECOGNIZED`, then we are likely talking to an older version of Synapse in which case we retry with a trailing slash appended to the request path.
| * Switch to wrapper function around _send_requestAndrew Morgan2019-03-131-5/+5
| |
| * Cleaner way of implementing trailing slashesAndrew Morgan2019-03-121-5/+10
| |
| * Merge branch 'develop' into anoa/trailing_slashes_clientAndrew Morgan2019-03-111-7/+7
| |\
| * | lintAndrew Morgan2019-03-081-1/+3
| | |
| * | Retry certain federation requests on 404Andrew Morgan2019-03-081-5/+5
| | |
| * | Remove trailing slashes from outbound federation requestsAndrew Morgan2019-03-081-7/+7
| | |
* | | Batch up outgoing read-receipts to reduce federation traffic. (#4890)Richard van der Hoff2019-03-202-21/+158
| | | | | | | | | | | | Rate-limit outgoing read-receipts as per #4730.
* | | Merge pull request #4855 from matrix-org/rav/refactor_transaction_queueRichard van der Hoff2019-03-155-758/+860
|\ \ \ | | | | | | | | Split TransactionQueue up
| * | | Rename and move the classesRichard van der Hoff2019-03-135-808/+860
| | | |
| * | | Factor per-destination stuff out of TransactionQueueRichard van der Hoff2019-03-131-132/+182
| | | | | | | | | | | | | | | | This is easier than having to have a million fields keyed on destination.
* | | | Merge pull request #4852 from matrix-org/rav/move_rr_sending_to_workerRichard van der Hoff2019-03-152-0/+44
|\| | | | | | | | | | | Move client receipt processing to federation sender worker.
| * | | Move client receipt processing to federation sender worker.Richard van der Hoff2019-03-132-0/+44
| | |/ | |/| | | | | | | | | | This is mostly a prerequisite for #4730, but also fits with the general theme of "move everything off the master that we possibly can".
* / | Revert "Make federation endpoints more tolerant of trailing slashes for some ↵Erik Johnston2019-03-142-8/+8
|/ / | | | | | | | | | | endpoints (#4793)" This reverts commit 290552fd836f4ae2dc1d893a7f72f7fff85365d3.
* / Make federation endpoints more tolerant of trailing slashes for some ↵Andrew Morgan2019-03-112-8/+8
|/ | | | | endpoints (#4793) Server side of a solution towards #3622.
* Remove unnecessary dollar signsAndrew Morgan2019-03-041-22/+22
| | | | | A dollar sign is already appended to the end of each PATH, so there's no need to add one in the PATH declaration as well.
* Avoid rebuilding Edu objects in worker mode (#4770)Richard van der Hoff2019-03-042-14/+31
| | | | | In worker mode, on the federation sender, when we receive an edu for sending over the replication socket, it is parsed into an Edu object. There is no point extracting the contents of it so that we can then immediately build another Edu.
* Make 'event_id' a required parameter in federated state requests (#4741)Amber Brown2019-02-271-2/+2
| | | | | | | | | | | | | | * make 'event_id' a required parameter in federated state requests As per the spec: https://matrix.org/docs/spec/server_server/r0.1.1.html#id40 Signed-off-by: Joseph Weston <joseph@weston.cloud> * add changelog entry for bugfix Signed-off-by: Joseph Weston <joseph@weston.cloud> * Update server.py
* When presence is enabled don't send over replicationErik Johnston2019-02-271-0/+3
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Andrew Morgan2019-02-267-243/+588
|\ | | | | | | anoa/public_rooms_federate_develop
| * Revert "Prevent showing non-fed rooms in fed /publicRooms"Andrew Morgan2019-02-261-2/+1
| |
| * Merge pull request #4736 from matrix-org/anoa/public_rooms_federateAndrew Morgan2019-02-261-1/+2
| |\ | | | | | | Config option to prevent showing non-fed rooms in fed /publicRooms
| | * Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-02-257-241/+561
| | |\ | | | | | | | | | | | | anoa/public_rooms_federate
| | * | Don't restrict non-fed rooms over client APIsAndrew Morgan2019-02-251-1/+2
| | | |
| * | | Merge pull request #4737 from matrix-org/erikj/failure_log_tbErik Johnston2019-02-251-2/+3
| |\ \ \ | | | | | | | | | | Log tracebacks correctly
| | * | | Log tracebacks correctlyErik Johnston2019-02-251-2/+3
| | | |/ | | |/|
| * / | MSC 1866 - Use M_UNSUPPORTED_ROOM_VERSION for invite APIErik Johnston2019-02-232-2/+26
| |/ /
| * | Add metrics for number of outgoing EDUs, by type (#4695)Richard van der Hoff2019-02-201-4/+18
| | |
| * | Merge pull request #4420 from matrix-org/jaywink/openid-listenerErik Johnston2019-02-111-42/+95
| |\ \ | | | | | | | | New listener resource for the federation API "openid/userinfo" endpoint
| | * | Document `servlet_groups` parametersJason Robinson2019-01-231-0/+23
| | | | | | | | | | | | | | | | Signed-off-by: Jason Robinson <jasonr@matrix.org>
| | * | Split federation OpenID userinfo endpoint out of the federation resourceJason Robinson2019-01-231-42/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the OpenID userinfo endpoint to be active even if the federation resource is not active. The OpenID userinfo endpoint is called by integration managers to verify user actions using the client API OpenID access token. Without this verification, the integration manager cannot know that the access token is valid. The OpenID userinfo endpoint will be loaded in the case that either "federation" or "openid" resource is defined. The new "openid" resource is defaulted to active in default configuration. Signed-off-by: Jason Robinson <jasonr@matrix.org>
| * | | Reject large transactions on federation (#4513)Andrew Morgan2019-01-311-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Reject large transactions on federation * Add changelog * lint * Simplify large transaction handling
| * | | No vdh tests!Erik Johnston2019-01-291-2/+1
| | | |
| * | | Enable room version v3Erik Johnston2019-01-291-2/+9
| | | |
| * | | Update commentErik Johnston2019-01-291-3/+3
| | | |
| * | | Only check event ID domain for signatures for V1 eventsErik Johnston2019-01-293-31/+44
| | | | | | | | | | | | | | | | | | | | In future version events won't have an event ID, so we won't be able to do this check.
| * | | Use event origin for filtering incoming eventsErik Johnston2019-01-291-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | We only process events sent to us from a server if the event ID matches the server, to help guard against federation storms. We replace this with a check against the event origin.
| * | | Use snder and not event ID domain to check if oursErik Johnston2019-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The transaction queue only sends out events that we generate. This was done by checking domain of event ID, but that can no longer be used. Instead, we may as well use the sender field.
| * | | Merge pull request #4481 from matrix-org/erikj/event_builderErik Johnston2019-01-291-14/+6
| |\ \ \ | | | | | | | | | | Refactor event building into EventBuilder
| | * | | Refactor event building into EventBuilderErik Johnston2019-01-291-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | This is so that everything is done in one place, making it easier to change the event format based on room version
| * | | | Merge pull request #4510 from matrix-org/erikj/fixup_compute_event_signatureErik Johnston2019-01-291-1/+1
| |\ \ \ \ | | | | | | | | | | | | Fixup calls to `comput_event_signature`
| | * | | | Fixup calls to `comput_event_signature`Erik Johnston2019-01-291-1/+1
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently pass FrozenEvent instead of `dict` to `compute_event_signature`, which works by accident due to `dict(event)` producing the correct result. This fixes PR #4493 commit 855a151
| * / / / Implement fallback for V2 invite APIErik Johnston2019-01-282-14/+89
| |/ / / | | | | | | | | | | | | | | | | If the room version is either 1 or 2 then a server should retry failed `/v2/invite` requests with the v1 API
| * | | Require event format version to parse or create eventsErik Johnston2019-01-254-41/+65
| | | |
| * | | Merge branch 'develop' of github.com:matrix-org/synapse into erikj/msc_1813Erik Johnston2019-01-253-13/+64
| |\ \ \
| | * \ \ Merge pull request #4448 from matrix-org/erikj/get_pdu_versionsErik Johnston2019-01-243-11/+51
| | |\ \ \ | | | | | | | | | | | | Add room_version param to get_pdu
| | | * | | Review commentsErik Johnston2019-01-241-1/+2
| | | | | |
| | | * | | Add room_version param to get_pduErik Johnston2019-01-233-11/+50
| | | |/ / | | | | | | | | | | | | | | | | | | | | When we add new event format we'll need to know the event format or room version when parsing events.
| | * | | Update make_membership_event docsErik Johnston2019-01-241-2/+5
| | | | |
| | * | | Remove unnecessary '_sign_event'Erik Johnston2019-01-231-1/+8
| | | | |
| | * | | Store rejected remote invite events as outliersErik Johnston2019-01-231-2/+8
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently they're stored as non-outliers even though the server isn't in the room, which can be problematic in places where the code assumes it has the state for all non outlier events. In particular, there is an edge case where persisting the leave event triggers a state resolution, which requires looking up the room version from state. Since the server doesn't have the state, this causes an exception to be thrown.
| * | | Review commentsErik Johnston2019-01-241-1/+2
| | | |
| * | | Implement MSC 1813 - Add room version to make APIsErik Johnston2019-01-232-6/+23
| |/ / | | | | | | | | | | | | We also implement `make_membership_event` converting the returned room version to an event format version.
| * | Add /v2/invite federation APIErik Johnston2019-01-152-6/+40
| | |
| * | Add groundwork for new versions of federation APIsErik Johnston2019-01-152-67/+71
| | |
| * | Don't log stack traces for HTTP error responsesErik Johnston2019-01-081-1/+6
| | |
| * | Refactor request sending to have better excpetions (#4358)Erik Johnston2019-01-081-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Correctly retry and back off if we get a HTTPerror response * Refactor request sending to have better excpetions MatrixFederationHttpClient blindly reraised exceptions to the caller without differentiating "expected" failures (e.g. connection timeouts etc) versus more severe problems (e.g. programming errors). This commit adds a RequestSendFailed exception that is raised when "expected" failures happen, allowing the TransactionQueue to log them as warnings while allowing us to log other exceptions as actual exceptions.
| * | Update synapse/federation/federation_server.pyRichard van der Hoff2018-11-091-1/+1
| | | | | | | | | Co-Authored-By: erikjohnston <erikj@jki.re>
| * | Update synapse/federation/federation_server.pyRichard van der Hoff2018-11-091-1/+1
| | | | | | | | | Co-Authored-By: erikjohnston <erikj@jki.re>
| * | Drop PDUs of unknown roomsErik Johnston2018-11-081-1/+23
| | | | | | | | | | | | | | | | | | When we receive events over federation we will need to know the room version to be able to correctly handle them, e.g. once we start changing event formats. Currently, we attempt to handle events in unknown rooms.
| * | Add helpers for getting prev and auth events (#4139)Erik Johnston2018-11-061-3/+1
| | | | | | | | | | | | | | | | | | | | | * Add helpers for getting prev and auth events This is in preparation for allowing the event format to change between room versions.
| * | Clean up event accesses and testsErik Johnston2018-11-021-3/+0
| | | | | | | | | | | | | | | This is in preparation to refactor FrozenEvent to support different event formats for different room versions
| * | Remove the unused /pull federation API (#4118)Amber Brown2018-10-312-14/+0
| |/
* / Prevent showing non-fed rooms in fed /publicRoomsAndrew Morgan2019-02-261-1/+2
|/
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-10-251-1/+1
|\ | | | | | | erikj/alias_disallow_list
| * Fix a number of flake8 errorsRichard van der Hoff2018-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Broadly three things here: * disable W504 which seems a bit whacko * remove a bunch of `as e` expressions from exception handlers that don't use them * use `r""` for strings which include backslashes Also, we don't use pep8 any more, so we can get rid of the duplicate config there.
* | Add config option to control alias creationErik Johnston2018-10-191-14/+2
|/
* Fix incorrect truncation in get_missing_eventsRichard van der Hoff2018-10-162-6/+4
| | | | | | | | | It's quite important that get_missing_events returns the *latest* events in the room; however we were pulling event ids out of the database until we got *at least* 10, and then taking the *earliest* of the results. We also shouldn't really be relying on depth, and should be checking the room_id.
* Various cleanups in the federation client code (#4031)Richard van der Hoff2018-10-162-23/+23
| | | | | | | | | | | | | | - Improve logging: log things in the right order, include destination and txids in all log lines, don't log successful responses twice - Fix the docstring on TransportLayerClient.send_transaction - Don't use treq.request, which is overcomplicated for our purposes: just use a twisted.web.client.Agent. - simplify the logic for setting up the bodyProducer - fix bytes/str confusions
* Merge pull request #3964 from matrix-org/rav/remove_localhost_checksRichard van der Hoff2018-09-281-30/+6
|\ | | | | remove spurious federation checks on localhost
| * Fix complete fail to do the right thingRichard van der Hoff2018-09-281-1/+2
| |
| * remove spurious federation checks on localhostRichard van der Hoff2018-09-261-31/+6
| | | | | | | | | | | | | | | | | | | | | | There's really no point in checking for destinations called "localhost" because there is nothing stopping people creating other DNS entries which point to 127.0.0.1. The right fix for this is https://github.com/matrix-org/synapse/issues/3953. Blocking localhost, on the other hand, means that you get a surprise when trying to connect a test server on localhost to an existing server (with a 'normal' server_name).
* | more commentsRichard van der Hoff2018-09-271-2/+0
| |
* | Include eventid in log lines when processing incoming federation ↵Richard van der Hoff2018-09-271-15/+17
| | | | | | | | | | | | | | | | | | | | | | transactions (#3959) when processing incoming transactions, it can be hard to see what's going on, because we process a bunch of stuff in parallel, and because we may end up recursively working our way through a chain of three or four events. This commit creates a way to use logcontexts to add the relevant event ids to the log lines.
* | fix docstring for FederationClient.get_state_for_roomRichard van der Hoff2018-09-261-4/+4
|/ | | | trivial fixes for docstring
* Merge pull request #3924 from matrix-org/rav/clean_up_on_receive_pduAmber Brown2018-09-261-1/+1
|\ | | | | Comments and interface cleanup for on_receive_pdu
| * Comments and interface cleanup for on_receive_pduRichard van der Hoff2018-09-201-1/+1
| | | | | | | | | | | | | | | | Add some informative comments about what's going on here. Also, `sent_to_us_directly` and `get_missing` were doing the same thing (apart from in `_handle_queued_pdus`, which looks like a bug), so let's get rid of `get_missing` and use `sent_to_us_directly` consistently.
* | Fix some instances of ExpiringCache not expiring cache itemsErik Johnston2018-09-211-16/+12
|/ | | | | | | | ExpiringCache required that `start()` be called before it would actually start expiring entries. A number of places didn't do that. This PR removes `start` from ExpiringCache, and automatically starts backround reaping process on creation instead.
* Fix handling of redacted events from federationErik Johnston2018-09-131-1/+1
| | | | | | | | | | If we receive an event that doesn't pass their content hash check (e.g. due to already being redacted) then we hit a bug which causes an exception to be raised, which then promplty stops the event (and request) from being processed. This effects all sorts of federation APIs, including joining rooms with a redacted state event.
* Port federation/ to py3 (#3847)Amber Brown2018-09-123-19/+18
|
* Merge pull request #3826 from matrix-org/rav/logging_for_keyringAmber Brown2018-09-121-7/+27
|\ | | | | add some logging for the keyring queue
| * clearer logging when things fail, tooRichard van der Hoff2018-09-061-7/+27
| |
* | Limit the number of PDUs/EDUs per fedreation transactionErik Johnston2018-09-061-0/+12
|/
* Merge branch 'master' into developRichard van der Hoff2018-09-064-31/+125
|\
| * Fix origin handling for pushed transactionsRichard van der Hoff2018-09-053-15/+15
| | | | | | | | | | Use the actual origin for push transactions, rather than whatever the remote server claimed.
| * Check that signatures on events are validRichard van der Hoff2018-09-051-16/+110
| | | | | | | | | | | | We should check that both the sender's server, and the server which created the event_id (which may be different from whatever the remote server has told us the origin is), have signed the event.
* | Port http/ to Python 3 (#3771)Amber Brown2018-09-061-5/+5
| |
* | fix #3445Krombel2018-08-291-2/+2
| | | | | | | | | | itervalues(d) calls d.itervalues() [PY2] and d.values() [PY3] but SortedDict only implements d.values()
* | Merge pull request #3735 from matrix-org/travis/federation-spellingRichard van der Hoff2018-08-221-1/+1
|\ \ | | | | | | limt -> limit
| * | limt -> limitTravis Ralston2018-07-311-1/+1
| | |
* | | Log more detail when we fail to authenticate requestErik Johnston2018-08-211-3/+3
| | |
* | | Don't log exceptions when failing to fetch server keysErik Johnston2018-08-211-2/+2
| |/ |/| | | | | | | Not being able to resolve or connect to remote servers is an expected error, so we shouldn't log at ERROR with stacktraces.
* | Integrate presence from hotfixes (#3694)Amber Brown2018-08-181-0/+4
| |
* | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-151-4/+4
|\ \ | | | | | | | | | erikj/split_federation
| * | Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678)Amber Brown2018-08-101-4/+4
| | |
* | | Fixup doc commentsErik Johnston2018-08-091-0/+11
| | |
* | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-095-13/+132
|\| | | | | | | | | | | erikj/split_federation
| * | Merge pull request #3664 from matrix-org/rav/federation_metricsRichard van der Hoff2018-08-081-1/+9
| |\ \ | | | | | | | | more metrics for the federation and appservice senders
| | * | more metrics for the federation and appservice sendersRichard van der Hoff2018-08-071-1/+9
| | | |
| * | | Check m.room.create for sane room_versionsRichard van der Hoff2018-08-061-3/+23
| | | |
| * | | include known room versions in outgoing make_joinsRichard van der Hoff2018-08-062-4/+9
| | | |
| * | | sanity check response from make_joinRichard van der Hoff2018-08-031-1/+3
| | | |
| * | | Enforce compatibility when processing make_join requestsRichard van der Hoff2018-08-032-4/+41
| | | | | | | | | | | | | | | | | | | | | | | | Reject make_join requests from servers which do not support the room version. Also include the room version in the response.
| * | | Docstrings for BaseFederationServletRichard van der Hoff2018-08-031-0/+47
| |/ / | | | | | | | | | ... to save me reverse-engineering this stuff again.
* / / Add EDU/query handling over replicationErik Johnston2018-08-061-0/+43
|/ /
* | Merge pull request #3639 from matrix-org/rav/refactor_error_handlingRichard van der Hoff2018-08-021-12/+17
|\ \ | | | | | | Clean up handling of errors from outbound requests
| * | Refactor code for turning HttpResponseException into SynapseErrorRichard van der Hoff2018-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This commit replaces SynapseError.from_http_response_exception with HttpResponseException.to_synapse_error. The new method actually returns a ProxiedRequestError, which allows us to pass through additional metadata from the API call.
| * | Be more careful which errors we send back over the C-S APIRichard van der Hoff2018-08-011-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We really shouldn't be sending all CodeMessageExceptions back over the C-S API; it will include things like 401s which we shouldn't proxy. That means that we need to explicitly turn a few HttpResponseExceptions into SynapseErrors in the federation layer. The effect of the latter is that the matrix errcode will get passed through correctly to calling clients, which might help with some of the random M_UNKNOWN errors when trying to join rooms.
* | | Merge pull request #3638 from ↵Richard van der Hoff2018-08-021-129/+148
|\| | | | | | | | | | | | | | matrix-org/rav/refactor_federation_client_exception_handling Factor out exception handling in federation_client
| * | Factor out exception handling in federation_clientRichard van der Hoff2018-08-011-129/+148
| | | | | | | | | | | | | | | Factor out the error handling from make_membership_event, send_join, and send_leave, so that it can be shared.
* | | Merge branch 'master' into developRichard van der Hoff2018-08-021-0/+1
|\ \ \ | |/ / |/| |
| * | Validation for events/rooms in fed requestsRichard van der Hoff2018-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | When we get a federation request which refers to an event id, make sure that said event is in the room the caller claims it is in. (patch supplied by @turt2live)
* | | Python 3: Convert some unicode/bytes uses (#3569)Amber Brown2018-08-021-1/+1
| |/ |/|
* | Remove pdu_failures from transactionsTravis Ralston2018-07-305-96/+7
| | | | | | The field is never read from, and all the opportunities given to populate it are not utilized. It should be very safe to remove this.
* | Update the send_leave path to be an event_idTravis Ralston2018-07-261-2/+2
| | | | | | It's still not used, however the parameter is an event ID not a transaction ID.
* | Improve logging for exceptions handling PDUsRichard van der Hoff2018-07-231-3/+8
| | | | | | | | when we get an exception handling a federation PDU, log the whole stacktrace.
* | Run things as background processesRichard van der Hoff2018-07-181-9/+6
| | | | | | | | | | | | | | | | This fixes #3518, and ensures that we get useful logs and metrics for lots of things that happen in the background. (There are certainly more things that happen in the background; these are just the common ones I've found running a single-process synapse locally).
* | Resource tracking for background processesRichard van der Hoff2018-07-181-5/+7
|/ | | | | | | | | | | | | | | | This introduces a mechanism for tracking resource usage by background processes, along with an example of how it will be used. This will help address #3518, but more importantly will give us better insights into things which are happening but not being shown up by the request metrics. We *could* do this with Measure blocks, but: - I think having them pulled out as a completely separate metric class will make it easier to distinguish top-level processes from those which are nested. - I want to be able to report on in-flight background processes, and I don't think we want to do this for *all* Measure blocks.
* rename assert_params_in_request to assert_params_in_dictKrombel2018-07-131-2/+2
| | | | | | the method "assert_params_in_request" does handle dicts and not requests. A request body has to be parsed to json before this method can be used
* run isortAmber Brown2018-07-099-64/+57
|