ha-inlite

Home Assistant integration for in-lite
git clone https://git.stephank.nl/ha-inlite
Log | Files | Refs | README | LICENSE | ZIP

commit 5cdd3c0934669228af65a9fc00a3135fbcb82793
parent dce7cd8e1b39aed24972fa2ec5a9fcd05b162265
Author: Stéphan Kochen <git@stephank.nl>
Date: Thu, 03 Sep 2026 21:11:35 +0200

Validate raw mesh key setup input

diff --git a/custom_components/inlite/config_flow.py b/custom_components/inlite/config_flow.py index bf58e5c8865bc225b3cf6580f0f835c3a66b2480..aa99ee8035e763e342d9007ebd5937f65ff980d9 100644 --- a/custom_components/inlite/config_flow.py +++ b/custom_components/inlite/config_flow.py @@ -125,10 +125,14 @@ errors["base"] = "invalid_credentials" else: self._passphrase = passphrase elif self._setup_mode == SETUP_NETWORK_KEY: - try: - network_key = bytes.fromhex(user_input[CONF_NETWORK_KEY].strip()) - except ValueError: + network_key_text = user_input[CONF_NETWORK_KEY].strip() + if ( + len(network_key_text) != 32 + or any(char not in "0123456789abcdefABCDEF" for char in network_key_text) + ): network_key = b"" + else: + network_key = bytes.fromhex(network_key_text) if len(network_key) != 16: errors["base"] = "invalid_network_key" else: