mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 13:16:29 +00:00
Enable CAS (#3595)
This commit is contained in:
parent
3299772f3c
commit
ff08ca5920
@ -56,4 +56,4 @@ class CheckCoreTrust(CheckBase):
|
|||||||
@property
|
@property
|
||||||
def states(self) -> list[CoreState]:
|
def states(self) -> list[CoreState]:
|
||||||
"""Return a list of valid states when this check can run."""
|
"""Return a list of valid states when this check can run."""
|
||||||
return [CoreState.RUNNING]
|
return [CoreState.RUNNING, CoreState.STARTUP]
|
||||||
|
@ -62,4 +62,4 @@ class CheckPluginTrust(CheckBase):
|
|||||||
@property
|
@property
|
||||||
def states(self) -> list[CoreState]:
|
def states(self) -> list[CoreState]:
|
||||||
"""Return a list of valid states when this check can run."""
|
"""Return a list of valid states when this check can run."""
|
||||||
return [CoreState.RUNNING]
|
return [CoreState.RUNNING, CoreState.STARTUP]
|
||||||
|
@ -72,8 +72,6 @@ class Security(FileConfiguration, CoreSysAttributes):
|
|||||||
|
|
||||||
async def verify_own_content(self, checksum: str) -> None:
|
async def verify_own_content(self, checksum: str) -> None:
|
||||||
"""Verify content from HA org."""
|
"""Verify content from HA org."""
|
||||||
return
|
|
||||||
# pylint: disable=unreachable
|
|
||||||
return await self.verify_content("notary@home-assistant.io", checksum)
|
return await self.verify_content("notary@home-assistant.io", checksum)
|
||||||
|
|
||||||
async def verify_secret(self, pwned_hash: str) -> None:
|
async def verify_secret(self, pwned_hash: str) -> None:
|
||||||
|
@ -15,6 +15,13 @@ async def test_content_trust(coresys: CoreSys):
|
|||||||
assert cas_validate.called
|
assert cas_validate.called
|
||||||
cas_validate.assert_called_once_with("test@mail.com", "ffffffffffffff")
|
cas_validate.assert_called_once_with("test@mail.com", "ffffffffffffff")
|
||||||
|
|
||||||
|
with patch("supervisor.security.cas_validate", AsyncMock()) as cas_validate:
|
||||||
|
await coresys.security.verify_own_content("ffffffffffffff")
|
||||||
|
assert cas_validate.called
|
||||||
|
cas_validate.assert_called_once_with(
|
||||||
|
"notary@home-assistant.io", "ffffffffffffff"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_disabled_content_trust(coresys: CoreSys):
|
async def test_disabled_content_trust(coresys: CoreSys):
|
||||||
"""Test Content-Trust."""
|
"""Test Content-Trust."""
|
||||||
@ -24,6 +31,10 @@ async def test_disabled_content_trust(coresys: CoreSys):
|
|||||||
await coresys.security.verify_content("test@mail.com", "ffffffffffffff")
|
await coresys.security.verify_content("test@mail.com", "ffffffffffffff")
|
||||||
assert not cas_validate.called
|
assert not cas_validate.called
|
||||||
|
|
||||||
|
with patch("supervisor.security.cas_validate", AsyncMock()) as cas_validate:
|
||||||
|
await coresys.security.verify_own_content("ffffffffffffff")
|
||||||
|
assert not cas_validate.called
|
||||||
|
|
||||||
|
|
||||||
async def test_force_content_trust(coresys: CoreSys):
|
async def test_force_content_trust(coresys: CoreSys):
|
||||||
"""Force Content-Trust tests."""
|
"""Force Content-Trust tests."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user