Add additional error checking that should never trigger

This commit is contained in:
David Dworken 2023-11-19 08:55:15 -08:00
parent 4d2b02e2c3
commit 30b5478104
No known key found for this signature in database

View File

@ -154,6 +154,9 @@ func DecryptHistoryEntry(userSecret string, entry shared.EncHistoryEntry) (Histo
if err != nil {
return HistoryEntry{}, nil
}
if decryptedEntry.EntryId != "" && entry.EncryptedId != "" && decryptedEntry.EntryId != entry.EncryptedId {
return HistoryEntry{}, fmt.Errorf("rejecting encrypted history entry that contains mismatching IDs (outer=%s inner=%s)", entry.EncryptedId, decryptedEntry.EntryId)
}
return decryptedEntry, nil
}