BUG: JMAP FNV-32 UID hash collision risk
Describe the bug
backend/jmap/jmap.go converts JMAP string IDs to uint32 via FNV-32a hash (jmapIDToUID function). Due to the birthday paradox, collision probability reaches ~1% at ~9,300 emails and ~50% at ~77,000 emails. A collision means operating on the wrong email (delete, move, mark read). No collision detection exists.
func jmapIDToUID(id jmapclient.ID) uint32 {
h := fnv.New32a()
h.Write([]byte(id))
v := h.Sum32()
if v == 0 {
v = 1
}
return v
}
To reproduce
Use a JMAP account with a large mailbox (>9,000 emails). Two emails with different JMAP IDs may hash to the same uint32 UID. Deleting or moving one email could affect the other.
Expected behavior
Each email should have a unique internal UID. Collisions should be detected and handled, or a monotonic counter with a map[uint32]jmapclient.ID reverse lookup should be used instead of hashing.
OS
All platforms
This has had no activity for 30 days. It will be closed in 14 days unless updated. Comment or remove the stale label to keep it open.
Closing due to inactivity. Reopen if still relevant.