MySQL Query Service 2.2.0
This release is about the configuration screens telling you what went wrong,
and about the connection a service call lands on when it does not name one.
Minimum Home Assistant version is now 2025.3.0. The integration already
needed it; HACS will not offer this update to older installations.
Security fix — please update
This release moves the aiomysql requirement from 0.2.0 to 0.3.2, which fixes
CVE-2025-62611 (high,
CVSS 8.2).
MySQL lets a server ask the client for a file from the client's own disk, through
LOAD DATA LOCAL INFILE. The client is supposed to refuse when its local_infile
option is off. Up to and including aiomysql 0.2.0 that check was missing entirely,
so a rogue or compromised database server could ask for any file the Home
Assistant process can read — secrets.yaml, the tokens under .storage/, your
whole configuration directory.
This integration never enables local_infile and never issues such a statement.
That is not what protected you, though: the option was ignored, and the request
comes from the server without your automations doing anything at all. The fix is
in the driver itself, which now refuses the request, so updating is the whole
remedy.
Home Assistant installs the new driver on the first start after the update. Give
that start a little extra time and make sure the instance can reach PyPI.
You are most exposed if your database is not on a machine and network you fully
trust — a VPS, a shared network, or a server someone else administers.
Connection problems now say what they are
Setting up a connection used to report every failure the same way: "Failed to
connect, please check your settings." The reason was in the log, if you went
looking.
Now the cause is named. Wrong credentials, a database that does not exist or
that your user cannot reach, and a server that is simply not answering are told
apart, and the causes that do not speak for themselves carry the driver's own
message onto the form. A refused connection, a timeout and a rejected charset
each need a different fix, and now you can tell which one you have.
Configure checks the connection before saving
Changing settings through Configure used to save whatever you submitted,
without trying it. A mistyped password was stored, the connection reloaded, and
it failed with the reason visible only in the log.
Configure now verifies the connection first, reports the problem on the form the
way the initial setup does, and hands the form back with your values still in it.
Which connection a call runs on
If you have two or more connections and you call mysql_query.query or
mysql_query.execute without a config_entry, the call now goes to the
first connection in Home Assistant's config entry registry — an order that stays
the same across reloads.
Previously it went to whichever connection was set up first, which meant that
reloading that connection silently moved later calls to a different database.
With a single connection nothing changes. If your automations always pass
config_entry, nothing changes either.
Also in this release
- Both services have their own icon in the UI instead of the generic fallback.
- Enabling debug logging on the integration now also enables the
aiomysql
logger, so the driver's own messages appear around a connection problem. - The test suite and a linter run on every push. The HACS validation workflow
was checking out nothing at all and therefore validating nothing; it does now. - The README claimed Home Assistant 2023.7 or newer. Corrected.
Upgrading
Existing connections keep working and nothing needs reconfiguring. Two things to
be aware of: the database driver is replaced on the first start after the update
(see the security fix above), and the default-connection change applies only if
you run more than one connection and leave config_entry empty in your
automations.
Full changelog: v2.1.1...v2.2.0