Start9Labs / bitcoind-startos

wrapper for building bitcoind.s9pk
Other
14 stars 20 forks source link

[Bug] don't allow # in rpc password #99

Closed MattDHill closed 1 year ago

MattDHill commented 2 years ago

Probably for Bitcoin Proxy as well, and maybe even LND, CLN, etc

gStart9 commented 1 year ago

The \ character should also be disallowed, or our toml parser has issues.

For instance, if you put a \ character into the Services > Bitcoin Core > Config > RPC Settings > RPC password, after saving,

Then electrs just says this over and over:

2023-06-28T19:22:56+00:00  Error: Failed to parse configuration file electrs.toml: invalid escape character in string: `G` at line 1 column 32

A view of electrs.toml:

# cat /embassy-data/package-data/volumes/electrs/data/main/electrs.toml 
auth = "bitcoin:dtcp3n4vzkwfos\Gt3btba"
daemon_rpc_addr = "bitcoind.embassy:8332"
daemon_p2p_addr = "bitcoind.embassy:8333"
network = "bitcoin"
electrum_rpc_addr = "0.0.0.0:50001"
log_filters = "INFO"
gStart9 commented 1 year ago

This applies to, apparently, nearly any special character.

Using # within the password results in Bitcoin core printing this and going into a restart loop:

2023-08-13T22:06:29+00:00  Error updating blockchain info: Error reading configuration file: parse error on line 12, using # in rpcpassword can be ambiguous and should be avoided
2023-08-13T22:06:29+00:00  
2023-08-13T22:06:29+00:00  Error: Error reading configuration file: parse error on line 12, using # in rpcpassword can be ambiguous and should be avoided

Using #, % or $ (and probably other chars) within the password results in some but not all dependent services being unable to parse the full password, and subsequently failing to connect to the RPC and they then fail healthchecks, notably, LND and CLN both cannot start after that due to choking on parsing the password.

Fixed by #127