mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
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
This commit is contained in:
parent
f371c7b35f
commit
85e9f8374a
3 changed files with 1 additions and 24 deletions
|
@ -136,25 +136,6 @@ abstract class ConduitAPIMethod
|
||||||
return str_replace('_', '.', $method_fragment);
|
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) {
|
protected function formatStringConstants($constants) {
|
||||||
foreach ($constants as $key => $value) {
|
foreach ($constants as $key => $value) {
|
||||||
$constants[$key] = '"'.$value.'"';
|
$constants[$key] = '"'.$value.'"';
|
||||||
|
|
|
@ -25,7 +25,7 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
||||||
'user' => 'optional string',
|
'user' => 'optional string',
|
||||||
'authToken' => 'optional int',
|
'authToken' => 'optional int',
|
||||||
'authSignature' => 'optional string',
|
'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) {
|
protected function execute(ConduitAPIRequest $request) {
|
||||||
|
|
||||||
$this->validateHost($request->getValue('host'));
|
|
||||||
|
|
||||||
$client = $request->getValue('client');
|
$client = $request->getValue('client');
|
||||||
$client_version = (int)$request->getValue('clientVersion');
|
$client_version = (int)$request->getValue('clientVersion');
|
||||||
$client_description = (string)$request->getValue('clientDescription');
|
$client_description = (string)$request->getValue('clientDescription');
|
||||||
|
|
|
@ -39,8 +39,6 @@ final class ConduitAPI_conduit_getcertificate_Method extends ConduitAPIMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(ConduitAPIRequest $request) {
|
protected function execute(ConduitAPIRequest $request) {
|
||||||
$this->validateHost($request->getValue('host'));
|
|
||||||
|
|
||||||
$failed_attempts = PhabricatorUserLog::loadRecentEventsFromThisIP(
|
$failed_attempts = PhabricatorUserLog::loadRecentEventsFromThisIP(
|
||||||
PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE,
|
PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE,
|
||||||
60 * 5);
|
60 * 5);
|
||||||
|
|
Loading…
Reference in a new issue