mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 12:46:32 +00:00
Update alert notification (#2457)
This commit is contained in:
parent
dccfffd979
commit
480eebc6cb
@ -13,7 +13,7 @@ from .base import CheckBase
|
||||
class SecurityReference(str, Enum):
|
||||
"""Version references."""
|
||||
|
||||
CUSTOM_COMPONENTS_BELOW_2021_1_3 = "custom_components_below_2021_1_3"
|
||||
CUSTOM_COMPONENTS_BELOW_2021_1_5 = "custom_components_below_2021_1_5"
|
||||
|
||||
|
||||
class CheckCoreSecurity(CheckBase):
|
||||
@ -22,14 +22,14 @@ class CheckCoreSecurity(CheckBase):
|
||||
async def run_check(self) -> None:
|
||||
"""Run check if not affected by issue."""
|
||||
try:
|
||||
if self.sys_homeassistant.version < AwesomeVersion("2021.1.3"):
|
||||
if self.sys_homeassistant.version < AwesomeVersion("2021.1.5"):
|
||||
if Path(
|
||||
self.sys_config.path_homeassistant, "custom_components"
|
||||
).exists():
|
||||
self.sys_resolution.create_issue(
|
||||
IssueType.SECURITY,
|
||||
ContextType.CORE,
|
||||
reference=SecurityReference.CUSTOM_COMPONENTS_BELOW_2021_1_3,
|
||||
reference=SecurityReference.CUSTOM_COMPONENTS_BELOW_2021_1_5,
|
||||
suggestions=[SuggestionType.EXECUTE_UPDATE],
|
||||
)
|
||||
except AwesomeVersionException:
|
||||
@ -38,7 +38,7 @@ class CheckCoreSecurity(CheckBase):
|
||||
async def approve_check(self) -> bool:
|
||||
"""Approve check if it is affected by issue."""
|
||||
try:
|
||||
if self.sys_homeassistant.version >= AwesomeVersion("2021.1.3"):
|
||||
if self.sys_homeassistant.version >= AwesomeVersion("2021.1.5"):
|
||||
return False
|
||||
except AwesomeVersionException:
|
||||
return True
|
||||
|
@ -43,13 +43,13 @@ class ResolutionNotify(CoreSysAttributes):
|
||||
if issue.type == IssueType.SECURITY and issue.context == ContextType.CORE:
|
||||
if (
|
||||
issue.reference
|
||||
== SecurityReference.CUSTOM_COMPONENTS_BELOW_2021_1_3
|
||||
== SecurityReference.CUSTOM_COMPONENTS_BELOW_2021_1_5
|
||||
):
|
||||
messages.append(
|
||||
{
|
||||
"title": "Security notification",
|
||||
"message": "The Supervisor detected that this version of Home Assistant could be insecure in combination with custom integrations. [Update as soon as possible.](/hassio/dashboard)\n\nFor more information see the [Security bulletin](https://www.home-assistant.io/blog/2021/01/14/security-bulletin/).",
|
||||
"notification_id": "supervisor_update_home_assistant_2021_1_3",
|
||||
"message": "The Supervisor detected that this version of Home Assistant could be insecure in combination with custom integrations. [Update as soon as possible.](/hassio/dashboard)\n\nFor more information see the [Security alert](https://www.home-assistant.io/latest-security-alert).",
|
||||
"notification_id": "supervisor_update_home_assistant_2021_1_5",
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -31,6 +31,10 @@ async def test_check(coresys: CoreSys, tmp_path):
|
||||
await core_security.run_check()
|
||||
assert len(coresys.resolution.issues) == 0
|
||||
|
||||
coresys.homeassistant._data["version"] = AwesomeVersion("2021.1.5")
|
||||
await core_security.run_check()
|
||||
assert len(coresys.resolution.issues) == 0
|
||||
|
||||
coresys.homeassistant._data["version"] = AwesomeVersion("2021.1.2")
|
||||
await core_security.run_check()
|
||||
assert len(coresys.resolution.issues) == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user