home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.81k stars 29.53k forks source link

Z-Wave integration performs DoS on Z-Wave JS Server with incompatible API #121500

Open AlCalzone opened 1 month ago

AlCalzone commented 1 month ago

The problem

While working on the migration of Z-Wave JS Server to node-zwave-js v13, which had some incompatible changes, I noticed tons of logs in the server logs:

... a couple thousand lines ...
2024-07-08 10:56:36.327 INFO Z-WAVE-SERVER: Client disconnected
2024-07-08 10:56:36.348 INFO Z-WAVE-SERVER: Client disconnected
2024-07-08 10:56:36.372 INFO Z-WAVE-SERVER: Client disconnected

I still had a HA instance with the Z-Wave addon pointed to that IP address. In the HA logs, this error shows up several thousand times aswell:

Logger: homeassistant.components.zwave_js
Source: components/zwave_js/__init__.py:923
integration: Z-Wave (documentation, issues)
First occurred: 10:54:43 AM (4661 occurrences)
Last logged: 10:56:36 AM

Unexpected exception: DeviceClassItem.__init__() missing 1 required positional argument: 'key'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/__init__.py", line 923, in client_listen
    await client.listen(driver_ready)
  File "/usr/local/lib/python3.12/site-packages/zwave_js_server/client.py", line 270, in listen
    await self._loop.run_in_executor(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zwave_js_server/model/driver.py", line 71, in __init__
    self.controller = Controller(client, state)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zwave_js_server/model/controller/__init__.py", line 84, in __init__
    node = Node(client, node_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zwave_js_server/model/node/__init__.py", line 118, in __init__
    self.update(data)
  File "/usr/local/lib/python3.12/site-packages/zwave_js_server/model/node/__init__.py", line 444, in update
    self._device_class = DeviceClass(device_class)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zwave_js_server/model/device_class.py", line 43, in __init__
    self._specific = DeviceClassItem(**data["specific"])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceClassItem.__init__() missing 1 required positional argument: 'key'

What version of Home Assistant Core has the issue?

core-2024.8.0.dev202407060218

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Z-Wave JS

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

AlCalzone commented 1 month ago

The upstream issue https://github.com/home-assistant-libs/zwave-js-server-python/issues/1009 has been fixed, but I wonder if there should be some kind of backoff mechanism instead of immediately retrying the connection.

home-assistant[bot] commented 1 month ago

Hey there @home-assistant/z-wave, mind taking a look at this issue as it has been labeled with an integration (zwave_js) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zwave_js` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zwave_js` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zwave_js documentation zwave_js source (message by IssueLinks)