44
55import logging
66
7- from ..const import (
8- ATTR_CONTENT_TRUST ,
9- ATTR_FORCE_SECURITY ,
10- ATTR_PWNED ,
11- FILE_HASSIO_SECURITY ,
12- )
7+ from ..const import ATTR_PWNED , FILE_HASSIO_SECURITY
138from ..coresys import CoreSys , CoreSysAttributes
14- from ..exceptions import PwnedError
159from ..utils .common import FileConfiguration
1610from ..utils .pwned import check_pwned_password
1711from ..validate import SCHEMA_SECURITY_CONFIG
@@ -27,26 +21,6 @@ def __init__(self, coresys: CoreSys):
2721 super ().__init__ (FILE_HASSIO_SECURITY , SCHEMA_SECURITY_CONFIG )
2822 self .coresys = coresys
2923
30- @property
31- def content_trust (self ) -> bool :
32- """Return if content trust is enabled/disabled."""
33- return self ._data [ATTR_CONTENT_TRUST ]
34-
35- @content_trust .setter
36- def content_trust (self , value : bool ) -> None :
37- """Set content trust is enabled/disabled."""
38- self ._data [ATTR_CONTENT_TRUST ] = value
39-
40- @property
41- def force (self ) -> bool :
42- """Return if force security is enabled/disabled."""
43- return self ._data [ATTR_FORCE_SECURITY ]
44-
45- @force .setter
46- def force (self , value : bool ) -> None :
47- """Set force security is enabled/disabled."""
48- self ._data [ATTR_FORCE_SECURITY ] = value
49-
5024 @property
5125 def pwned (self ) -> bool :
5226 """Return if pwned is enabled/disabled."""
@@ -63,9 +37,4 @@ async def verify_secret(self, pwned_hash: str) -> None:
6337 _LOGGER .warning ("Disabled pwned, skip validation" )
6438 return
6539
66- try :
67- await check_pwned_password (self .sys_websession , pwned_hash )
68- except PwnedError :
69- if self .force :
70- raise
71- return
40+ await check_pwned_password (self .sys_websession , pwned_hash )
0 commit comments