8000 connect host option by jasonharmongit · Pull Request #147 · dominicletz/websockex · GitHub
[go: up one dir, main page]

Skip to content

connect host option - #147

Open
jasonharmongit wants to merge 1 commit into
dominicletz:masterfrom
surgeapi:connect-host-option
Open

jasonharmongit wants to merge 1 commit into
dominicletz:masterfrom
surgeapi:connect-host-option

Conversation

@jasonharmongit
@jasonharmongit jasonharmongit commented Oct 29, 2026 •
Copy link
Copy Markdown

Currently, WebSockex takes the URL a caller provides, extracts the host, looks up its IP, and opens a connection there. This leaves callers vulnerable to SSRF attacks--even if the caller does their own DNS lookup to verify the IP, an attacker who controls the hostname could answer the caller's lookup with a public address, then answer WebSockex's lookup with an internal address on the caller's network. On wss:// the certificate check usually stops the handshake. On ws:// the connection can complete.

This PR lets the caller pass the verified IP address as connect_host. WebSockex opens the socket to that address and does not look the URL host up again. The original host name still goes to the peer in the Host header and, for wss://, as the server name. The certificate check still uses that host name.

Leave connect_host out and WebSockex connects as it does today.

@dominicletz
Copy link
Copy Markdown
Owner

@jasonharmongit can you resolve the conflicts?

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.

2 participants

0