@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move computeMailHash() to PhabricatorObjectMailReceiver

Summary: Kick this out of here. Ref T1205.

Test Plan: Grep.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1205

Differential Revision: https://secure.phabricator.com/D5942

+14 -13
+3 -3
src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php
··· 30 30 throw new Exception(pht("No such task or revision!")); 31 31 } 32 32 33 - $hash = PhabricatorMetaMTAReceivedMail::computeMailHash( 34 - $receiver->getMailKey(), 35 - $user->getPHID()); 33 + $hash = PhabricatorObjectMailReceiver::computeMailHash( 34 + $receiver->getMailKey(), 35 + $user->getPHID()); 36 36 37 37 $header_content['to'] = 38 38 $to.'+'.$user->getID().'+'.$hash.'@';
+6
src/applications/metamta/receiver/PhabricatorObjectMailReceiver.php
··· 33 33 return $regexp; 34 34 } 35 35 36 + public static function computeMailHash($mail_key, $phid) { 37 + $global_mail_key = PhabricatorEnv::getEnvConfig('phabricator.mail-key'); 38 + 39 + $hash = PhabricatorHash::digest($mail_key.$global_mail_key.$phid); 40 + return substr($hash, 0, 16); 41 + } 36 42 37 43 }
+2 -2
src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
··· 260 260 // We compute a hash using the object's own PHID to prevent an attacker 261 261 // from blindly interacting with objects that they haven't ever received 262 262 // mail about by just sending to D1@, D2@, etc... 263 - $hash = PhabricatorMetaMTAReceivedMail::computeMailHash( 263 + $hash = PhabricatorObjectMailReceiver::computeMailHash( 264 264 $receiver->getMailKey(), 265 265 $receiver->getPHID()); 266 266 ··· 292 292 $receiver = $this->getMailReceiver(); 293 293 $receiver_id = $receiver->getID(); 294 294 $user_id = $user->getID(); 295 - $hash = PhabricatorMetaMTAReceivedMail::computeMailHash( 295 + $hash = PhabricatorObjectMailReceiver::computeMailHash( 296 296 $receiver->getMailKey(), 297 297 $handle->getPHID()); 298 298 $domain = $this->getReplyHandlerDomain();
+3 -8
src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
··· 337 337 $check_phid = $receiver->getPHID(); 338 338 } 339 339 340 - $expect_hash = self::computeMailHash($receiver->getMailKey(), $check_phid); 340 + $expect_hash = PhabricatorObjectMailReceiver::computeMailHash( 341 + $receiver->getMailKey(), 342 + $check_phid); 341 343 342 344 if ($expect_hash != $hash) { 343 345 return $this->setMessage("Invalid mail hash!")->save(); ··· 405 407 } 406 408 407 409 return $class_obj->load($receiver_id); 408 - } 409 - 410 - public static function computeMailHash($mail_key, $phid) { 411 - $global_mail_key = PhabricatorEnv::getEnvConfig('phabricator.mail-key'); 412 - 413 - $hash = PhabricatorHash::digest($mail_key.$global_mail_key.$phid); 414 - return substr($hash, 0, 16); 415 410 } 416 411 417 412 /**