From fc38bda03ca3f7707a394cb60014925619d5524a Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Wed, 17 Aug 2022 16:50:44 -0400 Subject: [PATCH] Strengthen --daemon_url checks using yarl.URL (what aiohttp uses). --- hub/scribe/network.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hub/scribe/network.py b/hub/scribe/network.py index 58466f0..144b0c3 100644 --- a/hub/scribe/network.py +++ b/hub/scribe/network.py @@ -4,6 +4,7 @@ import typing from typing import List from hashlib import sha256 from decimal import Decimal +from yarl import URL from hub.schema.base58 import Base58 from hub.schema.bip32 import PublicKey from hub.common import hash160, hash_to_hex_str, double_sha256 @@ -72,6 +73,9 @@ class LBCMainNet: url += f':{cls.RPC_PORT:d}' if not url.startswith('http://') and not url.startswith('https://'): url = 'http://' + url + obj = URL(url) + if not obj.user or not obj.password: + raise CoinError(f'unparseable : in daemon URL: "{url}"') return url + '/' @classmethod