mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Some review comment fixes
This commit is contained in:
parent
327af8fb7f
commit
c5d11ba8f8
|
|
@ -515,7 +515,7 @@ func (t *txnReq) processEDUs(ctx context.Context) {
|
||||||
}
|
}
|
||||||
inputRes := &eduserverAPI.InputCrossSigningKeyUpdateResponse{}
|
inputRes := &eduserverAPI.InputCrossSigningKeyUpdateResponse{}
|
||||||
if err := t.eduAPI.InputCrossSigningKeyUpdate(ctx, inputReq, inputRes); err != nil {
|
if err := t.eduAPI.InputCrossSigningKeyUpdate(ctx, inputReq, inputRes); err != nil {
|
||||||
util.GetLogger(ctx).WithError(err).Error("Failed to send signing key update to EDU server")
|
util.GetLogger(ctx).WithError(err).Error("Failed to unmarshal cross-signing update")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ func (t *KeyChangeConsumer) onCrossSigningMessage(m api.DeviceMessage) error {
|
||||||
output := m.CrossSigningKeyUpdate
|
output := m.CrossSigningKeyUpdate
|
||||||
_, host, err := gomatrixserverlib.SplitID('@', output.UserID)
|
_, host, err := gomatrixserverlib.SplitID('@', output.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Errorf("eduserver output log: user ID parse failure")
|
logrus.WithError(err).Errorf("fedsender key change consumer: user ID parse failure")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if host != gomatrixserverlib.ServerName(t.serverName) {
|
if host != gomatrixserverlib.ServerName(t.serverName) {
|
||||||
|
|
@ -166,13 +166,13 @@ func (t *KeyChangeConsumer) onCrossSigningMessage(m api.DeviceMessage) error {
|
||||||
WantMembership: "join",
|
WantMembership: "join",
|
||||||
}, &queryRes)
|
}, &queryRes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WithError(err).Error("failed to calculate joined rooms for user")
|
logger.WithError(err).Error("fedsender key change consumer: failed to calculate joined rooms for user")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// send this key change to all servers who share rooms with this user.
|
// send this key change to all servers who share rooms with this user.
|
||||||
destinations, err := t.db.GetJoinedHostsForRooms(context.Background(), queryRes.RoomIDs)
|
destinations, err := t.db.GetJoinedHostsForRooms(context.Background(), queryRes.RoomIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WithError(err).Error("failed to calculate joined hosts for rooms user is in")
|
logger.WithError(err).Error("fedsender key change consumer: failed to calculate joined hosts for rooms user is in")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,7 +182,8 @@ func (t *KeyChangeConsumer) onCrossSigningMessage(m api.DeviceMessage) error {
|
||||||
Origin: string(t.serverName),
|
Origin: string(t.serverName),
|
||||||
}
|
}
|
||||||
if edu.Content, err = json.Marshal(output); err != nil {
|
if edu.Content, err = json.Marshal(output); err != nil {
|
||||||
return err
|
logger.WithError(err).Error("fedsender key change consumer: failed to marshal output, dropping")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Infof("Sending cross-signing update message to %q", destinations)
|
logger.Infof("Sending cross-signing update message to %q", destinations)
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,13 @@ func NewOutputCrossSigningKeyUpdateConsumer(
|
||||||
keyDB storage.Database,
|
keyDB storage.Database,
|
||||||
keyAPI api.KeyInternalAPI,
|
keyAPI api.KeyInternalAPI,
|
||||||
) *OutputCrossSigningKeyUpdateConsumer {
|
) *OutputCrossSigningKeyUpdateConsumer {
|
||||||
|
// The keyserver both produces and consumes on the TopicOutputKeyChangeEvent
|
||||||
|
// topic. We will only produce events where the UserID matches our server name,
|
||||||
|
// and we will only consume events where the UserID does NOT match our server
|
||||||
|
// name (because the update came from a remote server).
|
||||||
consumer := internal.ContinualConsumer{
|
consumer := internal.ContinualConsumer{
|
||||||
Process: process,
|
Process: process,
|
||||||
ComponentName: "keyserver/crosssigning",
|
ComponentName: "keyserver/keyserver",
|
||||||
Topic: cfg.Global.Kafka.TopicFor(config.TopicOutputKeyChangeEvent),
|
Topic: cfg.Global.Kafka.TopicFor(config.TopicOutputKeyChangeEvent),
|
||||||
Consumer: kafkaConsumer,
|
Consumer: kafkaConsumer,
|
||||||
PartitionStore: keyDB,
|
PartitionStore: keyDB,
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ func sanityCheckKey(key gomatrixserverlib.CrossSigningKey, userID string, purpos
|
||||||
// We can't enforce the key length to be correct for an
|
// We can't enforce the key length to be correct for an
|
||||||
// algorithm that we don't recognise, so instead we'll
|
// algorithm that we don't recognise, so instead we'll
|
||||||
// just make sure that it isn't incredibly excessive.
|
// just make sure that it isn't incredibly excessive.
|
||||||
if len(keyData) > 4096 {
|
if l := len(keyData); l > 4096 {
|
||||||
return fmt.Errorf("unknown key type is too long")
|
return fmt.Errorf("unknown key type is too long (%d bytes)", l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,8 +76,8 @@ func sanityCheckKey(key gomatrixserverlib.CrossSigningKey, userID string, purpos
|
||||||
case "curve25519":
|
case "curve25519":
|
||||||
return fmt.Errorf("curve25519 signatures are impossible")
|
return fmt.Errorf("curve25519 signatures are impossible")
|
||||||
default:
|
default:
|
||||||
if len(originSignature) > 4096 {
|
if l := len(originSignature); l > 4096 {
|
||||||
return fmt.Errorf("unknown signature type is too long")
|
return fmt.Errorf("unknown signature type is too long (%d bytes)", l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -554,3 +554,5 @@ Can upload self-signing keys
|
||||||
Fails to upload self-signing keys with no auth
|
Fails to upload self-signing keys with no auth
|
||||||
Fails to upload self-signing key without master key
|
Fails to upload self-signing key without master key
|
||||||
can fetch self-signing keys over federation
|
can fetch self-signing keys over federation
|
||||||
|
Changing master key notifies local users
|
||||||
|
Changing user-signing key notifies local users
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue