Skip to content

Commit

Permalink
fix: regex for rpc endpoint (#2563)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta authored Apr 2, 2024
1 parent 8d66a54 commit c87545d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions waku/factory/external_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c87545d

Please sign in to comment.