You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now the hostname presented on a TLS certificate is never
validated. This means that man-in-the-middle attacks are trivial when
using for example public CAs to sign certificates.
The issue is that anyone can have a public CA sign a certificate for a
hostname they own, which is key to the security model there. But with
the current functionality in the `mysql2` driver, the hostname is never
verified.
This means an attacker could do a man in the middle attack and only has
to present a signed certificate but doesn't have to match the hostname.
It does not only apply to public CAs in system roots, but also for
example Amazon RDS where a single root chain is also used.
The changes here add an option to explicitly verify the identity on the
certificate. This option is available in other MySQL drivers as well,
such as `libmysqlclient` and everything based on that (often drivers for
Ruby, Python etc.). Also other languages like Go, Java, .Net etc.
provide an option to have strict identity verification.
Ideally of course, this validation would be the default and always
enforced, but that also would likely be a significant breaking change,
so right now in the code here the setting is opt-in for having a secure
connection to MySQL.
Additionally, it adds SNI on the connection which is a best practice as
well.
0 commit comments