node-http-mitm-proxy
node-http-mitm-proxy copied to clipboard
`Proxy.sslServers` race condition
https://github.com/joeferner/node-http-mitm-proxy/blob/310a3bc8918b07b9c7dbdb345e358f8be2a74044/lib/proxy.ts#L677
...
https server started for www.google.com on 54724
https server started for www.google.com on 54726
...
With concurrent requests to www.google.com
this semaphore is but the asynchronous callback (that populates sslServers
) is outside the lock/sem.
This results in 2+ sslServers created for the same hostname yet only the last is tracked in the dictionary. This also means only the last one is cleaned up upon Proxy.close()
resulting in lingering handles...
This can be kinda worked around with forceSNI: true
which doesn't create extra HTTPS servers.