Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Remove localhost restriction #333 #496

Merged
merged 1 commit into from
Sep 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions plugins/wallet_api_plugin/wallet_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ void wallet_api_plugin::plugin_startup() {
// lifetime of plugin is lifetime of application
auto& wallet_mgr = app().get_plugin<wallet_plugin>().get_wallet_manager();

// TODO: http_plugin needs to add ability to restrict to localhost, once added add call here.
// TODO: For now see TODO below.

app().get_plugin<http_plugin>().add_api({
CALL(wallet, wallet_mgr, set_timeout,
INVOKE_V_R(wallet_mgr, set_timeout, int64_t)),
Expand Down Expand Up @@ -95,12 +92,18 @@ void wallet_api_plugin::plugin_startup() {
}

void wallet_api_plugin::plugin_initialize(const variables_map& options) {
// TODO: see TODO above, this is temporary until http_plugin has option to restrict to localhost
if (options.count("http-server-endpoint")) {
const auto& lipstr = options.at("http-server-endpoint").as<string>();
const auto& host = lipstr.substr(0, lipstr.find(':'));
if (host != "localhost" && host != "127.0.0.1") {
FC_THROW("wallet api restricted to localhost");
wlog("\n"
"*************************************\n"
"* *\n"
"* -- Wallet NOT on localhost -- *\n"
"* - Password and/or Private Keys - *\n"
"* - are transferred unencrypted. - *\n"
"* *\n"
"*************************************\n");
}
}
}
Expand Down