mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Merge branch 'main' into mailbox
This commit is contained in:
commit
3b76c776f6
14
CHANGES.md
14
CHANGES.md
|
|
@ -1,5 +1,19 @@
|
|||
# Changelog
|
||||
|
||||
## Dendrite 0.11.0 (2023-01-20)
|
||||
|
||||
The last three missing federation API Sytests have been fixed - bringing us to 100% server-server Synapse parity, with client-server parity at 93% 🎉
|
||||
|
||||
### Features
|
||||
|
||||
* Added `/_dendrite/admin/purgeRoom/{roomID}` to clean up the database
|
||||
* The default room version was updated to 10 (contributed by [FSG-Cat](https://github.com/FSG-Cat))
|
||||
|
||||
### Fixes
|
||||
|
||||
* An oversight in the `create-config` binary, which now correctly sets the media path if specified (contributed by [BieHDC](https://github.com/BieHDC))
|
||||
* The Helm chart now uses the `$.Chart.AppVersion` as the default image version to pull, with the possibility to override it (contributed by [genofire](https://github.com/genofire))
|
||||
|
||||
## Dendrite 0.10.9 (2023-01-17)
|
||||
|
||||
### Features
|
||||
|
|
|
|||
|
|
@ -936,4 +936,12 @@ fst Room state after a rejected message event is the same as before
|
|||
fst Room state after a rejected state event is the same as before
|
||||
fpb Federation publicRoom Name/topic keys are correct
|
||||
fed New federated private chats get full presence information (SYN-115) (10 subtests)
|
||||
dvk Rejects invalid device keys
|
||||
dvk Rejects invalid device keys
|
||||
rmv User can create and send/receive messages in a room with version 10
|
||||
rmv local user can join room with version 10
|
||||
rmv User can invite local user to room with version 10
|
||||
rmv remote user can join room with version 10
|
||||
rmv User can invite remote user to room with version 10
|
||||
rmv Remote user can backfill in a room with version 10
|
||||
rmv Can reject invites over federation for rooms with version 10
|
||||
rmv Can receive redactions from regular users over federation in room version 10
|
||||
|
|
@ -54,6 +54,9 @@ func main() {
|
|||
} else {
|
||||
cfg.Global.DatabaseOptions.ConnectionString = uri
|
||||
}
|
||||
cfg.MediaAPI.BasePath = config.Path(filepath.Join(*dirPath, "media"))
|
||||
cfg.Global.JetStream.StoragePath = config.Path(*dirPath)
|
||||
cfg.SyncAPI.Fulltext.IndexPath = config.Path(filepath.Join(*dirPath, "searchindex"))
|
||||
cfg.Logging = []config.LogrusHook{
|
||||
{
|
||||
Type: "file",
|
||||
|
|
|
|||
|
|
@ -85,10 +85,7 @@ func AddPublicRoutes(
|
|||
}
|
||||
|
||||
routing.Setup(
|
||||
base.PublicFederationAPIMux,
|
||||
base.PublicKeyAPIMux,
|
||||
base.PublicWellKnownAPIMux,
|
||||
cfg,
|
||||
base,
|
||||
rsAPI, f, keyRing,
|
||||
federation, userAPI, keyAPI, mscCfg,
|
||||
servers, producer,
|
||||
|
|
|
|||
|
|
@ -273,12 +273,12 @@ func TestRoomsV3URLEscapeDoNot404(t *testing.T) {
|
|||
cfg.Global.ServerName = gomatrixserverlib.ServerName("localhost")
|
||||
cfg.Global.PrivateKey = privKey
|
||||
cfg.Global.JetStream.InMemory = true
|
||||
base := base.NewBaseDendrite(cfg, "Monolith")
|
||||
b := base.NewBaseDendrite(cfg, "Monolith", base.DisableMetrics)
|
||||
keyRing := &test.NopJSONVerifier{}
|
||||
// TODO: This is pretty fragile, as if anything calls anything on these nils this test will break.
|
||||
// Unfortunately, it makes little sense to instantiate these dependencies when we just want to test routing.
|
||||
federationapi.AddPublicRoutes(base, nil, nil, keyRing, nil, &internal.FederationInternalAPI{}, nil, nil)
|
||||
baseURL, cancel := test.ListenAndServe(t, base.PublicFederationAPIMux, true)
|
||||
federationapi.AddPublicRoutes(b, nil, nil, keyRing, nil, &internal.FederationInternalAPI{}, nil, nil)
|
||||
baseURL, cancel := test.ListenAndServe(t, b.PublicFederationAPIMux, true)
|
||||
defer cancel()
|
||||
serverName := gomatrixserverlib.ServerName(strings.TrimPrefix(baseURL, "https://"))
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,11 @@ import (
|
|||
fedAPI "github.com/matrix-org/dendrite/federationapi"
|
||||
fedInternal "github.com/matrix-org/dendrite/federationapi/internal"
|
||||
"github.com/matrix-org/dendrite/federationapi/routing"
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/test"
|
||||
"github.com/matrix-org/dendrite/test/testrig"
|
||||
userAPI "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/crypto/ed25519"
|
||||
)
|
||||
|
|
@ -51,37 +48,27 @@ func TestHandleQueryProfile(t *testing.T) {
|
|||
base, close := testrig.CreateBaseDendrite(t, test.DBTypeSQLite)
|
||||
defer close()
|
||||
|
||||
defer func() {
|
||||
prometheus.Unregister(internal.PDUCountTotal)
|
||||
prometheus.Unregister(internal.EDUCountTotal)
|
||||
}()
|
||||
|
||||
fedMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicFederationPathPrefix).Subrouter().UseEncodedPath()
|
||||
keyMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicKeyPathPrefix).Subrouter().UseEncodedPath()
|
||||
cfg := config.FederationAPI{
|
||||
Matrix: &config.Global{
|
||||
SigningIdentity: gomatrixserverlib.SigningIdentity{
|
||||
ServerName: "remote",
|
||||
},
|
||||
},
|
||||
}
|
||||
base.PublicFederationAPIMux = fedMux
|
||||
base.Cfg.FederationAPI.Matrix.SigningIdentity.ServerName = testOrigin
|
||||
base.Cfg.FederationAPI.Matrix.Metrics.Enabled = false
|
||||
fedClient := fakeFedClient{}
|
||||
fedapi := fedAPI.NewInternalAPI(base, &fedClient, nil, nil, nil, true)
|
||||
serverKeyAPI := &signing.YggdrasilKeys{}
|
||||
keyRing := serverKeyAPI.KeyRing()
|
||||
fedapi := fedAPI.NewInternalAPI(base, &fedClient, nil, nil, keyRing, true)
|
||||
userapi := fakeUserAPI{}
|
||||
r, ok := fedapi.(*fedInternal.FederationInternalAPI)
|
||||
if !ok {
|
||||
panic("This is a programming error.")
|
||||
}
|
||||
routing.Setup(fedMux, keyMux, nil, &cfg, nil, r, keyRing, &fedClient, &userapi, nil, &base.Cfg.MSCs, nil, nil)
|
||||
routing.Setup(base, nil, r, keyRing, &fedClient, &userapi, nil, &base.Cfg.MSCs, nil, nil)
|
||||
|
||||
handler := fedMux.Get(routing.QueryProfileRouteName).GetHandler().ServeHTTP
|
||||
_, sk, _ := ed25519.GenerateKey(nil)
|
||||
keyID := signing.KeyID
|
||||
pk := sk.Public().(ed25519.PublicKey)
|
||||
serverName := gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
||||
req := gomatrixserverlib.NewFederationRequest("GET", serverName, "remote", "/query/directory?user_id="+url.QueryEscape("@user:remote"))
|
||||
req := gomatrixserverlib.NewFederationRequest("GET", serverName, testOrigin, "/query/profile?user_id="+url.QueryEscape("@user:"+string(testOrigin)))
|
||||
type queryContent struct{}
|
||||
content := queryContent{}
|
||||
err := req.SetContent(content)
|
||||
|
|
|
|||
|
|
@ -28,13 +28,10 @@ import (
|
|||
fedclient "github.com/matrix-org/dendrite/federationapi/api"
|
||||
fedInternal "github.com/matrix-org/dendrite/federationapi/internal"
|
||||
"github.com/matrix-org/dendrite/federationapi/routing"
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/test"
|
||||
"github.com/matrix-org/dendrite/test/testrig"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/crypto/ed25519"
|
||||
)
|
||||
|
|
@ -51,36 +48,27 @@ func TestHandleQueryDirectory(t *testing.T) {
|
|||
base, close := testrig.CreateBaseDendrite(t, test.DBTypeSQLite)
|
||||
defer close()
|
||||
|
||||
defer func() {
|
||||
prometheus.Unregister(internal.PDUCountTotal)
|
||||
prometheus.Unregister(internal.EDUCountTotal)
|
||||
}()
|
||||
|
||||
fedMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicFederationPathPrefix).Subrouter().UseEncodedPath()
|
||||
keyMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicKeyPathPrefix).Subrouter().UseEncodedPath()
|
||||
cfg := config.FederationAPI{
|
||||
Matrix: &config.Global{
|
||||
SigningIdentity: gomatrixserverlib.SigningIdentity{
|
||||
ServerName: "remote",
|
||||
},
|
||||
},
|
||||
}
|
||||
base.PublicFederationAPIMux = fedMux
|
||||
base.Cfg.FederationAPI.Matrix.SigningIdentity.ServerName = testOrigin
|
||||
base.Cfg.FederationAPI.Matrix.Metrics.Enabled = false
|
||||
fedClient := fakeFedClient{}
|
||||
fedapi := fedAPI.NewInternalAPI(base, &fedClient, nil, nil, nil, true)
|
||||
serverKeyAPI := &signing.YggdrasilKeys{}
|
||||
keyRing := serverKeyAPI.KeyRing()
|
||||
fedapi := fedAPI.NewInternalAPI(base, &fedClient, nil, nil, keyRing, true)
|
||||
userapi := fakeUserAPI{}
|
||||
r, ok := fedapi.(*fedInternal.FederationInternalAPI)
|
||||
if !ok {
|
||||
panic("This is a programming error.")
|
||||
}
|
||||
routing.Setup(fedMux, keyMux, nil, &cfg, nil, r, keyRing, &fedClient, nil, nil, &base.Cfg.MSCs, nil, nil)
|
||||
routing.Setup(base, nil, r, keyRing, &fedClient, &userapi, nil, &base.Cfg.MSCs, nil, nil)
|
||||
|
||||
handler := fedMux.Get(routing.QueryDirectoryRouteName).GetHandler().ServeHTTP
|
||||
_, sk, _ := ed25519.GenerateKey(nil)
|
||||
keyID := signing.KeyID
|
||||
pk := sk.Public().(ed25519.PublicKey)
|
||||
serverName := gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
||||
req := gomatrixserverlib.NewFederationRequest("GET", serverName, "remote", "/query/directory?room_alias="+url.QueryEscape("#room:server"))
|
||||
req := gomatrixserverlib.NewFederationRequest("GET", serverName, testOrigin, "/query/directory?room_alias="+url.QueryEscape("#room:server"))
|
||||
type queryContent struct{}
|
||||
content := queryContent{}
|
||||
err := req.SetContent(content)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import (
|
|||
keyserverAPI "github.com/matrix-org/dendrite/keyserver/api"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/setup/base"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
|
@ -55,8 +56,7 @@ const (
|
|||
// applied:
|
||||
// nolint: gocyclo
|
||||
func Setup(
|
||||
fedMux, keyMux, wkMux *mux.Router,
|
||||
cfg *config.FederationAPI,
|
||||
base *base.BaseDendrite,
|
||||
rsAPI roomserverAPI.FederationRoomserverAPI,
|
||||
fsAPI *fedInternal.FederationInternalAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
|
|
@ -67,7 +67,12 @@ func Setup(
|
|||
servers federationAPI.ServersInRoomProvider,
|
||||
producer *producers.SyncAPIProducer,
|
||||
) {
|
||||
if cfg.Matrix.Metrics.Enabled {
|
||||
fedMux := base.PublicFederationAPIMux
|
||||
keyMux := base.PublicKeyAPIMux
|
||||
wkMux := base.PublicWellKnownAPIMux
|
||||
cfg := &base.Cfg.FederationAPI
|
||||
|
||||
if base.EnableMetrics {
|
||||
prometheus.MustRegister(
|
||||
internal.PDUCountTotal, internal.EDUCountTotal,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/test"
|
||||
"github.com/matrix-org/dendrite/test/testrig"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
|
@ -551,17 +550,9 @@ func TestHandleSend(t *testing.T) {
|
|||
defer close()
|
||||
|
||||
fedMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicFederationPathPrefix).Subrouter().UseEncodedPath()
|
||||
keyMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicKeyPathPrefix).Subrouter().UseEncodedPath()
|
||||
cfg := config.FederationAPI{
|
||||
Matrix: &config.Global{
|
||||
SigningIdentity: gomatrixserverlib.SigningIdentity{
|
||||
ServerName: "remote",
|
||||
},
|
||||
Metrics: config.Metrics{
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
base.PublicFederationAPIMux = fedMux
|
||||
base.Cfg.FederationAPI.Matrix.SigningIdentity.ServerName = testOrigin
|
||||
base.Cfg.FederationAPI.Matrix.Metrics.Enabled = false
|
||||
fedapi := fedAPI.NewInternalAPI(base, nil, nil, nil, nil, true)
|
||||
serverKeyAPI := &signing.YggdrasilKeys{}
|
||||
keyRing := serverKeyAPI.KeyRing()
|
||||
|
|
@ -569,14 +560,14 @@ func TestHandleSend(t *testing.T) {
|
|||
if !ok {
|
||||
panic("This is a programming error.")
|
||||
}
|
||||
routing.Setup(fedMux, keyMux, nil, &cfg, nil, r, keyRing, nil, nil, nil, &base.Cfg.MSCs, nil, nil)
|
||||
routing.Setup(base, nil, r, keyRing, nil, nil, nil, &base.Cfg.MSCs, nil, nil)
|
||||
|
||||
handler := fedMux.Get(routing.SendRouteName).GetHandler().ServeHTTP
|
||||
_, sk, _ := ed25519.GenerateKey(nil)
|
||||
keyID := signing.KeyID
|
||||
pk := sk.Public().(ed25519.PublicKey)
|
||||
serverName := gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
||||
req := gomatrixserverlib.NewFederationRequest("PUT", serverName, "remote", "/send/1234")
|
||||
req := gomatrixserverlib.NewFederationRequest("PUT", serverName, testOrigin, "/send/1234")
|
||||
content := sendContent{}
|
||||
err := req.SetContent(content)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
apiVersion: v2
|
||||
name: dendrite
|
||||
version: "0.10.9"
|
||||
appVersion: "0.10.9"
|
||||
version: "0.11.0"
|
||||
appVersion: "0.11.0"
|
||||
description: Dendrite Matrix Homeserver
|
||||
type: application
|
||||
keywords:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# dendrite
|
||||
|
||||
  
|
||||
  
|
||||
Dendrite Matrix Homeserver
|
||||
|
||||
Status: **NOT PRODUCTION READY**
|
||||
|
|
@ -41,8 +41,9 @@ Create a folder `appservices` and place your configurations in there. The confi
|
|||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| image.name | string | `"ghcr.io/matrix-org/dendrite-monolith:v0.10.8"` | Docker repository/image to use |
|
||||
| image.repository | string | `"ghcr.io/matrix-org/dendrite-monolith"` | Docker repository/image to use |
|
||||
| image.pullPolicy | string | `"IfNotPresent"` | Kubernetes pullPolicy |
|
||||
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
|
||||
| signing_key.create | bool | `true` | Create a new signing key, if not exists |
|
||||
| signing_key.existingSecret | string | `""` | Use an existing secret |
|
||||
| resources | object | sets some sane default values | Default resource requests/limits. |
|
||||
|
|
@ -144,4 +145,4 @@ Create a folder `appservices` and place your configurations in there. The confi
|
|||
| ingress.annotations | object | `{}` | Extra, custom annotations |
|
||||
| ingress.tls | list | `[]` | |
|
||||
| service.type | string | `"ClusterIP"` | |
|
||||
| service.port | int | `80` | |
|
||||
| service.port | int | `8008` | |
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ image:
|
|||
repository: "ghcr.io/matrix-org/dendrite-monolith"
|
||||
# -- Kubernetes pullPolicy
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
# -- Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ var build string
|
|||
|
||||
const (
|
||||
VersionMajor = 0
|
||||
VersionMinor = 10
|
||||
VersionPatch = 9
|
||||
VersionMinor = 11
|
||||
VersionPatch = 0
|
||||
VersionTag = "" // example: "rc1"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/roomserver/internal/helpers"
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
|
@ -40,7 +41,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/internal/hooks"
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/roomserver/internal/helpers"
|
||||
"github.com/matrix-org/dendrite/roomserver/state"
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
)
|
||||
|
|
@ -166,6 +166,7 @@ func (r *Inputer) processRoomEvent(
|
|||
missingPrev = !input.HasState && len(missingPrevIDs) > 0
|
||||
}
|
||||
|
||||
// If we have missing events (auth or prev), we build a list of servers to ask
|
||||
if missingAuth || missingPrev {
|
||||
serverReq := &fedapi.QueryJoinedHostServerNamesInRoomRequest{
|
||||
RoomID: event.RoomID(),
|
||||
|
|
@ -200,59 +201,8 @@ func (r *Inputer) processRoomEvent(
|
|||
}
|
||||
}
|
||||
|
||||
// First of all, check that the auth events of the event are known.
|
||||
// If they aren't then we will ask the federation API for them.
|
||||
isRejected := false
|
||||
authEvents := gomatrixserverlib.NewAuthEvents(nil)
|
||||
knownEvents := map[string]*types.Event{}
|
||||
if err = r.fetchAuthEvents(ctx, logger, roomInfo, virtualHost, headered, &authEvents, knownEvents, serverRes.ServerNames); err != nil {
|
||||
return fmt.Errorf("r.fetchAuthEvents: %w", err)
|
||||
}
|
||||
|
||||
// Check if the event is allowed by its auth events. If it isn't then
|
||||
// we consider the event to be "rejected" — it will still be persisted.
|
||||
var rejectionErr error
|
||||
if rejectionErr = gomatrixserverlib.Allowed(event, &authEvents); rejectionErr != nil {
|
||||
isRejected = true
|
||||
logger.WithError(rejectionErr).Warnf("Event %s not allowed by auth events", event.EventID())
|
||||
}
|
||||
|
||||
// Accumulate the auth event NIDs.
|
||||
authEventIDs := event.AuthEventIDs()
|
||||
authEventNIDs := make([]types.EventNID, 0, len(authEventIDs))
|
||||
for _, authEventID := range authEventIDs {
|
||||
if _, ok := knownEvents[authEventID]; !ok {
|
||||
// Unknown auth events only really matter if the event actually failed
|
||||
// auth. If it passed auth then we can assume that everything that was
|
||||
// known was sufficient, even if extraneous auth events were specified
|
||||
// but weren't found.
|
||||
if isRejected {
|
||||
if event.StateKey() != nil {
|
||||
return fmt.Errorf(
|
||||
"missing auth event %s for state event %s (type %q, state key %q)",
|
||||
authEventID, event.EventID(), event.Type(), *event.StateKey(),
|
||||
)
|
||||
} else {
|
||||
return fmt.Errorf(
|
||||
"missing auth event %s for timeline event %s (type %q)",
|
||||
authEventID, event.EventID(), event.Type(),
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
authEventNIDs = append(authEventNIDs, knownEvents[authEventID].EventNID)
|
||||
}
|
||||
}
|
||||
|
||||
var softfail bool
|
||||
if input.Kind == api.KindNew {
|
||||
// Check that the event passes authentication checks based on the
|
||||
// current room state.
|
||||
softfail, err = helpers.CheckForSoftFail(ctx, r.DB, headered, input.StateEventIDs)
|
||||
if err != nil {
|
||||
logger.WithError(err).Warn("Error authing soft-failed event")
|
||||
}
|
||||
}
|
||||
|
||||
// At this point we are checking whether we know all of the prev events, and
|
||||
// if we know the state before the prev events. This is necessary before we
|
||||
|
|
@ -314,6 +264,59 @@ func (r *Inputer) processRoomEvent(
|
|||
}
|
||||
}
|
||||
|
||||
// Check that the auth events of the event are known.
|
||||
// If they aren't then we will ask the federation API for them.
|
||||
authEvents := gomatrixserverlib.NewAuthEvents(nil)
|
||||
knownEvents := map[string]*types.Event{}
|
||||
if err = r.fetchAuthEvents(ctx, logger, roomInfo, virtualHost, headered, &authEvents, knownEvents, serverRes.ServerNames); err != nil {
|
||||
return fmt.Errorf("r.fetchAuthEvents: %w", err)
|
||||
}
|
||||
|
||||
// Check if the event is allowed by its auth events. If it isn't then
|
||||
// we consider the event to be "rejected" — it will still be persisted.
|
||||
if err = gomatrixserverlib.Allowed(event, &authEvents); err != nil {
|
||||
isRejected = true
|
||||
rejectionErr = err
|
||||
logger.WithError(rejectionErr).Warnf("Event %s not allowed by auth events", event.EventID())
|
||||
}
|
||||
|
||||
// Accumulate the auth event NIDs.
|
||||
authEventIDs := event.AuthEventIDs()
|
||||
authEventNIDs := make([]types.EventNID, 0, len(authEventIDs))
|
||||
for _, authEventID := range authEventIDs {
|
||||
if _, ok := knownEvents[authEventID]; !ok {
|
||||
// Unknown auth events only really matter if the event actually failed
|
||||
// auth. If it passed auth then we can assume that everything that was
|
||||
// known was sufficient, even if extraneous auth events were specified
|
||||
// but weren't found.
|
||||
if isRejected {
|
||||
if event.StateKey() != nil {
|
||||
return fmt.Errorf(
|
||||
"missing auth event %s for state event %s (type %q, state key %q)",
|
||||
authEventID, event.EventID(), event.Type(), *event.StateKey(),
|
||||
)
|
||||
} else {
|
||||
return fmt.Errorf(
|
||||
"missing auth event %s for timeline event %s (type %q)",
|
||||
authEventID, event.EventID(), event.Type(),
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
authEventNIDs = append(authEventNIDs, knownEvents[authEventID].EventNID)
|
||||
}
|
||||
}
|
||||
|
||||
var softfail bool
|
||||
if input.Kind == api.KindNew {
|
||||
// Check that the event passes authentication checks based on the
|
||||
// current room state.
|
||||
softfail, err = helpers.CheckForSoftFail(ctx, r.DB, headered, input.StateEventIDs)
|
||||
if err != nil {
|
||||
logger.WithError(err).Warn("Error authing soft-failed event")
|
||||
}
|
||||
}
|
||||
|
||||
// Get the state before the event so that we can work out if the event was
|
||||
// allowed at the time, and also to get the history visibility. We won't
|
||||
// bother doing this if the event was already rejected as it just ends up
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
// DefaultRoomVersion contains the room version that will, by
|
||||
// default, be used to create new rooms on this server.
|
||||
func DefaultRoomVersion() gomatrixserverlib.RoomVersion {
|
||||
return gomatrixserverlib.RoomVersionV9
|
||||
return gomatrixserverlib.RoomVersionV10
|
||||
}
|
||||
|
||||
// RoomVersions returns a map of all known room versions to this
|
||||
|
|
|
|||
|
|
@ -264,6 +264,8 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
|||
|
||||
// Close implements io.Closer
|
||||
func (b *BaseDendrite) Close() error {
|
||||
b.ProcessContext.ShutdownDendrite()
|
||||
b.ProcessContext.WaitForShutdown()
|
||||
return b.tracerCloser.Close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,54 +1,18 @@
|
|||
# Relies on a rejected PL event which will never be accepted into the DAG
|
||||
|
||||
# Caused by <https://github.com/matrix-org/sytest/pull/911>
|
||||
|
||||
Outbound federation requests missing prev_events and then asks for /state_ids and resolves the state
|
||||
|
||||
# We don't implement lazy membership loading yet
|
||||
|
||||
# Blacklisted due to https://github.com/matrix-org/matrix-spec/issues/942
|
||||
The only membership state included in a gapped incremental sync is for senders in the timeline
|
||||
|
||||
# Blacklisted out of flakiness after #1479
|
||||
|
||||
Invited user can reject local invite after originator leaves
|
||||
Invited user can reject invite for empty room
|
||||
If user leaves room, remote user changes device and rejoins we see update in /sync and /keys/changes
|
||||
|
||||
# Blacklisted due to flakiness
|
||||
|
||||
Forgotten room messages cannot be paginated
|
||||
|
||||
# Blacklisted due to flakiness after #1774
|
||||
|
||||
Local device key changes get to remote servers with correct prev_id
|
||||
|
||||
# we don't support groups
|
||||
|
||||
Remove group category
|
||||
Remove group role
|
||||
|
||||
# Flakey
|
||||
|
||||
AS-ghosted users can use rooms themselves
|
||||
AS-ghosted users can use rooms via AS
|
||||
Events in rooms with AS-hosted room aliases are sent to AS server
|
||||
Inviting an AS-hosted user asks the AS server
|
||||
Accesing an AS-hosted room alias asks the AS server
|
||||
|
||||
# More flakey
|
||||
|
||||
Guest users can join guest_access rooms
|
||||
|
||||
# This will fail in HTTP API mode, so blacklisted for now
|
||||
|
||||
If a device list update goes missing, the server resyncs on the next one
|
||||
|
||||
# Might be a bug in the test because leaves do appear :-(
|
||||
|
||||
Leaves are present in non-gapped incremental syncs
|
||||
|
||||
# Below test was passing for the wrong reason, failing correctly since #2858
|
||||
New federated private chats get full presence information (SYN-115)
|
||||
|
||||
# We don't have any state to calculate m.room.guest_access when accepting invites
|
||||
Guest users can accept invites to private rooms over federation
|
||||
|
|
@ -766,4 +766,16 @@ remote user has tags copied to the new room
|
|||
Local and remote users' homeservers remove a room from their public directory on upgrade
|
||||
Guest users denied access over federation if guest access prohibited
|
||||
Guest users are kicked from guest_access rooms on revocation of guest_access
|
||||
Guest users are kicked from guest_access rooms on revocation of guest_access over federation
|
||||
Guest users are kicked from guest_access rooms on revocation of guest_access over federation
|
||||
User can create and send/receive messages in a room with version 10
|
||||
local user can join room with version 10
|
||||
User can invite local user to room with version 10
|
||||
remote user can join room with version 10
|
||||
User can invite remote user to room with version 10
|
||||
Remote user can backfill in a room with version 10
|
||||
Can reject invites over federation for rooms with version 10
|
||||
Can receive redactions from regular users over federation in room version 10
|
||||
New federated private chats get full presence information (SYN-115)
|
||||
/state returns M_NOT_FOUND for an outlier
|
||||
/state_ids returns M_NOT_FOUND for an outlier
|
||||
Outbound federation requests missing prev_events and then asks for /state_ids and resolves the state
|
||||
|
|
@ -62,7 +62,12 @@ func CreateBaseDendrite(t *testing.T, dbType test.DBType) (*base.BaseDendrite, f
|
|||
MaxIdleConnections: 2,
|
||||
ConnMaxLifetimeSeconds: 60,
|
||||
}
|
||||
return base.NewBaseDendrite(&cfg, "Test", base.DisableMetrics), close
|
||||
base := base.NewBaseDendrite(&cfg, "Test", base.DisableMetrics)
|
||||
return base, func() {
|
||||
base.ShutdownDendrite()
|
||||
base.WaitForShutdown()
|
||||
close()
|
||||
}
|
||||
case test.DBTypeSQLite:
|
||||
cfg.Defaults(config.DefaultOpts{
|
||||
Generate: true,
|
||||
|
|
@ -91,7 +96,10 @@ func CreateBaseDendrite(t *testing.T, dbType test.DBType) (*base.BaseDendrite, f
|
|||
// use a distinct prefix else concurrent postgres/sqlite runs will clash since NATS will use
|
||||
// the file system event with InMemory=true :(
|
||||
cfg.Global.JetStream.TopicPrefix = fmt.Sprintf("Test_%d_", dbType)
|
||||
return base.NewBaseDendrite(&cfg, "Test", base.DisableMetrics), func() {
|
||||
base := base.NewBaseDendrite(&cfg, "Test", base.DisableMetrics)
|
||||
return base, func() {
|
||||
base.ShutdownDendrite()
|
||||
base.WaitForShutdown()
|
||||
// cleanup db files. This risks getting out of sync as we add more database strings :(
|
||||
dbFiles := []config.DataSource{
|
||||
cfg.FederationAPI.Database.ConnectionString,
|
||||
|
|
|
|||
Loading…
Reference in a new issue