Description
Build environment: Windows
Moddable SDK version: 5.0.1
Target device: ESP32, Simulator (Win)
Description
A SecureSocket
connection can be made to a server even when the connection name does not match the certificate names (CN/SAN).
The connection succeeds and communicates without errors over the secure connection.
Steps to Reproduce
- Start with
examples/network/socket/socketsecure
- Change the connection line to use the IP address of
example.com
(93.184.215.14
as of this write-up), which does not match the certificate. Alternatively, you can set up a DNS entry that resolves to that address and then use the DNS name instead of the IP address.
Line before changing:
(new SecureSocket({host, port,
Line after changing:
(new SecureSocket({host: "93.184.215.14", port,
This approach keeps the
host
variable referencingwww.example.com
so the HTTP GET will use the expected hostname (example.com
requires this to return the normal page content, though it can be overridden and the connection will succeed but the HTTP payload will be an error message).
- Run on simulator or ESP32 and see that the connection succeeds and the page content is returned.
Other information
If the certificate is expired (or time is not set on ESP32; can't easily simulate on win
as Time.set(...)
isn't supported), or the certificate root is invalid, it correctly rejects the session.