Revert "Signed event copies should be complete"

This reverts commit cef7db0469.
This commit is contained in:
Neil Alexander 2021-11-09 11:41:19 +00:00
parent cef7db0469
commit 27ca2da756
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 8 additions and 19 deletions

View file

@ -161,16 +161,9 @@ func processInvite(
}
// Sign the event so that other servers will know that we have received the invite.
signedEvent, err := event.Sign(
signedEvent := event.Sign(
string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey,
)
if err != nil {
util.GetLogger(ctx).WithError(err).Error("event.Sign failed")
return util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: jsonerror.InternalServerError(),
}
}
// Add the invite event to the roomserver.
err = api.SendInvite(
@ -185,12 +178,12 @@ func processInvite(
if isInviteV2 {
return util.JSONResponse{
Code: http.StatusOK,
JSON: gomatrixserverlib.RespInviteV2{Event: signedEvent},
JSON: gomatrixserverlib.RespInviteV2{Event: &signedEvent},
}
} else {
return util.JSONResponse{
Code: http.StatusOK,
JSON: gomatrixserverlib.RespInvite{Event: signedEvent},
JSON: gomatrixserverlib.RespInvite{Event: &signedEvent},
}
}
default:

View file

@ -296,15 +296,11 @@ func attemptMakeJoinForRestrictedMembership(
// other servers can use to verify that the user we put into the
// `join_authorised_via_users_server` field was actually checked
// and found by us.
signed, err := event.Sign(string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey)
if err != nil {
logger.WithError(err).Error("Failed to sign event")
return jsonerror.InternalServerError()
}
signed := event.Sign(string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey)
// Now, see if the join is valid with the new changes. If it isn't
// then something else is forbidding the join.
if err = gomatrixserverlib.Allowed(signed, &provider); err != nil {
if err = gomatrixserverlib.Allowed(&signed, &provider); err != nil {
logger.WithError(err).Error("Join is not allowed")
return util.JSONResponse{
Code: http.StatusForbidden,