1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-24 07:42:40 +01:00
phorge-phorge/src/applications/maniphest
epriestley e3aa043a02 Allow multiple mail receivers to react to an individual email
Summary:
Fixes T7477. Fixes T13066. Currently, inbound mail is processed by the first receiver that matches any "To:" address. "Cc" addresses are ignored.

**To, CC, and Multiple Receivers**

Some users would like to be able to "Cc" addresses like `bugs@` instead of having to "To" the address, which makes perfect sense. That's the driving use case behind T7477.

Since users can To/Cc multiple "create object" or "update object" addresses, I also wanted to make the behavior more general. For example, if you email `bugs@` and also `paste@`, your mail might reasonably make both a Task and a Paste. Is this useful? I'm not sure. But it seems like it's pretty clearly the best match for user intent, and the least-surprising behavior we can have. There's also no good rule for picking which address "wins" when two or more match -- we ended up with "address order", which is pretty arbitrary since "To" and "Cc" are not really ordered fields.

One part of this change is removing `phabricator.allow-email-users`. In practice, this option only controlled whether users were allowed to send mail to "Application Email" addresses with a configured default author, and it's unlikely that we'll expand it since I think the future of external/grey users is Nuance, not richer interaction with Maniphest/Differential/etc. Since this option only made "Default Author" work and "Default Author" is optional, we can simplify behavior by making the rule work like this:

  - If an address specifies a default author, it allows public email.
  - If an address does not, it doesn't.

That's basically how it worked already, except that you could intentionally "break" the behavior by not configuring `phabricator.allow-email-users`. This is a backwards compatility change with possible security implications (it might allow email in that was previously blocked by configuration) that I'll call out in the changelog, but I suspect that no installs are really impacted and this new behavior is generally more intuitive.

A somewhat related change here is that each receiver is allowed to react to each individual email address, instead of firing once. This allows you to configure `bugs-a@` and `bugs-b@` and CC them both and get two tasks. Useful? Maybe not, but seems like the best execution of intent.

**Sender vs Author**

Adjacently, T13066 described an improvement to error handling behavior here: we did not distinguish between "sender" (the user matching the email "From" address) and "actor" (the user we're actually acting as in the application). These are different when you're some internet rando and send to `bugs@`, which has a default author. Then the "sender" is `null` and the "author" is `@bugs-robot` or whatever (some user account you've configured).

This refines "Sender" vs "Author". This is mostly a purity/correctness change, but it means that we won't send random email error messages to `@bugs-robot`.

Since receivers are now allowed to process mail with no "sender" if they have some default "actor" they would rather use instead, it's not an error to send from an invalid address unless nothing processes the mail.

**Other**

This removes the "abundant receivers" error since this is no longer an error.

This always sets "external user" mail recipients to be unverified. As far as I can tell, there's no pathway by which we send them email anyway (before or after this change), although it's possible I'm missing something somewhere.

Test Plan:
I did most of this with `bin/mail receive-test`. I rigged the workflow slightly for some of it since it doesn't support multiple addresses or explicit "CC" and adding either would be a bit tricky.

These could also be tested with `scripts/mail/mail_handler.php`, but I don't currently have the MIME parser extension installed locally after a recent upgrade to Mojave and suspect T13232 makes it tricky to install.

- Ran unit tests, which provide significant coverage of this flow.
- Sent mail to multiple Maniphest application emails, got multiple tasks.
- Sent mail to a Maniphest and a Paste application email, got a task and a paste.
- Sent mail to a task.
  - Saw original email recorded on tasks. This is a behavior particular to tasks.
- Sent mail to a paste.
- Sent mail to a mock.
- Sent mail to a Phame blog post.
- Sent mail to a Legalpad document.
- Sent mail to a Conpherence thread.
- Sent mail to a poll.
- This isn't every type of supported object but it's enough of them that I'm pretty confident I didn't break the whole flow.
- Sent mail to an object I could not view (got an error).
- As a non-user, sent mail to several "create an object..." addresses.
  - Addresses with a default user worked (e.g., created a task).
  - Addresses without a default user did not work.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13066, T7477

Differential Revision: https://secure.phabricator.com/D19952
2019-01-16 12:28:02 -08:00
..
__tests__ Use keywords instead of ints to update task priority in ManiphestEditEngine 2017-06-14 14:43:03 -07:00
application Allow the "Create Subtask" workflow to prompt for a subtype selection, and prepare for customizable options 2018-12-10 14:44:26 -08:00
bulk Remove the Maniphest-specific bulk job type 2018-01-19 12:44:16 -08:00
capability Remove deprecated Maniphest "Can Edit <Specific Property>" capabilities 2018-08-16 10:51:06 -07:00
command Use keywords instead of ints to update task priority in ManiphestEditEngine 2017-06-14 14:43:03 -07:00
conduit Freeze "maniphest.gettasktransactions" and make status/priority transactions more consistent 2017-11-22 11:13:53 -08:00
config Allow objects to be put in an "MFA required for all interactions" mode, and support "MFA required" statuses in Maniphest 2018-12-28 00:10:54 -08:00
constants Allow objects to be put in an "MFA required for all interactions" mode, and support "MFA required" statuses in Maniphest 2018-12-28 00:10:54 -08:00
controller Correct a zero-based month tooltip on burnup charts 2019-01-15 18:09:18 -08:00
edge Allow duplicates and merged-in tasks to be queried with edge.search 2017-10-13 13:12:50 -07:00
editor Fix an issue with creating tasks directly into workboard columns 2018-12-12 09:21:39 -08:00
engine Allow objects to be put in an "MFA required for all interactions" mode, and support "MFA required" statuses in Maniphest 2018-12-28 00:10:54 -08:00
engineextension Add more mail stamps: tasks, subscribers, projects, spaces 2018-02-06 04:05:46 -08:00
field Fix errors found by PHPStan 2017-02-17 10:10:15 +00:00
herald Add "you can only enter one value" UI limits to Herald "set status" and "set priority" actions 2018-01-26 13:22:26 -08:00
httpparametertype Make "Create Subtask" work properly in EditEngine 2015-12-08 14:29:58 -08:00
lipsum Use keywords instead of ints to update task priority in ManiphestEditEngine 2017-06-14 14:43:03 -07:00
mail Allow multiple mail receivers to react to an individual email 2019-01-16 12:28:02 -08:00
phid Mark PhabricatorPHIDType::getPHIDTypeApplicationClass() as abstract 2015-11-03 06:47:12 +11:00
policyrule Allow PolicyRules to serve as "Object Policies" 2015-06-13 15:44:38 -07:00
query Fix another qsprintf() straggler in "Has Open Subtasks" 2018-12-13 05:17:02 -08:00
relationship Update Maniphest for modular transactions 2017-05-15 10:29:06 -07:00
remarkup Rename PhutilRemarkupRule subclasses 2014-08-05 00:55:43 +10:00
search Reduce the amount of boilerplate that implementing FerretInterface requires 2017-09-07 13:23:31 -07:00
storage Allow objects to be put in an "MFA required for all interactions" mode, and support "MFA required" statuses in Maniphest 2018-12-28 00:10:54 -08:00
typeahead Replace the informal "array" subtype map with a more formal "SubtypeMap" object 2018-12-09 16:37:35 -08:00
view Replace the informal "array" subtype map with a more formal "SubtypeMap" object 2018-12-09 16:37:35 -08:00
xaction Enrich "priority" transactions in Maniphest for "transaction.search" 2018-08-24 10:05:05 -07:00