Skip to content

Commit f5ec5cc

Browse files
DashCoreAutoGuixMarcoFalke
andauthored
Merge bitcoin#26829: init: Remove unnecessary sensitive flag from rpcbind
b9d5674 init: Remove sensitive flag from rpcbind (Andrew Chow) Pull request description: `-rpcbind` is currently flagged as a sensitive option which means that its value will be masked when the command line args are written to the debug.log file. However this is not useful as if `rpcbind` is actually activated, the bound IP addresses will be written to the log anyways. The test `feature_config_args.py` did not catch this contradiction as the test node was not started with `rpcallowip` and so `rpcbind` was not acted upon. This also brings `rpcbind` inline with `bind` as that is not flagged as sensitive either. ACKs for top commit: Sjors: re-utACK b9d5674 willcl-ark: ACK b9d5674 theStack: ACK b9d5674 Tree-SHA512: 50ab5ad2e18ae70649deb1ac429d404b5f5c41f32a4943b2041480580152df22e72d4aae493379d0b23fcb649ab342376a82119760fbf6dfdcda659ffd3e244a Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^[email protected]>
1 parent 014db8a commit f5ec5cc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ void SetupServerArgs(ArgsManager& argsman)
758758
argsman.AddArg("-rest", strprintf("Accept public REST requests (default: %u)", DEFAULT_REST_ENABLE), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
759759
argsman.AddArg("-rpcallowip=<ip>", "Allow JSON-RPC connections from specified source. Valid values for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0), a network/CIDR (e.g. 1.2.3.4/24), all ipv4 (0.0.0.0/0), or all ipv6 (::/0). This option can be specified multiple times", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
760760
argsman.AddArg("-rpcauth=<userpw>", "Username and HMAC-SHA-256 hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
761-
argsman.AddArg("-rpcbind=<addr>[:port]", "Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
761+
argsman.AddArg("-rpcbind=<addr>[:port]", "Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC);
762762
argsman.AddArg("-rpccookiefile=<loc>", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
763763
argsman.AddArg("-rpcexternaluser=<users>", "List of comma-separated usernames for JSON-RPC external connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
764764
argsman.AddArg("-rpcexternalworkqueue=<n>", strprintf("Set the depth of the work queue to service external RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);

test/functional/feature_config_args.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def test_args_log(self):
122122
expected_msgs=[
123123
'Command-line arg: addnode="some.node"',
124124
'Command-line arg: rpcauth=****',
125-
'Command-line arg: rpcbind=****',
126125
'Command-line arg: rpcpassword=****',
127126
'Command-line arg: rpcuser=****',
128127
'Command-line arg: torpassword=****',
@@ -131,14 +130,17 @@ def test_args_log(self):
131130
],
132131
unexpected_msgs=[
133132
'alice:f7efda5c189b999524f151318c0c86$d5b51b3beffbc0',
134-
'127.1.1.1',
135133
'secret-rpcuser',
136134
'secret-torpassword',
135+
'Command-line arg: rpcbind=****',
136+
'Command-line arg: rpcallowip=****',
137137
]):
138138
self.start_node(0, extra_args=[
139139
'-addnode=some.node',
140140
'-rpcauth=alice:f7efda5c189b999524f151318c0c86$d5b51b3beffbc0',
141141
'-rpcbind=127.1.1.1',
142+
'-rpcbind=127.0.0.1',
143+
"-rpcallowip=127.0.0.1",
142144
'-rpcpassword=',
143145
'-rpcuser=secret-rpcuser',
144146
'-torpassword=secret-torpassword',

0 commit comments

Comments
 (0)