From 69399dfc2ad2c2f771a31357c80cfdafb0706eb8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 12 Mar 2014 11:30:22 -0700 Subject: [PATCH] Remove `phpast.*` Conduit methods Summary: Ref T4592. These were added with the intent of not requiring builds on Windows, but then we got builds on Windows working and they seem to be straightforward. See T4592 for most recent discussion. Remove these methods because they aren't really practical for anything and increase attack surface area by giving adversaries access to `xhpast`, and generally bloat up the Conduit API. To my knowledge, nothing has ever called them. (If an install somehow relies on these, they can drop them into `src/extensions/` to expose them again.) Test Plan: Viewed conduit. Reviewers: btrahan Reviewed By: btrahan Subscribers: aran, epriestley Maniphest Tasks: T4592 Differential Revision: https://secure.phabricator.com/D8500 --- src/__phutil_library_map__.php | 6 --- .../conduit/ConduitAPI_phpast_Method.php | 13 ------ .../ConduitAPI_phpast_getast_Method.php | 37 ----------------- .../ConduitAPI_phpast_version_Method.php | 40 ------------------- 4 files changed, 96 deletions(-) delete mode 100644 src/applications/phpast/conduit/ConduitAPI_phpast_Method.php delete mode 100644 src/applications/phpast/conduit/ConduitAPI_phpast_getast_Method.php delete mode 100644 src/applications/phpast/conduit/ConduitAPI_phpast_version_Method.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 84c5e6286e..79e43bd443 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -217,9 +217,6 @@ phutil_register_library_map(array( 'ConduitAPI_phid_info_Method' => 'applications/phid/conduit/ConduitAPI_phid_info_Method.php', 'ConduitAPI_phid_lookup_Method' => 'applications/phid/conduit/ConduitAPI_phid_lookup_Method.php', 'ConduitAPI_phid_query_Method' => 'applications/phid/conduit/ConduitAPI_phid_query_Method.php', - 'ConduitAPI_phpast_Method' => 'applications/phpast/conduit/ConduitAPI_phpast_Method.php', - 'ConduitAPI_phpast_getast_Method' => 'applications/phpast/conduit/ConduitAPI_phpast_getast_Method.php', - 'ConduitAPI_phpast_version_Method' => 'applications/phpast/conduit/ConduitAPI_phpast_version_Method.php', 'ConduitAPI_phragment_Method' => 'applications/phragment/conduit/ConduitAPI_phragment_Method.php', 'ConduitAPI_phragment_getpatch_Method' => 'applications/phragment/conduit/ConduitAPI_phragment_getpatch_Method.php', 'ConduitAPI_phragment_queryfragments_Method' => 'applications/phragment/conduit/ConduitAPI_phragment_queryfragments_Method.php', @@ -2746,9 +2743,6 @@ phutil_register_library_map(array( 'ConduitAPI_phid_info_Method' => 'ConduitAPI_phid_Method', 'ConduitAPI_phid_lookup_Method' => 'ConduitAPI_phid_Method', 'ConduitAPI_phid_query_Method' => 'ConduitAPI_phid_Method', - 'ConduitAPI_phpast_Method' => 'ConduitAPIMethod', - 'ConduitAPI_phpast_getast_Method' => 'ConduitAPI_phpast_Method', - 'ConduitAPI_phpast_version_Method' => 'ConduitAPI_phpast_Method', 'ConduitAPI_phragment_Method' => 'ConduitAPIMethod', 'ConduitAPI_phragment_getpatch_Method' => 'ConduitAPI_phragment_Method', 'ConduitAPI_phragment_queryfragments_Method' => 'ConduitAPI_phragment_Method', diff --git a/src/applications/phpast/conduit/ConduitAPI_phpast_Method.php b/src/applications/phpast/conduit/ConduitAPI_phpast_Method.php deleted file mode 100644 index 4b2bef965c..0000000000 --- a/src/applications/phpast/conduit/ConduitAPI_phpast_Method.php +++ /dev/null @@ -1,13 +0,0 @@ - 'required string', - ); - } - - public function defineReturnType() { - return 'nonempty dict'; - } - - public function defineErrorTypes() { - return array( - 'ERR-XHPAST-LEY' => 'xhpast got Rickrolled', - ); - } - - protected function execute(ConduitAPIRequest $request) { - $source = $request->getValue('code'); - $future = xhpast_get_parser_future($source); - list($stdout) = $future->resolvex(); - - return json_decode($stdout, true); - } - -} diff --git a/src/applications/phpast/conduit/ConduitAPI_phpast_version_Method.php b/src/applications/phpast/conduit/ConduitAPI_phpast_version_Method.php deleted file mode 100644 index 7512a51d44..0000000000 --- a/src/applications/phpast/conduit/ConduitAPI_phpast_version_Method.php +++ /dev/null @@ -1,40 +0,0 @@ - 'xhpast was not found on the server', - 'ERR-COMMAND-FAILED' => 'xhpast died with a nonzero exit code', - ); - } - - protected function execute(ConduitAPIRequest $request) { - $path = xhpast_get_binary_path(); - if (!Filesystem::pathExists($path)) { - throw new ConduitException('ERR-NOT-FOUND'); - } - list($err, $stdout) = exec_manual('%s --version', $path); - if ($err) { - throw new ConduitException('ERR-COMMAND-FAILED'); - } - return trim($stdout); - } - -}