aboutsummaryrefslogtreecommitdiff
path: root/federationapi
AgeCommit message (Collapse)Author
2020-12-04MSC2836 threading: part 2 (#1596)Kegsay
* Update GMSL * Add MSC2836EventRelationships to fedsender * Call MSC2836EventRelationships in reqCtx * auth remote servers * Extract room ID and servers from previous events; refactor a bit * initial cut of federated threading * Use the right client/fed struct in the response * Add QueryAuthChain for use with MSC2836 * Add auth chain to federated response * Fix pointers * under CI: more logging and enable mscs, nil fix * Handle direction: up * Actually send message events to the roomserver.. * Add children and children_hash to unsigned, with tests * Add logic for exploring threads and tracking children; missing storage functions * Implement storage functions for children * Add fetchUnknownEvent * Do federated hits for include_children if we have unexplored children * Use /ev_rel rather than /event as the former includes child metadata * Remove cross-room threading impl * Enable MSC2836 in the p2p demo * Namespace mscs db * Enable msc2836 for ygg Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-12-03Peeking updates (#1607)Neil Alexander
* Add unpeek * Don't allow peeks into encrypted rooms * Fix send tests * Update consumers
2020-12-02Top-level setup package (#1605)Neil Alexander
* Move config, setup, mscs into "setup" top-level folder * oops, forgot the EDU server * Add setup * goimports
2020-11-18Protect txnReq.newEvents with mutex (#1587)Neil Alexander
* Protect txnReq.newEvents and txnReq.haveEvents with mutex * Missing defer * Remove t.haveEventsMutex
2020-11-16Pass pointers to events — reloaded (#1583)Neil Alexander
* Pass events as pointers * Fix lint errors * Update gomatrixserverlib * Update gomatrixserverlib * Update to matrix-org/gomatrixserverlib#240
2020-11-09Implement read receipts (#1528)S7evinK
* fix conversion from int to string yields a string of one rune, not a string of digits * Add receipts table to syncapi * Use StreamingToken as the since value * Add required method to testEDUProducer * Make receipt json creation "easier" to read * Add receipts api to the eduserver * Add receipts endpoint * Add eduserver kafka consumer * Add missing kafka config * Add passing tests to whitelist Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Fix copy & paste error * Fix column count error * Make outbound federation receipts pass * Make "Inbound federation rejects receipts from wrong remote" pass * Don't use errors package * - Add TODO for batching requests - Rename variable * Return a better error message * - Use OutputReceiptEvent instead of InputReceiptEvent as result - Don't use the errors package for errors - Defer CloseAndLogIfError to close rows - Fix Copyright * Better creation/usage of JoinResponse * Query all joined rooms instead of just one * Update gomatrixserverlib * Add sqlite3 migration * Add postgres migration * Ensure required sequence exists before running migrations * Clarification on comment * - Fix a bug when creating client receipts - Use concrete types instead of interface{} * Remove dead code Use key for timestamp * Fix postgres query... * Remove single purpose struct * Use key/value directly * Only apply receipts on initial sync or if edu positions differ, otherwise we'll be sending the same receipts over and over again. * Actually update the id, so it is correctly send in syncs * Set receipt on request to /read_markers * Fix issue with receipts getting overwritten * Use fmt.Errorf instead of pkg/errors * Revert "Add postgres migration" This reverts commit 722fe5a04628882b787d096942459961db159b06. * Revert "Add sqlite3 migration" This reverts commit d113b03f6495a4b8f8bcf158a3d00b510b4240cc. * Fix selectRoomReceipts query * Make golangci-lint happy Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-11-05Implement forgetting about rooms (#1572)S7evinK
* Add basic storage methods * Add internal api handler * Add check for forgotten room * Add /rooms/{roomID}/forget endpoint * Add missing rsAPI method * Remove unused parameters * Add passing tests Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add missing file * Add postgres migration * Add sqlite migration * Use Forgetter to forget room * Remove empty line * Update HTTP status codes It looks like the spec calls for these to be 400, rather than 403: https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-forget Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-10-19KindOld (#1531)Neil Alexander
* Add KindOld * Don't process latest events/memberships for old events * Allow federationsender to ignore duplicate key entries when LatestEventIDs is duplicated by RS output events * Signal to downstream components if an event has become a forward extremity * Don't exclude from sync * Soft-fail checks on KindNew * Don't run the latest events updater at all for KindOld * Don't make federation sender change after all * Kind in federation sender join * Don't send isForwardExtremity * Fix syncapi * Update comments * Fix SendEventWithState * Update sytest-whitelist * Generate old output events * Sync API consumes old room events * Update comments
2020-10-15Don't re-run state resolution on a single trusted state snapshot (#1526)Neil Alexander
* Don't re-run state resolution on a single trusted state snapshot * Lint * Check if backward extremity is create event before checking missing state
2020-10-14Ignore typing events where sender doesn't match origin (#1523)Neil Alexander
* Ignore typing notifications where the sender doesn't match the origin * Update sytest-whitelist * Fix formatting directives
2020-10-14Improved state handling in /send (#1521)Neil Alexander
* Capture errors * Don't request only state key tuples needed for auth (we end up discarding room state this way) * QueryStateAfterEvent returns all state when no tuples supplied * Resolve state * Comments
2020-10-13Try to retrieve missing auth events from multiple servers (#1516)Neil Alexander
* Recursively fetch auth events if needed * Fix processEvent call * Ask more servers in lookupEvent * Don't panic! * Panic at the Disco * Find servers more aggressively * Add getServers * Fix number of servers to 5, don't bail making RespState if auth events missing * Fix panic * Ignore missing state events too * Report number of servers correctly * Don't reuse request context for /send_join * Update federation API tests * Don't recurse processEvents * Implement getEvents differently
2020-10-12Get missing event tweaks (#1514)Neil Alexander
* Adjust backfill to send backward extremity with state before other backfilled events, include prev_events with no state amongst missing events * Not finished refactor * Fix test * Remove isInboundTxn * Remove debug logging
2020-10-09Only return 500 on /send if a database error occurs (#1503)Neil Alexander
2020-10-06Use [] not null when there are no devices (#1480)Kegsay
2020-10-02Log origin in /sendNeil Alexander
2020-10-01Fix golangci-lint issues (#1464)S7evinK
* Fix S1039: unnecessary use of fmt.Sprintf * Fix S1036: unnecessary guard around map access Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
2020-09-30Fix panic on verifySigError in fetching missing eventsNeil Alexander
2020-09-29Remove TLS fingerprints, improve perspective unmarshal handling (#1452)Neil Alexander
* Add prefer_direct_fetch option * Update gomatrixserverlib * Update gomatrixserverlib * Update gomatrixserverlib * Don't deal in TLS fingerprints anymore
2020-09-29Ignore depth in federation API (#1451)Neil Alexander
2020-09-29Fix old verify keysNeil Alexander
2020-09-29Fetch missing auth events, implement QueryMissingAuthPrevEvents, try other ↵Neil Alexander
servers in room for /event and /get_missing_events (#1450) * Try to ask other servers in the room for missing events if the origin won't provide them * Logging * More logging * Implement QueryMissingAuthPrevEvents * Try to get missing auth events badly * Use processEvent * Logging * Update QueryMissingAuthPrevEvents * Try to find missing auth events * Patchy fix for test * Logging tweaks * Send auth events as outliers * Update check in QueryMissingAuthPrevEvents * Error responses * More return codes * Don't return error on reject/soft-fail since it was ultimately handled * More tweaks * More error tweaks
2020-09-28Use workers when fetching events from /state_ids, use /state only if ↵Neil Alexander
significant portion of events missing (#1447) * Don't fall back to /state on incoming /send * Event workers for /state_ids, use /state only if significant percentage of events are missing
2020-09-28Don't fall back to /state on incoming /send (#1446)Neil Alexander
2020-09-25Allow configuring old verify keys (#1443)Neil Alexander
* Allow configuring old verify keys * Update sample config * Update sample config * Fix config population * Key ID formatting validity of old_verify_keys * Update comment
2020-09-24Return the correct error codes for v6 invite JSON violations (#1440)Neil Alexander
* Return the correct error codes for v6 invite JSON violations * Update sytest-whitelist
2020-09-24Reject make_join for empty rooms (#1439)Neil Alexander
* Sanity-check room version on RS event input * Update gomatrixserverlib * Reject make_join when no room members are left * Revert some changes from wrong branch * Distinguish between room not existing and room being abandoned on this server * nolint
2020-09-22Initial notary support (#1436)Neil Alexander
* Initial work on notary support * Somewhat working (but not properly filtered) notary support, other tweaks * Update gomatrixserverlib
2020-09-16Implement rejected events (#1426)Kegsay
* WIP Event rejection * Still send back errors for rejected events Instead, discard them at the federationapi /send layer rather than re-implementing checks at the clientapi/PerformJoin layer. * Implement rejected events Critically, rejected events CAN cause state resolution to happen as it can merge forks in the DAG. This is fine, _provided_ we do not add the rejected event when performing state resolution, which is what this PR does. It also fixes the error handling when NotAllowed happens, as we were checking too early and needlessly handling NotAllowed in more than one place. * Update test to match reality * Modify InputRoomEvents to no longer return an error Errors do not serialise across HTTP boundaries in polylith mode, so instead set fields on the InputRoomEventsResponse. Add `Err()` function to make the API shape basically the same. * Remove redundant returns; linting * Update blacklist
2020-09-10Peeking via MSC2753 (#1370)Matthew Hodgson
Initial implementation of MSC2753, as tested by https://github.com/matrix-org/sytest/pull/944. Doesn't yet handle unpeeks, peeked EDUs, or history viz changing during a peek - these will follow. https://github.com/matrix-org/dendrite/pull/1370 has full details.
2020-09-08Backoff ignore invalid signatures (#1408)Neil Alexander
2020-09-07Remove current state server (#1405)Kegsay
* Remove current state server Closes #1365 #1272 #1357 * Remove current state server from scripts/docs
2020-09-07Remove QueryBulkStateContent from current state server (#1404)Kegsay
* Remove QueryBulkStateContent from current state server Expected fail due to db impl not existing * Implement query bulk state content * Fix up rejecting invites over federation * Fix bulk content marshalling
2020-09-07Use background context when processing event with missing state (#1403)Neil Alexander
* Use background context when processing event with missing state * Five minute timeout * Remove context from txnreq, thread through instead * Fix unit tests
2020-09-04Remove ServerACLs from the current state server (#1390)Kegsay
* Remove ServerACLs from the current state server Functionality moved to roomserver * Nothing to see here, move along
2020-09-03Move currentstateserver API to roomserver (#1387)Kegsay
* Move currentstateserver API to roomserver Stub out DB functions for now, nothing uses the roomserver version yet. * Allow it to startup * Implement some current-state-server storage interface functions * Add missing package
2020-09-03FIFO ordering of input events (#1386)Neil Alexander
* Initial FIFOing of roomserver inputs * Remove EventID response from api.InputRoomEventsResponse * Don't send back event ID unnecessarily * Fix ordering hopefully * Reduce copies, use buffered task channel to reduce contention on other rooms * Fix error handling
2020-09-02Add Queryer and Inputer and factor out more RSAPI stuff (#1382)Kegsay
* Add Queryer and use embedded structs * Add Inputer and factor out more RS API stuff This neatly splits up the RS API based on the functionality it provides, whilst providing a useful place for code sharing via the `helpers` package.
2020-09-02Version imprint (#1383)Neil Alexander
* Versions * Update build.sh
2020-08-25[readability] use event.StateKeyEquals where relevant and minor for-loop ↵oliverpool
refactoring (#1339) * use event.StateKeyEquals where relevant Signed-off-by: Olivier Charvin <git@olivier.pfad.fr> * use userID
2020-08-17Synchronous invites (#1273)Neil Alexander
* Refactor invites to be synchronous * Fix synchronous invites * Fix client API return type for send invite error * Linter * Restore PerformError on rsAPI.PerformInvite * Update sytest-whitelist * Don't override PerformError with normal errors * Fix error passing * Un-whitelist a couple of tests * Update sytest-whitelist * Try to handle multiple invite rejections better * nolint * Update gomatrixserverlib * Fix /v1/invite test * Remove replace from go.mod
2020-08-13API setup refactoring (#1266)Neil Alexander
* Start HTTP endpoint refactoring * Update SetupAndServeHTTP * Fix builds * Don't set up external listener if no address configured * TLS HTTP setup * Break apart client/federation/key/media muxes * Tweaks * Fix P2P demos * Fix media API routing * Review comments @Kegsay * Update sample config * Fix gobind build * Fix External -> Public in federation API test
2020-08-11Support for server ACLs (#1261)Neil Alexander
* First pass at server ACLs (not efficient) * Use transaction origin, update whitelist * Fix federation API test It's sufficient for us to return nothing in response to current state, so that the server ACL check returns no ACLs. * More efficient server ACLs - hopefully * Fix queries * Fix queries * Avoid panics by nil pointers * Bug fixes * Fix state event type * Fix mutex * Update logging * Ignore port when matching servername * Use read mutex * Fix bugs * Fix sync API test * Comments * Add tests, tweaks to behaviour * Fix test output
2020-08-10Configuration format v1 (#1230)Neil Alexander
* Initial pass at refactoring config (not finished) * Don't forget current state and EDU servers * More shifting around * Update server key API tests * Fix roomserver test * Fix more tests * Further tweaks * Fix current state server test (sort of) * Maybe fix appservices * Fix client API test * Include database connection string in database options * Fix sync API build * Update config test * Fix unit tests * Fix federation sender build * Fix gobind build * Set Listen address for all services in HTTP monolith mode * Validate config, reinstate appservice derived in directory, tweaks * Tweak federation API test * Set MaxOpenConnections/MaxIdleConnections to previous values * Update generate-config
2020-08-07Allow enforcing X.509 certificate validity (MSC1711) (#1249)Neil Alexander
* Configurable X.509 certificate validation * Fix dendritejs * Update go.mod/go.sum for matrix-org/gomatrixserverlib#214 * Update sample config
2020-08-07Tweak log levels of some federation logging (#1248)Neil Alexander
* Tweak log levels of some federation logging * Update go.mod/go.sum for matrix-org/util#22 and matrix-org/gomatrixserverlib#215
2020-08-05Process inbound device list updates from federation (#1240)Kegsay
* Add InputDeviceListUpdate * Unbreak unit tests * Process inbound device list updates from federation - Persist the keys in the keyserver and produce key changes - Does not currently fetch keys from the remote server if the prev IDs are missing * Linting
2020-08-04Fix response format for federation /devices requestsKegan Dougal
2020-08-04Send device list updates to servers (outbound only) (#1237)Kegsay
* Add QueryDeviceMessages to serve up device keys and stream IDs * Consume key change events in fedsender Don't yet send them to destinations as we haven't worked them out yet * Send device list updates to all required servers * Glue it all together
2020-07-22Handle inbound federation E2E key queries/claims (#1215)Kegsay
* Handle inbound /keys/claim and /keys/query requests * Add display names to device key responses * Linting