From c87545d53d36f8d24311bd1d5cbb5bd9c7e31cd4 Mon Sep 17 00:00:00 2001 From: Alvaro Revuelta Date: Tue, 2 Apr 2024 15:14:55 +0200 Subject: [PATCH] fix: regex for rpc endpoint (#2563) --- waku/factory/external_config.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/waku/factory/external_config.nim b/waku/factory/external_config.nim index 5b2e105d72..37fa9c4076 100644 --- a/waku/factory/external_config.nim +++ b/waku/factory/external_config.nim @@ -680,9 +680,9 @@ proc parseCmdArg*(T: type EthRpcUrl, s: string): T = ## disallowed patterns: ## any valid/invalid ws or wss url var httpPattern = - re2"^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*" + re2"^(https?):\/\/([\w-]+(\.[\w-]+)*)(:[0-9]{1,5})?(\/[\w.,@?^=%&:\/~+#-]*)?$" var wsPattern = - re2"^(wss?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*" + re2"^(wss?):\/\/([\w-]+(\.[\w-]+)+)(:[0-9]{1,5})?(\/[\w.,@?^=%&:\/~+#-]*)?$" if regex.match(s, wsPattern): raise newException( ValueError, "Websocket RPC URL is not supported, Please use an HTTP URL"