netbase: Remove "tor" as a network specification
What changed, and why it matters
This commit removes support for the old word 'tor' as a way to specify the Tor/Onion network in Bitcoin Core settings. Users must now use 'onion' instead. It is a cleanup of a previously-announced deprecation, not a fix for an active security flaw. The main risk is that users or scripts still using 'tor' will silently have those proxy settings ignored, which could weaken their privacy by sending traffic over the regular internet instead of through Tor.
Review release notes and configuration migration guidance. Users and operators relying on '-proxy=...=tor' should update to '=onion' before upgrading. Consider adding a startup error or clearer warning if an unrecognized network is supplied to a proxy argument, rather than silently ignoring it.
Security signals we found
Deprecation removal of network alias 'tor' in favor of 'onion'
Behavior change: previously accepted proxy specification now parses as NET_UNROUTABLE and is ignored
Potential privacy degradation for configurations still using the deprecated alias
Evidence from the diff
The change deletes the deprecated ‘tor’ alias from ParseNetwork() and from the proxy argument parsing in AppInitMain(). Previously, ‘-proxy=…=tor’ was accepted and mapped to NET_ONION with a warning. After this commit, ‘tor’/’TOR’ parse as NET_UNROUTABLE, so any proxy configured with ‘=tor’ is treated as invalid/unrecognized and is effectively ignored. The functional test is updated to use ‘=onion’.
Changed components
src/netbase.cpp ParseNetwork()src/init.cpp proxy argument parsingsrc/test/netbase_tests.cpptest/functional/feature_proxy.pyInspect captured patch +11 / −12
diff --git a/src/init.cpp b/src/init.cpp
index bfb9483a..9849be22 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1683,7 +1683,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
ipv4_proxy = name_proxy = proxy;
} else if (net_str == "ipv6") {
ipv6_proxy = name_proxy = proxy;
- } else if (net_str == "tor" || net_str == "onion") {
+ } else if (net_str == "onion") {
onion_proxy = proxy;
} else if (net_str == "cjdns") {
cjdns_proxy = proxy;
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 5d8ec5ee..77b532ce 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -1,5 +1,5 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2022 The Bitcoin Core developers
+// Copyright (c) 2009-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -102,10 +102,6 @@ enum Network ParseNetwork(const std::string& net_in) {
if (net == "ipv4") return NET_IPV4;
if (net == "ipv6") return NET_IPV6;
if (net == "onion") return NET_ONION;
- if (net == "tor") {
- LogWarning("Net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.");
- return NET_ONION;
- }
if (net == "i2p") {
return NET_I2P;
}
diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp
index 996f2586..266d952f 100644
--- a/src/test/netbase_tests.cpp
+++ b/src/test/netbase_tests.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2012-2022 The Bitcoin Core developers
+// Copyright (c) 2012-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -348,17 +348,20 @@ BOOST_AUTO_TEST_CASE(netbase_parsenetwork)
BOOST_CHECK_EQUAL(ParseNetwork("ipv4"), NET_IPV4);
BOOST_CHECK_EQUAL(ParseNetwork("ipv6"), NET_IPV6);
BOOST_CHECK_EQUAL(ParseNetwork("onion"), NET_ONION);
- BOOST_CHECK_EQUAL(ParseNetwork("tor"), NET_ONION);
BOOST_CHECK_EQUAL(ParseNetwork("cjdns"), NET_CJDNS);
BOOST_CHECK_EQUAL(ParseNetwork("IPv4"), NET_IPV4);
BOOST_CHECK_EQUAL(ParseNetwork("IPv6"), NET_IPV6);
BOOST_CHECK_EQUAL(ParseNetwork("ONION"), NET_ONION);
- BOOST_CHECK_EQUAL(ParseNetwork("TOR"), NET_ONION);
BOOST_CHECK_EQUAL(ParseNetwork("CJDNS"), NET_CJDNS);
+ // "tor" as a network specification was deprecated in 60dc8e4208 in favor of
+ // "onion" and later removed.
+ BOOST_CHECK_EQUAL(ParseNetwork("tor"), NET_UNROUTABLE);
+ BOOST_CHECK_EQUAL(ParseNetwork("TOR"), NET_UNROUTABLE);
+
BOOST_CHECK_EQUAL(ParseNetwork(":)"), NET_UNROUTABLE);
- BOOST_CHECK_EQUAL(ParseNetwork("tÖr"), NET_UNROUTABLE);
+ BOOST_CHECK_EQUAL(ParseNetwork("oniÖn"), NET_UNROUTABLE);
BOOST_CHECK_EQUAL(ParseNetwork("\xfe\xff"), NET_UNROUTABLE);
BOOST_CHECK_EQUAL(ParseNetwork(""), NET_UNROUTABLE);
}
diff --git a/test/functional/feature_proxy.py b/test/functional/feature_proxy.py
index ba8a0212..aec81fa7 100755
--- a/test/functional/feature_proxy.py
+++ b/test/functional/feature_proxy.py
@@ -468,8 +468,8 @@ class ProxyTest(BitcoinTestFramework):
assert_equal(nets["ipv6"]["proxy"], "127.6.6.6:6666")
self.stop_node(1)
- self.log.info("Test overriding the Tor proxy")
- self.start_node(1, extra_args=["-proxy=127.1.1.1:1111", "-proxy=127.2.2.2:2222=tor"])
+ self.log.info("Test overriding the Onion proxy")
+ self.start_node(1, extra_args=["-proxy=127.1.1.1:1111", "-proxy=127.2.2.2:2222=onion"])
nets = networks_dict(self.nodes[1].getnetworkinfo())
assert_equal(nets["ipv4"]["proxy"], "127.1.1.1:1111")
assert_equal(nets["ipv6"]["proxy"], "127.1.1.1:1111")
Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.