mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-18 11:37:40 +02:00
Merge #20461: rpc: Validate -rpcauth arguments
053b4fbad8doc: Release note regarding -rpcauth validation (João Barbosa)46001323b1rpc: Validate -rpcauth arguments (João Barbosa)d37c813a43rpc: 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 ACK053b4fbad8jonatack: ACK053b4fbad8ryanofsky: Code review ACK053b4fbad8. Only changes since last review are moving a variable declaration and adding a comment, release notes, and a `const`. Tree-SHA512: c99923d4a121f0c9f882b07f5402ea53e9b2d9455ad34468a094ffab1d64df26c82e1279734c0d42bc2e113eae7b581fbc3be52f3ed4a2d7450d11793afcf406
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user