Repository navigation
Add-to: only a participant of the stored original may add recipients - #52
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security fix (high, finding 2 of a 2026-10-29 review).
Problem: for an add-to whose parent is stored,
handleAddToPathchecked terminal and time travel but never who was adding. The only participant check (readAddToRecipients) compares add-to-from with the incoming header's ownfrom/to, which the sender writes. So any fmsg host that knows a message's hash (it's thepsha256of any later reply) could:fromand add-to-from;Fix:
isOriginalParticipantrequires add-to-from to be in the stored parent'sfromorto, 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'sAddToFrom/AddToare 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.mdstep 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 originaltomay still add.go test ./...passes.🤖 Generated with Claude Code