What version of Bun is running?
1.3.14
What platform is your computer?
linux x64
What steps can reproduce the bug?
start a https server with:
- ipv6 as hostname
- self-signed certificate
- ipv6 in SAN
run the following script with NODE_EXTRA_CA_CERTS=/path/to/ca.crt bun run xxx.mjs
import { checkServerIdentity } from 'node:tls'
import { isIP } from 'node:net'
process.env.BUN_CONFIG_VERBOSE_FETCH = "true";
// replace the host part with the real ipv6
await fetch('https://[ff:ff:ff:ff:ff:ff:ff:ff]:8088/v1', {
verbose: true,
tls: {
checkServerIdentity: (hostname, cert) => {
console.log(hostname);
return checkServerIdentity(hostname, cert);
},
},
});
What is the expected behavior?
fetch return normally
What do you see instead?
ERR_TLS_CERT_ALTNAME_INVALID with reason: "Host: [ff:ff:ff:ff:ff:ff:ff:ff]. is not in the cert's altnames: IP Address:FF:FF:FF:FF:FF:FF:FF:FF",
Additional information
The reason is tls.checkServerIdentity did not work well tieh ipv6 hostname in bracket. I fix it and make a PR here: #30662
What version of Bun is running?
1.3.14
What platform is your computer?
linux x64
What steps can reproduce the bug?
start a https server with:
run the following script with
NODE_EXTRA_CA_CERTS=/path/to/ca.crt bun run xxx.mjsWhat is the expected behavior?
fetch return normally
What do you see instead?
ERR_TLS_CERT_ALTNAME_INVALID with reason: "Host: [ff:ff:ff:ff:ff:ff:ff:ff]. is not in the cert's altnames: IP Address:FF:FF:FF:FF:FF:FF:FF:FF",
Additional information
The reason is
tls.checkServerIdentitydid not work well tieh ipv6 hostname in bracket. I fix it and make a PR here: #30662