Repository navigation
fix: accept inbound email replies only from the ticket's requester - #89
Merged
Merged
Conversation
A subject reference or In-Reply-To match was enough to post a reply on any ticket, and a From address matching a WordPress user posted as that user. - With an inbound secret set, only the signed Reply-To address links mail to a ticket; without one, the canonical Message-ID headers, the subject reference and earlier inbound Message-IDs are used. - A matched email becomes a reply only when From equals the ticket's guest email or requester email (case-insensitive), and is posted as the requester. Anything else opens a new ticket, and only an accepted reply reopens a resolved or closed ticket.
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.Changes (
includes/Services/InboundEmailService.php)escalated_email_inbound_secretoption orESCALATED_EMAIL_INBOUND_SECRET), only the signed Reply-To (reply+{id}.{hmac8}@domain) links mail to a ticket. Without a secret the existing chain is kept: canonical Message-ID inIn-Reply-To/References, subject reference, earlier inbound Message-IDs.resolve_reply_author(): a matched email becomes a reply only whenFromequals (case-insensitive) the ticket's guest email or requester's WordPress email, and it is posted as that requester (guest reply or the requester user). A WordPress user is never chosen fromFrom. Anyone else gets a new ticket; mail is not dropped.screenshots/seed.phpreformatted with Pint, which was already failing the lint workflow onmain.Tests (
tests/Test_Inbound_Email_Routes.php, end to end through the REST route)existing_ticket()is now a guest ticket opened by the sender; header/subject threading tests run without a secret.Fromnaming an administrator is not posted as them; with a secret, header/subject threading alone opens a new ticket; requester reply (mixed-caseFrom) is posted as the requester and reopens. 4 of the 5 fail onmain.Locally (php:8.2 + MySQL 8.0, WP test suite):
vendor/bin/phpunit546 tests OK (4 skipped);vendor/bin/pint --testpasses.