1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-21 09:48:47 +02:00
phorge-phorge/src/applications/metamta
epriestley 516ba5e6c5 Fix an issue where generation of mail processing error email could fail in the presence of duplicate headers
Summary:
Ref T10121. If a user sends mail with duplicate headers, like:

```
X-Duplicate: A
X-Duplicate: B
```

...and we process it with `mail_handler.php`, we may end up with `array('A', 'B')` as the header value. When we try to write this back into an error response mail, it fails.

Test Plan:
  - Generated a message with duplicate headers.
  - Piped it into `mail_handler.php` with `--process-duplicates` and `--trace` to get a look at it.
  - Faked an exception.
  - Before patch: bad error email.
  - After patch: clean error email showing multiple header values.

```
$ ./bin/mail show-outbound --id 12386
PROPERTIES
ID: 12386
Status: queued
Related PHID:
Message:

PARAMETERS
sensitive: 1
is-error: 1
force: 1
subject: Error Processing Mail (Exception)
raw-to: ["epriestley@phacility.com"]

HEADERS
X-Phabricator-Sent-This-Message: Yes
X-Mail-Transport-Agent: MetaMTA
X-Auto-Response-Suppress: All

TEXT BODY
Your email to Phabricator was not processed, because an error occurred while
trying to handle it:

Exception: TEST

-- Original Message Body -----------------------------------------------------

testy testy

-- Original Message Headers --------------------------------------------------

from: Evan Priestley <epriestley@phacility.com>
content-type: text/plain; charset=us-ascii
content-transfer-encoding: 7bit
x-smtp-server: smtp.gmail.com:epriestley@phacility.com
subject: test outbound mail
message-id: 7isvptmllqvdvtdxthvdwzg3woj5au7csyuh3hopypjv6y6hqb32qm4bcrd4jtid
x-universally-unique-identifier: 4E489E20-F674-49B2-94BA-0DE44F504EAA
date: Mon, 11 Jan 2016 09:50:12 -0800
date: Mon, 11 Jan 2016 09:50:13 -0800
date: Mon, 11 Jan 2016 09:50:14 -0800
date: Mon, 11 Jan 2016 09:50:15 -0800
to: epriestley@yghe.net
mime-version: 1.0 (Mac OS X Mail 8.2 \(2104\))

HTML BODY
(This message has no HTML body.)
```

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10121

Differential Revision: https://secure.phabricator.com/D14996
2016-01-11 10:16:57 -08:00
..
action When we fail to process mail, tell the user about it 2014-04-03 18:43:18 -07:00
adapter Add missing $mailer property to PhabricatorMailImplementationPHPMailerAdapter 2015-06-16 13:55:17 -07:00
application Flesh out web UI for mail a bit to prepare for Herald outbound rules 2015-08-12 12:27:31 -07:00
applicationpanel Merge branch 'master' into redesign-2015 2015-06-15 08:06:23 -07:00
command Use PhutilClassMapQuery 2015-07-07 22:51:57 +10:00
constants Add basic support for Herald outbound rules 2015-08-15 10:54:33 -07:00
contentsource Don't store IP addresses in content sources 2015-10-21 12:37:37 -07:00
controller Update metamta for handleRequest 2015-10-12 12:02:11 -07:00
edge MetaMTA - more progress towards a mail application 2015-06-23 11:37:14 -07:00
editor Use ApplicationTransactions in ApplicationEmail 2015-06-11 10:15:49 -07:00
exception Apply some autofix linter rules 2014-09-10 06:55:05 +10:00
garbagecollector Provide bin/garbage for interacting with garbage collection 2015-10-02 09:17:24 -07:00
herald Various translation improvements 2015-11-03 07:02:46 +11:00
management variable days back for bin/mail volume 2015-08-27 04:40:45 -07:00
parser Extend from Phobject 2015-06-15 18:02:27 +10:00
phid Mark PhabricatorPHIDType::getPHIDTypeApplicationClass() as abstract 2015-11-03 06:47:12 +11:00
query Add basic support for Herald outbound rules 2015-08-15 10:54:33 -07:00
receiver Improve lipsum generation of projects 2015-12-24 09:06:56 -08:00
replyhandler Dramatically limit the range of failures which can cause duplicate mail 2015-06-16 16:43:24 -07:00
storage Fix an issue where generation of mail processing error email could fail in the presence of duplicate headers 2016-01-11 10:16:57 -08:00
typeahead Remove mailing lists application 2015-06-03 18:42:36 -07:00
view HTML emails for Calendar event description changes should respect remarkup rules 2015-11-07 07:39:52 -08:00
PhabricatorMetaMTAWorker.php Consolidate outbound mail status in a new class 2015-08-14 04:31:42 -07:00