James Golick, a prolific Canadian Rubyist, has declared war on Net:HTTP’s default of not checking the validity of the certificate sent by an HTTP server when making HTTPS requests. His new always_verify_ssl_certificates gem forces Net::HTTP to verify SSL certificates and doesn’t allow other libraries to override this setting.
Despite being a known issue for years, James explains why Net::HTTP’s default setting could be leaving you open to security problems:
While there’s a potential for man-in-the-middle attacks when using Net::HTTP to connect to HTTPS sites, the chances are low, and if you’re not doing anything that needs to be airtight (say, local development work), you might not need to use James’ solution (or if you’re using open_uri). Read More