DM drafts share key #262

Closed
opened 2026-05-03 11:47:28 +00:00 by Khushvendra · 1 comment
Contributor

Description

When composing a direct message to a user where no previous conversation history exists, the local draft is saved under the key dm:undefined. Because all new, empty conversations resolve to this same draft key, a draft written in one empty conversation will leak into another empty conversation.

Code References

  • Chat.svelte (Line 70): The draft key is initialized as const draftKey = new DraftKey<{...}>(`dm:${$chat?.id}`). Because this runs once on mount, $chat evaluates to undefined for new conversations.
  • ChatCompose.svelte (Lines 37-38 & 99): The compose box reads from and writes to this shared draftKey.
  • drafts.ts: DraftKey uses a global Map, meaning dm:undefined is a globally shared slot.
### Description When composing a direct message to a user where no previous conversation history exists, the local draft is saved under the key `dm:undefined`. Because all new, empty conversations resolve to this same draft key, a draft written in one empty conversation will leak into another empty conversation. ### Code References * `Chat.svelte` (Line 70): The draft key is initialized as `` const draftKey = new DraftKey<{...}>(`dm:${$chat?.id}`) ``. Because this runs once on mount, `$chat` evaluates to `undefined` for new conversations. * `ChatCompose.svelte` (Lines 37-38 & 99): The compose box reads from and writes to this shared `draftKey`. * `drafts.ts`: `DraftKey` uses a global Map, meaning `dm:undefined` is a globally shared slot.
hodlbod changed title from Privacy Leak: New DM Drafts Share the Same Key (`dm:undefined`) to DM drafts share key 2026-05-06 20:08:22 +00:00
hodlbod added the dev label 2026-05-06 20:08:33 +00:00
hodlbod added this to the Current milestone 2026-05-06 20:08:35 +00:00
Owner

Fixed in 8f56812d

Fixed in 8f56812d
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coracle/flotilla#262