From 228fb8c072a0422c4cd14fb5907fa2a90afa54bc Mon Sep 17 00:00:00 2001 From: Brenton Zillins Date: Tue, 23 May 2017 10:16:54 -0700 Subject: [PATCH] Ensure https base_url in telegram bot (#7726) --- homeassistant/components/telegram_bot/webhooks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/telegram_bot/webhooks.py b/homeassistant/components/telegram_bot/webhooks.py index 690340fc378..928f40b4ffc 100644 --- a/homeassistant/components/telegram_bot/webhooks.py +++ b/homeassistant/components/telegram_bot/webhooks.py @@ -42,6 +42,10 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): _LOGGER.debug("telegram webhook Status: %s", current_status) handler_url = '{0}{1}'.format(hass.config.api.base_url, TELEGRAM_HANDLER_URL) + if not handler_url.startswith('https'): + _LOGGER.error("Invalid telegram webhook %s must be https", handler_url) + return False + if current_status and current_status['url'] != handler_url: result = yield from hass.async_add_job(bot.setWebhook, handler_url) if result: