Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cmcp_runtime/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
# audit/trace_claim.py - kept as a local constant to avoid a circular import.
_VALID_PROVIDERS: frozenset[str] = frozenset({
"sev-snp",
"azure-cvm-sev-snp",
"tdx",
"opaque",
"tpm",
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/test_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,21 @@ def test_an_unknown_profile_is_a_config_error(tmp_path, monkeypatch):
monkeypatch.setenv("CMCP_DEV_MODE", "1")
with pytest.raises(SystemExit):
run_startup(str(config_path))


def test_valid_providers_matches_the_map_it_says_it_mirrors():
"""The comment above ``_VALID_PROVIDERS`` says it mirrors the keys of
``_PROVIDER_MAP``. It did not: ``azure-cvm-sev-snp`` was in the map and not in
the set, so ``_validate_attestation_report`` raised
``ATTESTATION_PROVIDER_INVALID`` on every Azure confidential-VM report and the
gateway exited. Found by @zohebk8s while wiring #552's report_data binding,
which applies to that provider and could not be reached through this path.

Comparing the two sets rather than asserting one membership, so the next
provider added to either side cannot drift the same way.
"""
from cmcp_runtime.audit.trace_claim import _PROVIDER_MAP
from cmcp_runtime.startup import _VALID_PROVIDERS

mapped = frozenset(_PROVIDER_MAP)
assert mapped == _VALID_PROVIDERS