From 85e9f8374a35d8cd37e9d05469f435cfb25c0566 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 23 Jun 2014 17:41:02 -0700 Subject: [PATCH] Don't validate Conduit hosts Summary: (See rPd1d3bf4e / rPf371c7b3.) Just get rid of this logic, I don't think there's any value to it. IIRC, this was added a long time ago to deal with some issues that users had configuring things, but I think modern Phabricator covers all this stuff and I haven't seen any confusion from users for a year or more. (Generally, I want to generally make Conduit easier to use, and this makes it more difficult.) Test Plan: `grep` Reviewers: joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D9703 --- .../conduit/method/ConduitAPIMethod.php | 19 ------------------- .../ConduitAPI_conduit_connect_Method.php | 4 +--- ...nduitAPI_conduit_getcertificate_Method.php | 2 -- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php index f8a9ec0a9d..281c8ed1e7 100644 --- a/src/applications/conduit/method/ConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitAPIMethod.php @@ -136,25 +136,6 @@ abstract class ConduitAPIMethod return str_replace('_', '.', $method_fragment); } - protected function validateHost($host) { - // NOTE: Compare domains only so we aren't sensitive to port specification - // or omission. - - $host = new PhutilURI($host); - $host = $host->getDomain(); - - $self = new PhutilURI(PhabricatorEnv::getURI('/')); - $self = $self->getDomain(); - - if ($self !== $host) { - throw new Exception( - "Your client is connecting to this install as '{$host}', but it is ". - "configured as '{$self}'. The client and server must use the exact ". - "same URI to identify the install. Edit your .arcconfig or ". - "phabricator/conf so they agree on the URI for the install."); - } - } - protected function formatStringConstants($constants) { foreach ($constants as $key => $value) { $constants[$key] = '"'.$value.'"'; diff --git a/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php b/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php index 5547ee37c6..351d9b4a8c 100644 --- a/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php +++ b/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php @@ -25,7 +25,7 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod { 'user' => 'optional string', 'authToken' => 'optional int', 'authSignature' => 'optional string', - 'host' => 'required string', + 'host' => 'deprecated', ); } @@ -56,8 +56,6 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod { protected function execute(ConduitAPIRequest $request) { - $this->validateHost($request->getValue('host')); - $client = $request->getValue('client'); $client_version = (int)$request->getValue('clientVersion'); $client_description = (string)$request->getValue('clientDescription'); diff --git a/src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php b/src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php index c4ffcf1895..d8db634c5b 100644 --- a/src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php +++ b/src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php @@ -39,8 +39,6 @@ final class ConduitAPI_conduit_getcertificate_Method extends ConduitAPIMethod { } protected function execute(ConduitAPIRequest $request) { - $this->validateHost($request->getValue('host')); - $failed_attempts = PhabricatorUserLog::loadRecentEventsFromThisIP( PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE, 60 * 5);