From 77462b8f725ce6e2c7bd8c3a37a9c6bdba4eb728 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Mon, 22 Oct 2018 20:58:52 -0700 Subject: [PATCH] Remove deprecated 'validation_seed' RPC command: The 'validation_seed' RPC command was used to change the validation key used by a validator at runtime. Its implementation was commented out with commit fa796a2eb593f60eb72679860e8d7c55ba3df0ab which has been included in the codebase since the 0.30.0 release and there are no plans to reintroduce the functionality at this point. Validator operators should migrate to using validator manifests instead. This fixes #2748. --- CMakeLists.txt | 1 - src/ripple/app/main/Main.cpp | 1 - src/ripple/net/impl/RPCCall.cpp | 15 ----- src/ripple/rpc/handlers/Handlers.h | 1 - src/ripple/rpc/handlers/ValidationSeed.cpp | 77 ---------------------- src/ripple/rpc/impl/Handler.cpp | 1 - src/ripple/unity/rpcx2.cpp | 1 - src/test/rpc/RPCCall_test.cpp | 47 ------------- 8 files changed, 144 deletions(-) delete mode 100644 src/ripple/rpc/handlers/ValidationSeed.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d8d19962b..2de569aca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1957,7 +1957,6 @@ else () src/ripple/rpc/handlers/UnlList.cpp src/ripple/rpc/handlers/Unsubscribe.cpp src/ripple/rpc/handlers/ValidationCreate.cpp - src/ripple/rpc/handlers/ValidationSeed.cpp src/ripple/rpc/handlers/ValidatorListSites.cpp src/ripple/rpc/handlers/Validators.cpp src/ripple/rpc/handlers/WalletPropose.cpp diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index 79a0902d6..0b8115e0d 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -162,7 +162,6 @@ void printHelp (const po::options_description& desc) " submit_multisigned \n" " tx \n" " validation_create [||]\n" - " validation_seed [||]\n" " wallet_propose []\n"; } diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index b869e7baf..c0842a8e8 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -993,20 +993,6 @@ private: return jvRequest; } - // validation_seed [||] - // - // NOTE: It is poor security to specify secret information on the command line. This information might be saved in the command - // shell history file (e.g. .bash_history) and it may be leaked via the process status command (i.e. ps). - Json::Value parseValidationSeed (Json::Value const& jvParams) - { - Json::Value jvRequest{Json::objectValue}; - - if (jvParams.size ()) - jvRequest[jss::secret] = jvParams[0u].asString (); - - return jvRequest; - } - // wallet_propose [] // is only for testing. Master seeds should only be generated randomly. Json::Value parseWalletPropose (Json::Value const& jvParams) @@ -1155,7 +1141,6 @@ public: { "tx_history", &RPCParser::parseTxHistory, 1, 1 }, { "unl_list", &RPCParser::parseAsIs, 0, 0 }, { "validation_create", &RPCParser::parseValidationCreate, 0, 1 }, - { "validation_seed", &RPCParser::parseValidationSeed, 0, 1 }, { "version", &RPCParser::parseAsIs, 0, 0 }, { "wallet_propose", &RPCParser::parseWalletPropose, 0, 1 }, { "internal", &RPCParser::parseInternal, 1, -1 }, diff --git a/src/ripple/rpc/handlers/Handlers.h b/src/ripple/rpc/handlers/Handlers.h index d938fd6af..221369c47 100644 --- a/src/ripple/rpc/handlers/Handlers.h +++ b/src/ripple/rpc/handlers/Handlers.h @@ -80,7 +80,6 @@ Json::Value doTxHistory (RPC::Context&); Json::Value doUnlList (RPC::Context&); Json::Value doUnsubscribe (RPC::Context&); Json::Value doValidationCreate (RPC::Context&); -Json::Value doValidationSeed (RPC::Context&); Json::Value doWalletPropose (RPC::Context&); Json::Value doValidators (RPC::Context&); Json::Value doValidatorListSites (RPC::Context&); diff --git a/src/ripple/rpc/handlers/ValidationSeed.cpp b/src/ripple/rpc/handlers/ValidationSeed.cpp deleted file mode 100644 index 819c51bb5..000000000 --- a/src/ripple/rpc/handlers/ValidationSeed.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012-2014 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ripple { - -// { -// secret: -// } -Json::Value doValidationSeed (RPC::Context& context) -{ - // TODO: This feature is temporarily disabled since we - // cannot modify the config object. We should consider - // whether we want the ability to change the validator - // keys at runtime. - return rpcError (rpcNOT_IMPL); - - // auto lock = make_lock(context.app.getMasterMutex()); - // Json::Value obj (Json::objectValue); - - // if (!context.params.isMember (jss::secret)) - // { - // std::cerr << "Unset validation seed." << std::endl; - - // context.app.config().VALIDATION_SEED.clear (); - // context.app.config().VALIDATION_PUB.clear (); - // context.app.config().VALIDATION_PRIV.clear (); - // } - // else if (!context.app.config().VALIDATION_SEED.setSeedGeneric ( - // context.params[jss::secret].asString ())) - // { - // context.app.config().VALIDATION_PUB.clear (); - // context.app.config().VALIDATION_PRIV.clear (); - - // return rpcError (rpcBAD_SEED); - // } - // else - // { - // auto& seed = context.app.config().VALIDATION_SEED; - // auto& pub = context.app.config().VALIDATION_PUB; - - // pub = RippleAddress::createNodePublic (seed); - // context.app.config().VALIDATION_PRIV = RippleAddress::createNodePrivate (seed); - - // obj[jss::validation_public_key] = pub.humanNodePublic (); - // obj[jss::validation_seed] = seed.humanSeed (); - // obj[jss::validation_key] = seed.humanSeed1751 (); - // } - - // return obj; -} - -} // ripple diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index b55e35d52..1a8ad85f7 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -111,7 +111,6 @@ Handler const handlerArray[] { { "tx_history", byRef (&doTxHistory), Role::USER, NO_CONDITION }, { "unl_list", byRef (&doUnlList), Role::ADMIN, NO_CONDITION }, { "validation_create", byRef (&doValidationCreate), Role::ADMIN, NO_CONDITION }, - { "validation_seed", byRef (&doValidationSeed), Role::ADMIN, NO_CONDITION }, { "validators", byRef (&doValidators), Role::ADMIN, NO_CONDITION }, { "validator_list_sites", byRef (&doValidatorListSites), Role::ADMIN, NO_CONDITION }, { "wallet_propose", byRef (&doWalletPropose), Role::ADMIN, NO_CONDITION }, diff --git a/src/ripple/unity/rpcx2.cpp b/src/ripple/unity/rpcx2.cpp index 37f82dbc5..a4082b109 100644 --- a/src/ripple/unity/rpcx2.cpp +++ b/src/ripple/unity/rpcx2.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 2e31d843c..1f63b8316 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -6638,53 +6638,6 @@ static RPCCallTestData const rpcCallTestArray [] = })" }, -// validation_seed ------------------------------------------------------------- -{ - "validation_seed: minimal.", __LINE__, - { - "validation_seed", - }, - RPCCallTestData::no_exception, - R"({ - "method" : "validation_seed" - })" -}, -{ - "validation_seed: with secret.", __LINE__, - { - "validation_seed", - "the form of the secret is not validated" - }, - RPCCallTestData::no_exception, - R"({ - "method" : "validation_seed", - "params" : [ - { - "secret" : "the form of the secret is not validated" - } - ] - })" -}, -{ - "validation_seed: too many arguments.", __LINE__, - { - "validation_seed", - "the form of the secret is not validated", - "extra" - }, - RPCCallTestData::no_exception, - R"({ - "method" : "validation_seed", - "params" : [ - { - "error" : "badSyntax", - "error_code" : 1, - "error_message" : "Syntax error." - } - ] - })" -}, - // version --------------------------------------------------------------------- { "version: minimal.", __LINE__,