From 5cbdbffbb2d3afb5afe7f03b54e583d7ffb6dcad Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 8 Sep 2018 00:17:05 +0200 Subject: [PATCH 1/2] Bump version to 130 --- hassio/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hassio/const.py b/hassio/const.py index baf7ad2ba..93db56f8b 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -2,7 +2,7 @@ from pathlib import Path from ipaddress import ip_network -HASSIO_VERSION = '129' +HASSIO_VERSION = '130' URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons" URL_HASSIO_VERSION = \ From dd25c29544068b13e6561084a2f5042303ca5bfc Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 9 Sep 2018 23:47:35 +0200 Subject: [PATCH 2/2] Bugfix Proxy with new token (#690) * Update proxy.py * Update security.py --- hassio/api/proxy.py | 12 ++++++++++-- hassio/api/security.py | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hassio/api/proxy.py b/hassio/api/proxy.py index e42f67fee..59ead36b3 100644 --- a/hassio/api/proxy.py +++ b/hassio/api/proxy.py @@ -23,7 +23,11 @@ class APIProxy(CoreSysAttributes): def _check_access(self, request): """Check the Hass.io token.""" hassio_token = request.headers.get(HEADER_HA_ACCESS) - addon = self.sys_addons.from_uuid(hassio_token) + addon = self.sys_addons.from_token(hassio_token) + + # Need removed with 131 + if not addon: + addon = self.sys_addons.from_uuid(hassio_token) if not addon: _LOGGER.warning("Unknown HomeAssistant API access!") @@ -178,7 +182,11 @@ class APIProxy(CoreSysAttributes): response = await server.receive_json() hassio_token = (response.get('api_password') or response.get('access_token')) - addon = self.sys_addons.from_uuid(hassio_token) + addon = self.sys_addons.from_token(hassio_token) + + # Need removed with 131 + if not addon: + addon = self.sys_addons.from_uuid(hassio_token) if not addon or not addon.access_homeassistant_api: _LOGGER.warning("Unauthorized websocket access!") diff --git a/hassio/api/security.py b/hassio/api/security.py index c1f9d9b0e..2a17b141f 100644 --- a/hassio/api/security.py +++ b/hassio/api/security.py @@ -51,7 +51,7 @@ class SecurityMiddleware(CoreSysAttributes): raise HTTPUnauthorized() # Home-Assistant - # UUID check need removed with 130 + # UUID check need removed with 131 if hassio_token in (self.sys_homeassistant.uuid, self.sys_homeassistant.hassio_token): _LOGGER.debug("%s access from Home-Assistant", request.path) @@ -66,7 +66,7 @@ class SecurityMiddleware(CoreSysAttributes): addon = None if hassio_token and not request_from: addon = self.sys_addons.from_token(hassio_token) - # Need removed with 130 + # Need removed with 131 if not addon: addon = self.sys_addons.from_uuid(hassio_token)