Răsfoiți Sursa

Backport fixing custom fields leaking in history sync

Tulir Asokan 3 ani în urmă
părinte
comite
a58cae16cd
1 a modificat fișierele cu 7 adăugiri și 0 ștergeri
  1. 7 0
      historysync.go

+ 7 - 0
historysync.go

@@ -478,6 +478,13 @@ func (portal *Portal) wrapBatchEvent(info *types.MessageInfo, intent *appservice
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
+	if newEventType == event.EventEncrypted {
+		// Clear other custom keys if the event was encrypted, but keep the double puppet identifier
+		wrappedContent.Raw = map[string]interface{}{backfillIDField: info.ID}
+		if intent.IsCustomPuppet {
+			wrappedContent.Raw[doublePuppetKey] = doublePuppetValue
+		}
+	}
 	return &event.Event{
 	return &event.Event{
 		Sender:    intent.UserID,
 		Sender:    intent.UserID,
 		Type:      newEventType,
 		Type:      newEventType,