Skip to content

Add-to: only a participant of the stored original may add recipients - #52

Merged
markmnl merged 1 commit into
mainfrom
addto-participant
Oct 29, 2026
Merged

markmnl merged 1 commit into
mainfrom
addto-participant

Conversation

@markmnl

@markmnl markmnl commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Security fix (high, finding 2 of a 2026-10-29 review).

Problem: for an add-to whose parent is stored, handleAddToPath checked terminal and time travel but never who was adding. The only participant check (readAddToRecipients) compares add-to-from with the incoming header's own from/to, which the sender writes. So any fmsg host that knows a message's hash (it's the psha256 of any later reply) could:

  1. put itself in from and add-to-from;
  2. add an address it controls on our domain;
  3. get code 65, and that address gets the stored original (body and attachments), though the sender was never on it.

Fix: isOriginalParticipant requires add-to-from to be in the stored parent's from or to, otherwise REJECT code 1. Someone only added by an earlier batch isn't an original participant (SPEC §12: their replies reference the batch). The parent's AddToFrom/AddTo are deliberately not consulted.

Spec: §12 and the full specification's NOTE I already require this, but the stored-parent steps (§10.3 step 7) didn't list it. SPEC.md step 7 now does. The same clarification for markmnl/fmsg's SPEC.md and SPECIFICATION.md is a separate PR.

Tests:

  • TestHandleAddToPathRejectsNonParticipant: an outsider, and a later-added recipient, both get code 1. It fails without the fix.
  • TestHandleAddToPathAcceptsRecipientAsAdder: an original to may still add.
  • go test ./... passes.

🤖 Generated with Claude Code

handleAddToPath checked a stored parent for terminal and time travel but
not who was adding. readAddToRecipients only checks add-to-from against
the incoming header's own from and to, which the sender writes. So a host
on any domain that knew a message's hash (e.g. psha256 on a later reply)
could name itself in from and add-to-from and have the stored original,
body and attachments, attached to an address it chose (code 65).

Now add-to-from must be in the stored parent's from or to, else code 1.
A recipient added by an earlier batch is not an original participant
(SPEC §12). SPEC.md step 7 says so explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markmnl
markmnl merged commit 3ef177c into main Oct 29, 2026
2 checks passed
@markmnl
markmnl deleted the addto-participant branch October 29, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant