Skip to content

fix(jsonrpc-utils): require exact loopback host for isLocalhostUrl - #281

Open
SashaMIT wants to merge 1 commit into
WalletConnect:masterfrom
SashaMIT:fix/localhost-url-exact-host
Open

fix(jsonrpc-utils): require exact loopback host for isLocalhostUrl#281
SashaMIT wants to merge 1 commit into
WalletConnect:masterfrom
SashaMIT:fix/localhost-url-exact-host

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown

Summary

isLocalhostUrl used an unanchored wss?://localhost regex. That matched wss://localhost.evil.example / wss://localhostfoo, and ws-connection then set rejectUnauthorized: false.

Parse with URL and allow only exact websocket hosts localhost, 127.0.0.1, and ::1 / [::1].

Test plan

  • mocha ./test/url.test.ts (3 passing)
  • Confirm local ws://localhost relays still skip TLS verify as intended

Made with Cursor

Unanchored wss?://localhost prefix matched wss://localhost.evil.example
and disabled TLS verification in ws-connection. Parse the URL and allow
only exact localhost / 127.0.0.1 / ::1 websocket hosts.
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@SashaMIT

SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown
Author

I have read the CTA Document and I hereby sign the CTA

@SashaMIT

SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant