Repository navigation
fix(inbound): accept email replies only from the ticket's requester - #95
Merged
Merged
Conversation
A thread match (In-Reply-To, References, subject reference) was posted as a reply from whoever sent the message, under the From name and address. A matched message now becomes a reply only when From equals the ticket's requester email (case-insensitive), is posted as the requester, and reopens a resolved or closed ticket. Other senders get a new ticket and the matched ticket is left untouched. With an inbound secret configured, only the signed Reply-To address links a message to a ticket; the guessable headers and subject reference are used only when no secret is set.
Merged
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.
Ports escalated-laravel #220 and the updated
domain-model/email-threading.mdrule.Change
InboundEmailRouter: withescalated.email.inbound-secretset, only the signed Reply-To address (reply+{id}.{hmac8}@domain) resolves a ticket.In-Reply-To/References/ subject reference are used only when no secret is configured. (The webhook itself already requires the secret, so in practice the signed address is the only link.)InboundEmailService: a matched message becomes a reply only whenFromequals the ticket'srequester_email(trimmed, case-insensitive). The reply is posted with the ticket's requester name/email, never theFromvalues, and reopens aRESOLVED/CLOSEDticket. Any other sender (including an agent's address) gets a new ticket; the matched ticket is not modified. Mail is never dropped.No tenancy layer exists in this port, so none to respect.
Tests
New
InboundEmailServiceTest:[ESC-…]in the subject -> new ticket, no replyFromwith a valid signed Reply-To -> not posted as the agent, new ticketFromin different case) -> reply posted as the requester, ticket reopenedInboundEmailRouterTest: headers/subject ignored once a secret is configured; signed Reply-To wins over headers.The five scenario tests failed on
mainbefore the fix.Local runs
./gradlew test(H2): 363 tests, 0 failures, 9 skipped./gradlew checkstyleMain checkstyleTest: no findings in touched files