aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-12-02 09:35:31 +0100
committerMarcoFalke <falke.marco@gmail.com>2020-12-02 09:37:37 +0100
commit283f22cabb9afcb159cb1a9793b5249e55975636 (patch)
treea6d434144d01eeb8c170678bb27797f5465812ac /test
parent607c844f3720f51bb011f302a7ce742fcb6b8ae3 (diff)
parent053b4fbad8729308774d5e7b53f53c12627fa88b (diff)
downloadbitcoin-283f22cabb9afcb159cb1a9793b5249e55975636.tar.xz
Merge #20461: rpc: Validate -rpcauth arguments
053b4fbad8729308774d5e7b53f53c12627fa88b doc: Release note regarding -rpcauth validation (João Barbosa) 46001323b1f4a57d8d6805f1bc39a5b8d401f0c5 rpc: Validate -rpcauth arguments (João Barbosa) d37c813a43166f559a4e2d1c22e7243f70301291 rpc: Refactor to process -rpcauth once (João Barbosa) Pull request description: Invalid `-rpcauth` arguments are currently silently ignored. This make server initialization fail if any `-rpcauth` is invalid. ACKs for top commit: MarcoFalke: review ACK 053b4fbad8729308774d5e7b53f53c12627fa88b jonatack: ACK 053b4fbad8729308774d5e7b53f53c12627fa88b ryanofsky: Code review ACK 053b4fbad8729308774d5e7b53f53c12627fa88b. Only changes since last review are moving a variable declaration and adding a comment, release notes, and a `const`. Tree-SHA512: c99923d4a121f0c9f882b07f5402ea53e9b2d9455ad34468a094ffab1d64df26c82e1279734c0d42bc2e113eae7b581fbc3be52f3ed4a2d7450d11793afcf406
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_users.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/functional/rpc_users.py b/test/functional/rpc_users.py
index daf02fc4f3..108af2cac8 100755
--- a/test/functional/rpc_users.py
+++ b/test/functional/rpc_users.py
@@ -99,11 +99,18 @@ class HTTPBasicsTest(BitcoinTestFramework):
self.test_auth(self.nodes[1], self.rpcuser, self.rpcpassword)
- self.log.info('Check that failure to write cookie file will abort the node gracefully')
+ init_error = 'Error: Unable to start HTTP server. See debug log for details.'
+
+ self.log.info('Check -rpcauth are validated')
+ # Empty -rpcauth= are ignored
+ self.restart_node(0, extra_args=['-rpcauth='])
self.stop_node(0)
+ self.nodes[0].assert_start_raises_init_error(expected_msg=init_error, extra_args=['-rpcauth=foo'])
+ self.nodes[0].assert_start_raises_init_error(expected_msg=init_error, extra_args=['-rpcauth=foo:bar'])
+
+ self.log.info('Check that failure to write cookie file will abort the node gracefully')
cookie_file = os.path.join(get_datadir_path(self.options.tmpdir, 0), self.chain, '.cookie.tmp')
os.mkdir(cookie_file)
- init_error = 'Error: Unable to start HTTP server. See debug log for details.'
self.nodes[0].assert_start_raises_init_error(expected_msg=init_error)