From 02565c37aa2a03b31b3bd7447c9a8ab90a6cd9e7 Mon Sep 17 00:00:00 2001 From: Kegsay Date: Tue, 23 Jun 2020 10:31:17 +0100 Subject: [PATCH] /send auth errors are silent (#1149) * /send auth errors are silent * Fix test --- federationapi/routing/send.go | 12 ++++++++++-- sytest-blacklist | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index cf71b8ba0..c80ab89f3 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -176,9 +176,17 @@ func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) { util.GetLogger(t.context).Warnf("Processing %s failed fatally: %s", e.EventID(), err) return nil, err } else { - util.GetLogger(t.context).WithError(err).WithField("event_id", e.EventID()).Warn("Failed to process incoming federation event, skipping") + // Auth errors mean the event is 'rejected' which have to be silent to appease sytest + _, rejected := err.(*gomatrixserverlib.NotAllowed) + errMsg := err.Error() + if rejected { + errMsg = "" + } + util.GetLogger(t.context).WithError(err).WithField("event_id", e.EventID()).WithField("rejected", rejected).Warn( + "Failed to process incoming federation event, skipping", + ) results[e.EventID()] = gomatrixserverlib.PDUResult{ - Error: err.Error(), + Error: errMsg, } } } else { diff --git a/sytest-blacklist b/sytest-blacklist index 1efc207f7..9f140ed1c 100644 --- a/sytest-blacklist +++ b/sytest-blacklist @@ -44,3 +44,7 @@ Existing members see new members' join events Can recv device messages over federation Device messages over federation wake up /sync Wildcard device messages over federation wake up /sync + +# We don't implement soft-failed events yet, but because the /send response is vague, +# this test thinks it's all fine... +Inbound federation accepts a second soft-failed event